Re: Been staring at the code for too long...

From: Date: Sat, 10 Jan 2009 13:35:23 +0000
Subject: Re: Been staring at the code for too long...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-285941@lists.php.net to get a copy of this message
At 1:38 PM -0500 1/9/09, Jason Pruim wrote:
        mysqli_stmt_prepare($stmt, "UPDATE database.table (
Jason: Here's the problem, your code should read: mysqli_stmt_prepare($stmt, "UPDATE database.table SET ( You forgot the "SET". As a point of practice, I always use: $query = "UPDATE $db_table SET first = '$first', second = '$second' WHERE id = '$id' "; and then use the $query, such as: mysqli_stmt_prepare($stmt, $query); I know every one has their own way, but also consider the following code: --- code --- $result = mysql_query($query) or die(report($query,__LINE__ ,__FILE__)); // with an accompanying function of: //==================== show dB errors ====================== function report($query, $line, $file) { echo($query . '<br>' .$line . '<br/>' . $file . '<br/>' . mysql_error()); } --- end of code --- This will: 1. Allow you to see your errors in more detail during development; 2. After the development, you have only to comment out one line of code (the echo) to stop reporting dB errors project-wide. It works for me. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com

« previous php.general (#285941) next »