Jump to content

wheelbarrow

Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

wheelbarrow's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Im still getting the SQL syntax error though its somewhere on this line $query = "INSERT INTO $usertable (item,table) VALUES (\'$item\',\'$table\')";
  2. I got these two errors Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /usr/local/4admin/apache/vhosts/force-g.net/httpdocs/spheres/signup.php on line 27 1064: You have an error in your SQL syntax near \'table) VALUES(\'sgd\',\'sdgsd\')\' at line 1
  3. I just got a web server with PHP and MySQL and for some reason when I try to send data through a form to db it gives me no error messages but nothing happens in the database. Heres the script <? # Sample Database Connection Syntax for PHP and MySQL. # Connect To Database $hostname="localhost"; $username="user"; $password="pass"; $dbname="user"; $usertable="test"; $item=$HTTP_POST_VARS[item]; $name=$HTTP_POST_VARS[name]; MYSQL_CONNECT($hostname,$username, $password) OR DIE ("<html><script language=\'JavaScript\'>alert(\'Unable to connect to database! Please try again later.\'),history.go(-1)</script></html>"); @mysql_select_db($dbname) or DIE ("<html><script language=\'JavaScript\'>alert(\'Unable to use database! Please try again later.\'),history.go(-1)</script></html>"); # Check If Record Exists $query = "SELECT * FROM $usertable WHERE item = \'$item\'"; $result = MYSQL_QUERY($query); $number = MYSQL_NUMROWS($result); # Insert Record into Table $query = "INSERT INTO $usertable (item,name) VALUES(\'$item\',\'$name\')"; $result = MYSQL_QUERY($query); ?> That is the sample script they gave me so I cant see what the problem is
×
×
  • 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.