Jump to content

[SOLVED] MySQL INSERT INTO


ktalebian

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/66094-solved-mysql-insert-into/
Share on other sites

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);

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() );
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.