Re: INSERT query runs in mysql client, but not in PHP.
smedstadc wrote:
> Hi, I'm learning the ropes with PHP and MySQL at the moment, and I've
> run into a puzzle. I'm using PHP to process a form and insert some
> simple information into a table. The code doesn't have any glaring
> errors, and the mysql_query() doesn't error out, but the info never
> gets inserted. And if I run the same query inside the mysql client the
> data goes in fine. The query looks like this in PHP:
You don't seem to actually check the return value from mysql_query().
You return it from your function, but where you call addNewStory(), you
don't check what it returns.
You could try for example something like this:
<?php
$result = mysql_query('SELECT * WHERE 1=1');
if (!$result) {
die('Invalid query: ' . mysql_error());
}
?>
|