Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Was Empty?

Status
Not open for further replies.

TonyRosen

Programmer
Jul 28, 2003
108
US
whenever I use:

------------------------------

$query = mysql_query("INSERT INTO my_register (`credit`, `date_stamp`, `number`, `payee`, `amount`, `description`, `signatory`, `balance`) VALUES ('$credit', '$date', '$number', '$payee', '$amount', '$description', '$signatory', '$new_balance')");

------------------------------

I get "Query Was Empty" ... what causes that?
 
try this:
echo "INSERT INTO my_register (`credit`, `date_stamp`, `number`, `payee`, `amount`, `description`, `signatory`, `balance`) VALUES ('$credit', '$date', '$number', '$payee', '$amount', '$description', '$signatory', '$new_balance')";

check what it outputs..

I'm too tired to read all quotes now :p

Olav Alexander Mjelde
Admin & Webmaster
 
Have you inspected the mysql_error() after the query fails? You could add the 'or die()' clause to catch what the server has to say:
Code:
$query = mysql_query("INSERT INTO my_register (`credit`, `date_stamp`, `number`, `payee`, `amount`, `description`, `signatory`, `balance`) VALUES ('$credit', '$date', '$number', '$payee', '$amount', '$description', '$signatory', '$new_balance')") OR die("Query failed: ".mysql_error());
 
Also, are all the fields text fields? A numeric field should not require quotes (') around the values, in your VALUES statement.
 
Just an FYI ...

I've gone about this a whole different way now ... I still don't know why I was receiving this ... everything looked good.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top