[CS-FSLUG] another sql qustions

Frank Bax fbax at sympatico.ca
Sat Dec 27 15:37:13 CST 2008

David McGlone wrote:
> it seems everything is working except it is not getting inserted into the database.
> $query = "UPDATE workshop subheaderText SET NULL,
>         subheaderText='".$_POST['subheaderText']."',
>         headerText='".$_POST['headerText']."',
> 	page='".$_POST['pageID']."'
>         WHERE subheaderTextID='".$_POST['subheaderTextID']."'";
> $query2= "SELECT * FROM subheaderText WHERE subheaderTextid=1";
> $result2= @mysql_query($query2);

You create a string called $query and then never send it to mysql!  You 
should also test $result after every call to mysql_query; in case the 
query fails.

$query = "UPDATE ....
$result = @mysql_query($query);
if (!$result) { die($query.' ERROR: '.mysql_error()); }

$query2= "SELECT * FROM subheaderText WHERE subheaderTextid=1";
$result2= @mysql_query($query2);
if (!$result2) { die($query2.' ERROR: '.mysql_error()); }

More information about the Christiansource mailing list