Mysql statement works in phpmyadmin but not in php page

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

 



I'm at my wits end trying to make this mysql statement insert work in
PHP. I'm not getting any errors from PHP or mysql but the insert fails
(nothing is inserted) error reporting is on and is reporting other
errors. When I echo out the query and manually paste it into PHP
myAdmin the query inserts without a problem. I know that I am
connecting to the database as well part of the data being inserted
comes from the same database and that the mysql user has permission to
do inserts (even tried as root no luck).

$query="INSERT INTO upload_history (v_id,hour,visits,date) VALUES
(".$v_id.",".$hour.",".$visits.",'$date1'".");";

$r2=mysql_query($query) or die("<b>A fatal MySQL error
occured</b>.\n<br />Query: " . $query . "<br />\nError: (" .
mysql_errno() . ") " . mysql_error());

This is an echo of $query and runs in phpmyadmin.

INSERT INTO history (v_id,hour,visits,date) VALUES (45,0,59,'2010 01 27');


Any idea what is going on here?

-- 
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