How to insert records in external database with objective-C

I have a question, want to make an application to insert records in an external database, but does not work.
Does anyone help me?
This is my xCode code:

-(IBAction)enviar:(id)sender
{
    NSString *url = [NSString stringWithFormat:@"http://192.168.1.37/mysql_iphone/insertar_alumno.php?nombre=%@&poblacion=%@",cajaNombre.text,cajaPoblacion.text];
    NSData *dataUrl = [NSData dataWithContentsOfURL:[NSURL URLWithString:url]];

    NSString *strResult = [[NSString alloc] initWithData:dataUrl encoding:NSUTF8StringEncoding];
    NSLog(@"%@",strResult);
}

and this, is my php code

  • Redrawing a UIView with a fade animation?
  • Framework (RestKit) not compatible with armv7s
  • iPhone: Sorting based on location
  • AVPlayer not synchronized
  • how to check an dispatch_async block has finished running
  • iOS: Why do I have white, rounded corners on my modal view?
  •  <?php
       //Credenciales de la BBDD
       $db = "iphone";
       $host = 'localhost';
       $username = "dpbataller";
       $password = '1234';
    
       //Conectamos al servidor de la Base de datos
       $link = mysql_connect($host,$username,$password) or die("No se puede conectar");
       //Seleccionamos la BBDD
       @mysql_select_db($db) or die ("No se ha podido seleccionar a la base de datos");
    
       //Creamos un array para almacenar los resultados
       $arr = array();
    
       //Recogemos los valores
       //$nombre = $_POST['nombre'];
       //$poblacion = $_POST['poblacion'];
       //Lanzamos la consulta
       $consulta = mysql_query("INSERT INTO alumnos (id,nombre,poblacion)  VALUES  ('','$_POST[nombre]','$_POST[poblacion]')";
    
       ?>
    

    and this is the message of Xcode console:

    2012-04-26 23:04:44.981 parse[902:f803] <br />
    <b>Parse error</b>:  syntax error, unexpected ';' in     <b>/Applications/XAMPP/xamppfiles/htdocs/mysql_iphone/insertar_alumno.php</b> on line <b>21</b><br />
    

    What am I doing wrong?

    Solutions Collect From Internet About “How to insert records in external database with objective-C”

    $consulta = mysql_query(“INSERT INTO alumnos (id,nombre,poblacion) VALUES (”,’$_POST[‘nombre’]’,’$_POST[‘poblacion’]’)”;