Vivid Lust Posted September 1, 2008 Share Posted September 1, 2008 Hi, I'm new to MySQL and was just wondering what im doing wrong with this query: <?php $unkn = "unknown"; $zero = "0"; $user = mysql_query(" INSERT INTO `users` ( `email`, `pass`, `name`, `gender`, `location`, `about`, `s_phish`, `u_phish`, `p_phish`, `p_s`, ) VALUES ( \"$email\", \"$pass\", \"$name\", \"$unkn\", \"$unkn\", \"$unkn\", \"$zero\", \"$zero\", \"$zero\", \"$zero\" ) ") or die("could not execute insert query"); ?> [code] It keeps on dying The previous variation worked: [code] $user = mysql_query(" INSERT INTO `users` ( `email` , `pass` , `name` ) VALUES ( \"$email\", \"$pass\", \"$name\" ) "); But not this one... any help really appreciated [/code][/code] Link to comment https://forums.phpfreaks.com/topic/122262-solved-whats-wrong-with-this-mysql/ Share on other sites More sharing options...
fenway Posted September 1, 2008 Share Posted September 1, 2008 Until you echo that query in plaintext, we can't possibly know. Link to comment https://forums.phpfreaks.com/topic/122262-solved-whats-wrong-with-this-mysql/#findComment-631330 Share on other sites More sharing options...
Vivid Lust Posted September 1, 2008 Author Share Posted September 1, 2008 I get: INSERT INTO `users` ( `email`, `pass`, `name`, `gender`, `location`, `about`, `s_phish`, `u_phish`, `p_phish`, `p_s`, ) VALUES ( "", "", "", "unknown", "unknown", "unknown", "0", "0", "0", "0" ) Spaces are where variables are which do work, so i suspose they dont really matter at the moment. Link to comment https://forums.phpfreaks.com/topic/122262-solved-whats-wrong-with-this-mysql/#findComment-631343 Share on other sites More sharing options...
toplay Posted September 1, 2008 Share Posted September 1, 2008 Remove the comma after p_s column. Change this: `p_s`, ) to this: `p_s`) Link to comment https://forums.phpfreaks.com/topic/122262-solved-whats-wrong-with-this-mysql/#findComment-631345 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.