Are there differences in how Google App Engine handles PHP and MySQL? I am trying to port an extremely simple application from GoDaddy to Google App Engine and Google Cloud SQL. I've spent 2 days reading, trying, recoding and I cannot figure this out. Each time I trigger the PHP file instead of creating 1 record in 2 different tables as it should, it creates 2 records in each table with null values for some columns (that should absolutely not be allowed null values).
It worked flawlessly on GoDaddy, and has extraneous record creations on Google Cloud SQL?
<?php
header("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
$servername = "ipinfo";
$dbconn = new PDO('mysql:unix_socket=/cloudsql/connectinfo',
'root', // username
'' // password
);
$phone = $_REQUEST['From'];
$message = addslashes($_REQUEST['Body']);
$convoSQL = "SELECT id FROM smsConversation WHERE phone=$phone AND closed='0' order by timestamp desc;";
$info = $dbconn->query($convoSQL);
foreach ($info as $row) {
$openConversation = $row['id'];
}
if($row == false){
$newConvoQuery = "INSERT INTO smsConversation (phone) values ('$phone');";
$dbconn->query($newConvoQuery);
$openConversation = $dbconn->lastInsertId();;
}
$sql = "INSERT INTO smsMessage (phone,message,conversation_id) values ('$phone','$message','$openConversation');";
$dbconn->exec($sql);
echo "<Response>";
echo '<Sms to="+mynumber">You have a new text from ' . $phone . ' saying ' . $message . '</Sms>';
echo "</Response>";