newbreed65 Posted November 1, 2008 Share Posted November 1, 2008 i know this is a very simply error were im just missing or got to many " or ' some were but im tried adding and removin ones and had no luck heres a lil bit of were im getting a error in my code case "movietype": $sql = "UPDATE movietype SET movietype_name = '" . $_POST['movie_name'] . "', WHERE movietype_id = '" . $_GET['id'] . "'"; break; and this is the error im getting... Invalid query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE movietype_id = '4'' at line 3 Link to comment https://forums.phpfreaks.com/topic/130995-doesnt-it-do-you-head-in-when-u-cant-see-such-a-minor-error/ Share on other sites More sharing options...
laffin Posted November 1, 2008 Share Posted November 1, 2008 movietype_name = '" . $_POST['movie_name'] . "', did u try removing that comma at the end? Link to comment https://forums.phpfreaks.com/topic/130995-doesnt-it-do-you-head-in-when-u-cant-see-such-a-minor-error/#findComment-680051 Share on other sites More sharing options...
Mchl Posted November 1, 2008 Share Posted November 1, 2008 $sql = "UPDATE movietype SET movietype_name = '{$_POST['movie_name']}' WHERE movietype_id = '{$_GET['id']}'"; Also note, that you're opening yourself for sql injection this way. Safer way $movieName = mysql_real_escape_string($_POST['movie_name']); $id = (int)$_GET['id']; //I'm assuming that id is numeric here $sql = "UPDATE movietype SET movietype_name = 'movieName' WHERE movietype_id = '$id'"; Link to comment https://forums.phpfreaks.com/topic/130995-doesnt-it-do-you-head-in-when-u-cant-see-such-a-minor-error/#findComment-680059 Share on other sites More sharing options...
newbreed65 Posted November 1, 2008 Author Share Posted November 1, 2008 thank Mchl it updating now just got to make a few changes so it inserting the right data Link to comment https://forums.phpfreaks.com/topic/130995-doesnt-it-do-you-head-in-when-u-cant-see-such-a-minor-error/#findComment-680064 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.