I'm new to PHP, hopefully someone can help me!
my program is trying to access MySQL database and get the value of one particular field: Id and pass it onto Insert query.
The code is:
$queryId = "SELECT Id FROM category WHERE category.description = 'XXX' ");
$result = mysql_query($queryId);
$catId = mysql_result($result);
$query = "INSERT INTO message (phoneNo, message, time, Id)
values ('$phone', '$message','$time', '$catId')";
Without the ID bit, the insert query works fine. However after I added the line with :
mysql_result($result)
it looks like it causes this error:
Command not completed. Request returned an invalid content type: text/html: charset=ISO-8859-1.
My database has: type InnoDB and collation latin1_general_cs.
The PHP doc has: header("Content-Type: text/plain");
changing that to html did not help!
I simply don't have a clue what's wrong.
Thanks for your help!