Re: [PHP] Been staring at the code for too long...
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Been staring at the code for too long...
On Jan 10, 2009, at 8:35 AM, tedd wrote: 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); Hey tedd, I hadn't done a update in a prepared statement before... and it was something I set up quite awhile ago... I ended up rewriting it just to refresh my mind on how it was working :) 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. I really need to start doing that... Then I can track down the issues easier hopefully... :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Been staring at the code for too long...
mysqli_stmt_prepare($stmt, UPDATE database.table ( FName, LName, email, phone, url, record, subscribed, date, IPAddress, Business, Address1, City, State, Zip, Coffee, Meeting, areaPlans) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)); Warning: mysqli_stmt_bind_param() [function.mysqli-stmt-bind-param]: invalid object or resource mysqli_stmt in /public_html/purl/purlprocess.php on line 67 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '( FName, LName, email, phone, url, recor' at line 1 Am I just going crazy or is there something really wrong? Okay.. I'm done... First stupid question of the year... Only 3,349,587 more to go for the year! :P I don't work with MySQL, but shouldn't the UPDATE syntax be something like this: mysqli_stmt_prepare($stmt, UPDATE database.table SET FName = ?, LName = ?, email = ?, phone = ? WHERE id = ?);
Re: [PHP] Been staring at the code for too long...
On Fri, Jan 9, 2009 at 13:38, Jason Pruim japr...@raoset.com wrote: Okay... So I know this is a stupid question... It sure is. -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Unadvertised dedicated server deals, too low to print - email me to find out! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Been staring at the code for too long...
On Jan 9, 2009, at 4:29 PM, Daniel Brown wrote: On Fri, Jan 9, 2009 at 13:38, Jason Pruim japr...@raoset.com wrote: Okay... So I know this is a stupid question... It sure is. I'm going to rewrite the whole thing anyway... I think I can do it better/more efficient given the time to look at it. I really need to do more programming more often...I get rusty to quickly :P -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php