pugboy Posted June 27, 2008 Share Posted June 27, 2008 I currently have 1 table in one database. (Table named md5s) For some reason, this code gives me the error "Unknown column 'wordientered' in 'field list'" mysql_connect("localhost", "md5er_admin", "*password was here*") or die(mysql_error()); mysql_select_db("md5er_db") or die(mysql_error()); $wordes = mysql_real_escape_string($word); // Insert a row of information into the table "example" mysql_query("INSERT INTO md5s (word, md5) VALUES($wordes, $md5 ) ") or die(mysql_error()); echo "Data Inserted!"; $word contains a string $md5 contains a 32 character md5 Am I doing something wrong? Should I be entering the data differently? Link to comment https://forums.phpfreaks.com/topic/112240-solved-php-and-inserting-data-into-mysql/ Share on other sites More sharing options...
discomatt Posted June 27, 2008 Share Posted June 27, 2008 Always quote strings in MySQL. mysql_connect("localhost", "md5er_admin", "*password was here*") or die(mysql_error()); mysql_select_db("md5er_db") or die(mysql_error()); $wordes = mysql_real_escape_string($word); // Insert a row of information into the table "example" mysql_query(" INSERT INTO `md5s` (`word`, `md5`) VALUES ('$wordes', '$md5' ) ") or die(mysql_error()); echo "Data Inserted!"; Link to comment https://forums.phpfreaks.com/topic/112240-solved-php-and-inserting-data-into-mysql/#findComment-576272 Share on other sites More sharing options...
pugboy Posted June 27, 2008 Author Share Posted June 27, 2008 Thanks Link to comment https://forums.phpfreaks.com/topic/112240-solved-php-and-inserting-data-into-mysql/#findComment-576275 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.