Bizarre PHP/MySQL behaviour

wxdqz

New Member
I'm fairly new to PHP and MySQL but this seems too much.

I'm modifying a script found in a text by Paul Dubois where I want to update a table in my MySQL database:

$query = "REPLACE INTO instructors (member_id,location,cert_date,status)"
. "VALUES ('$member_id', '$location', '$cert_date', '$status')";

when I run the script my table is not updated and no errors are given,

BUT,

If I include the following error checking code immediately after the above code IT DOES UPDATE:

if (!( $result = mysql_query ($query)))
{
print ("errno: " . mysql_errno());
print ("error: " . mysql_error());
}

What is going on here? I am completely at a loss.

As an aside, what should I use to update my tables? I am confused between INSERT, UPDATE, and REPLACE.

Pumpkinhead
 
Back
Top