If the code in the tutorials worked, I would not be here. Please just help me to square one. And I will go do my peon thing. Hostgator MySql db, Access Host IP's are listed w/%, Appears to log on but will not Insert data. <? $user="emilfk_emilfk"; $password="helpme"; $database="emilfk_PRP"; mysql_connect(localhost,$user,$password); @mysql_select_db($database) or die( "Unable to select database"); print "Connected to MySQL<br>";/*this msg does echo back, logged on Right?*/ $query = "INSERT INTO fields VALUES ('','aaa','bbb','ccc','ddd','eee','fff','ggg')"; mysql_query($query); $sql = "INSERT INTO `emilfk_PRP`.`Fields` (`id`, `first`, `last`, `phone`, `mobil`, `fax`, `email`, `web`) VALUES (NULL, \'aa\', \'bb\', \'cc\', \'dd\', \'ee\', \'ff\', \'gg\');"; mysql_query($sql); mysql_query("INSERT INTO `emilfk_PRP`.`Fields` (`id`, `first`, `last`, `phone`, `mobil`, `fax`, `email`, `web`) VALUES (NULL, \'a\', \'b\', \'c\', \'d\', \'e\', \'f\', \'g\');"); /* none of the above will write to db or give me an error, somebody please get me to square one*/ mysql_close(); ?> PHP: Thanks in advance Emil
add to the end of the query or die(mysql_error()); so mysql_query('..'); becomes mysql_query('..') or die(mysql_error()); try to do something yourselve, its easy to find out your errors!
I think the error is caused by the escaping of the single quotes. Because they are in double quotes, they don't need be be escaped.
just a suggestion dont use this `emilfk_PRP`.`Fields` in case you decide to change DB your code will break