Re: please shed some light on SQLsyntax error

From: Date: Mon, 14 Nov 2005 00:10:26 +0000
Subject: Re: please shed some light on SQLsyntax error
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-225714@lists.php.net to get a copy of this message
>You would need to show us the SQL that was causing that error. Otherwise >it is fairly meaningless. hope this helps... <? //check for required form variables if ((!$_POST[f_name]) || (!$_POST[l_name])) { header("Location:http://www.inspired-evolution.com/show_addcontact.php"); exit; }else { //if form variables are present,start a session session_start(); } //check for validity of user if ($_SESSION[valid] != "yes") { header("Location:http://www.inspired-evolution.com/contact_menu.php"); exit; } //set up table and database names $db_name ="bruceg_contactlist"; $table_name ="Contact List"; //connect to server and select database $connection = @mysql_connect("69.90.6.198","database_username","password") or die(mysql_error()); $db = @mysql_select_db($db_name,$connection) or die(mysql_error()); //build and issue query $sql = "INSERT INTO $table_name values ('', '$_POST[f_name]', '$_POST[l_name]', '$_POST[address1]', '$_POST[address2]', '$_POST[address3]', '$_POST[postcode]', '$_POST[country]', '$_POST[prim_tel]', '$_POST[sec_tel]', '$_POST[email]', '$_POST[birthday]')"; $result = @mysql_query($sql,$connection)or die(mysql_error()); ?> On 11/13/05, Jasper Bryant-Greene <jasper@album.co.nz> wrote: > Bruce Gilbert wrote: > > I am trying to set up a contact list database using guidance from a > > PHP/MySQL book I recenty purchased, and not aving done this before I > > am not sure what the following error means or where I shoudl look for > > this kind of error. I have a table set up in MySQL using PHPMyadmin, > > and I am thinking it may be something in my table? Please let me know > > if anyone lese is familiar of this type of error below: > > > > "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 'List values ('', 'firstname', 'lastname', > > 'address', ' > > You would need to show us the SQL that was causing that error. Otherwise > it is fairly meaningless. > > Jasper > -- ::Bruce::

« previous php.general (#225714) next »