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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux