ktalebian Posted August 22, 2007 Share Posted August 22, 2007 Hi For some reason, this script does nto work: // Connection to db made, all variables are gathered mysql_select_db("website"); mysql_query ("INSERT INTO match (name, type, date_start, date_end, board, article, link) VALUES ('$name','$type','$start','$end','$board_final','$article_final','$link_final')") or die('Cannot continue); I keep getting the error (the die() error). I first thought maybe the names are wrong, so I only used one inserting, just inserting a value into "name", but still nothing happens! Why? Thank you Quote Link to comment https://forums.phpfreaks.com/topic/66094-solved-mysql-insert-into/ Share on other sites More sharing options...
nathanmaxsonadil Posted August 22, 2007 Share Posted August 22, 2007 change mysql_query ("INSERT INTO match (name, type, date_start, date_end, board, article, link) VALUES ('$name','$type','$start','$end','$board_final','$article_final','$link_final')") or die('Cannot continue); to mysql_query ("INSERT INTO match (name, type, date_start, date_end, board, article, link) VALUES ('{$name}','{$type}','{$start}','{$end}','{$board_final}','{$article_final}','{$link_final}')") or die('Cannot continue); Quote Link to comment https://forums.phpfreaks.com/topic/66094-solved-mysql-insert-into/#findComment-330541 Share on other sites More sharing options...
keeB Posted August 22, 2007 Share Posted August 22, 2007 Actually, that wont do a thing ^^ Change it to this: <?php mysql_select_db("website"); mysql_query ("INSERT INTO match (name, type, date_start, date_end, board, article, link) VALUES ('$name','$type','$start','$end','$board_final','$article_final','$link_final')") or die('Cannot continue because: ' . mysql_error() ); ?> Quote Link to comment https://forums.phpfreaks.com/topic/66094-solved-mysql-insert-into/#findComment-330550 Share on other sites More sharing options...
ktalebian Posted August 22, 2007 Author Share Posted August 22, 2007 Hi Thank you for the reply. None of the following worked! I started playing with the code of PHPBB3, and that type of coding works! Any guesses why? Plus, I still do not understand that type of coding! Help! Quote Link to comment https://forums.phpfreaks.com/topic/66094-solved-mysql-insert-into/#findComment-330742 Share on other sites More sharing options...
keeB Posted August 22, 2007 Share Posted August 22, 2007 If you implemented my script, it should have said the following: Cannot continue because: <some error here> Give us the error Quote Link to comment https://forums.phpfreaks.com/topic/66094-solved-mysql-insert-into/#findComment-331010 Share on other sites More sharing options...
Barand Posted August 22, 2007 Share Posted August 22, 2007 I think you'll find that it's because "match" is a reserved SQL word use `match` or rename the table Quote Link to comment https://forums.phpfreaks.com/topic/66094-solved-mysql-insert-into/#findComment-331168 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.