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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.