Well, this is PHP & mySQL - Error, wrong syntax?
Posted: Sun Jan 25, 2009 7:58 pm
Well, at first I would like to say hello to everyone, I'm Kat and I'll be around.
Anyway,
I get the error about the syntax here:
Could not execute query : INSERT INTO (id, business_name, representative_name, business_address, city, state, zip_code, phone_number_daytime, phone_number_evening, email, username, password, confirm_password) VALUES ('', 'test', 'test', 'test', 'test', 'TT', '12345', '2485555555', '5552505555', '', 'testtest', 'testpassword', 'testpassword').You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(id, business_name, representative_name, business_address, city, state, zip_code' at line 1
Here is the code:
Yeah, I'm not quite sure what to make of that.
(please bear with me, I'm starting in PHP and mySQL right now, so pardon me if my questions are obvious.)
Thanks!
Anyway,
I get the error about the syntax here:
Could not execute query : INSERT INTO (id, business_name, representative_name, business_address, city, state, zip_code, phone_number_daytime, phone_number_evening, email, username, password, confirm_password) VALUES ('', 'test', 'test', 'test', 'test', 'TT', '12345', '2485555555', '5552505555', '', 'testtest', 'testpassword', 'testpassword').You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(id, business_name, representative_name, business_address, city, state, zip_code' at line 1
Here is the code:
Code: Select all
<a href="index.php">Back to List</a>
<?php
/// In order to use this script freely
/// you must leave the following copyright
/// information in this file:
/// Copyright 2006 http://www.turningturnip.co.uk
/// All rights reserved.
include("connect.php");
$business_name = $_POST['business_name'];
$representative_name = $_POST['representative_name'];
$business_address = $_POST['business_address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip_code = $_POST['zip_code'];
$phone_number_daytime = $_POST['phone_number_daytime'];
$phone_number_evening = $_POST['phone_number_evening'];
$email = $_POST['email'];
$username = $_POST['username'];
$password = $_POST['password'];
$confirm_password = $_POST['confirm_password'];
$query = "INSERT INTO (id, business_name, representative_name, business_address, city, state, zip_code, phone_number_daytime, phone_number_evening, email, username, password, confirm_password)
VALUES ('', '$business_name', '$representative_name', '$business_address', '$city', '$state', '$zip_code', '$phone_number_daytime', '$phone_number_evening', '$email', '$username', '$password', '$confirm_password')";
$results = mysql_query($query) or die
("Could not execute query : $query." . mysql_error());
if ($results)
{
echo "Details added.";
}
mysql_close();
?>Yeah, I'm not quite sure what to make of that.
(please bear with me, I'm starting in PHP and mySQL right now, so pardon me if my questions are obvious.)
Thanks!