mysql insert thingy wont work
PHP Code:
$link = mysql_connect("localhost", "fragblast", "mypass");
mysql_select_db("fragblast");
$sql = "insert into articles(name,email,gamename,system,link,ss1,ss2,ss3) values ('$name','$email','$gamename','$system','$path','$ss1','$ss2', '$ss3')";
$result = mysql_query($sql);
// Closing connection
mysql_close($link);
it doesnt give any errors, but when i check the table, theres nothing in there.
any ideas? im fairly new to mysql
thanks :)
Re: mysql insert thingy wont work
Quote:
Originally Posted by nabeels786
PHP Code:
$link = mysql_connect("localhost", "fragblast", "mypass");
mysql_select_db("fragblast");
$sql = "insert into articles(name,email,gamename,system,link,ss1,ss2,ss3) values ('$name','$email','$gamename','$system','$path','$ss1','$ss2', '$ss3')";
$result = mysql_query($sql);
// Closing connection
mysql_close($link);
it doesnt give any errors, but when i check the table, theres nothing in there.
any ideas? im fairly new to mysql
thanks :)
try this
PHP Code:
<?php
$server = "location_of_server_here";
$db_user = "database_username";
$db_pass = "database_password";
$database = "database_name";
$tablename = "database_table_name";
////NOTES
////
////IF YOUR FIRST INPUT FIELD NAME IS CALLED INPUTONE THEN
////$FORM_INPUT_FIELD_NAME_ONE WOULD BE SPECIFIED AS:
////$INPUTONE
$connection = mysql_connect("$server", "$db_user", "$db_pass");
$db = mysql_select_db("$database", $connection);
$query = "INSERT INTO $tablename (`DATABASE_COLUMN_NAME_ONE`,`DATABASE_COLUMN_NAME_TWO`) VALUES ('$FORM_INPUT_FIELD_NAME_ONE','$FORM_INPUT_FIELD_NAME_TWO')";
$result = mysql_query($query, $connection);
////PRINT A MESSAGE TO THE SCREEN TO SAY ADDITION SUCCESSFUL
echo "Yeah baby yeah! Addition Successful!";
?>