Re: Query stopping after 2 records?

From: Date: Mon, 04 May 2009 19:43:29 +0000
Subject: Re: Query stopping after 2 records?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-292244@lists.php.net to get a copy of this message
Miller, Terion napsal(a):
I need help/advice figuring out why my query dies after 2 records. Here is the query:
         // Build your INSERT statement here
      
$query = "INSERT into warrants (wid, name, age, warrant, bond, wnumber, crime) VALUES (";
    $query .= " '$wid', '$name', '$age', '$warrant',
'$bond', '$wnumber', '$crime' )";
        $wid = mysql_insert_id();
// run query
     mysql_query($query) or die ("GRRRRRRR");
echo $query; It inserts two records and dies half way thru the 3rd? Thanks in advance for clues to fix this. T.Miller
Should be: ------------------ $sql = ... $query = mysql_query($sql) or die(... while ($r = mysql_fetch_array($query)) { .... ------------------ Notice that you need to assign the mysql_query to a $query variable! If you understand this, then there's most probably a mistake in your SQL statement. Martin

« previous php.general (#292244) next »