Php help

OK I am new to php and created the following code but it is not inserting the information to the database but gives no erros

<php
$city = $_POST[city];
$Name = $_POST[name];
$Mail = $_POST[mail];
$sys1 = $_POST[sys1];
$sys2 = $_POST[sys2];
$about = $_POST[about];

//MySQL Connection
mysql_connect(“localhost”, “root”, “”) or die(mysql_error());
mysql_select_db(“gamers”) or die(mysql_error());

// Insert a row of information into the table
mysql_query("INSERT INTO gamers
(city, name, mail, sys1, sys2, about) VALUES(’$city’, ‘$name’, ‘$mail’, ‘$sys1’, ‘$sys2’, '$about ) ")
or die (mysql_error());

?>

please help me

Is there any error message being printed to the apache error_log?

No the error log is clean

try this

<php

define("DB_SERVER", "localhost");
define("DB_USER", "Username");    // replace with your usermane
define("DB_PASS", "Password");     // replace password with your password
define("DB_NAME", "gamers");      // make sure this is the database name not the table name

$city = $_POST[city];
$Name = $_POST[name];
$Mail = $_POST[mail];
$sys1 = $_POST[sys1];
$sys2 = $_POST[sys2];
$about = $_POST[about];

// Connect to Database
$this->connection = mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error());
      mysql_select_db(DB_NAME, $this->connection) or die(mysql_error());

$q = "INSERT INTO gamers (city, name, mail, sys1, sys2, about) VALUES ('$city', '$name', '$mail', '$sys1', '$sys2', '$about')";  
      mysql_query($q, $this->connection);



?>

give or take it should work tho

Please avoid double posting.

This question was answered at viewtopic.php?f=13&t=8675

If you need to “Bump” the original post then edit or add a new comment in that thread as opposed to creating a new one.

Thanks.

Sponsor our Newsletter | Privacy Policy | Terms of Service