Note that there are some explanatory texts on larger screens.

plurals
  1. POInserting data into online DB
    primarykey
    data
    text
    <p>I am trying to insert some values to MySQL DB accessing it online via iPad app.</p> <p>Sends data out:</p> <pre><code>if(txtInput != nil){ NSString *postVars = [NSString stringWithFormat:@"id=%d&amp;input=%@", index, txtInput.text]; NSLog(@"%d",index); index++; NSData *data = [postVars dataUsingEncoding:NSUTF8StringEncoding]; NSString *strURL = @"http://localhost:8888/Insert.php"; NSURL *url = [NSURL URLWithString:strURL]; NSMutableURLRequest *req = [[NSMutableURLRequest alloc]initWithURL:url]; [req setHTTPBody:data]; [req setHTTPMethod:@"POST"]; NSURLConnection *con = [NSURLConnection connectionWithRequest:req delegate:self]; } </code></pre> <p>The script for Web service:</p> <pre><code>&lt;?php $host = 'localhost'; $username = 'root'; $password = 'root'; $con = mysql_connect($host, $username, $password); if(!$con) { echo "Failed connection"; echo "&lt;br/&gt;"; die('Connection failed'); } mysql_select_db("unbounded", $con); $ids = $_GET['id']; $str = $_GET['input']; $in= mysql_query("INSERT INTO `unbounded`.`stuff` (`id`, `string`) VALUES ('$ids','$str');"); echo $in; echo "&lt;br/&gt;"; mysql_close($con); ?&gt; </code></pre> <p>Once I run my app at PHPAdmin page I can see that id value has been set to 0 each time I execute the app whilst string value is empty.</p> <p>If I run the script via browser to inserts data fine. By the way, once I execute the script vi browser I discovered that connection with DB has been established well. . What might be the prob? Best regrads</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload