Re: mysql query/$post problem

From: Date: Mon, 27 Mar 2006 08:31:36 +0000
Subject: Re: mysql query/$post problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-232598@lists.php.net to get a copy of this message
On 3/27/06, Mark <neretlis@westnet.com.au> wrote: > I havnt even tried this query but i know its wrong can anyone help! > > > *************************************** > <?php > include("header.php"); > include("connect.php"); > > $comp_id = $_SESSION['comp_id']; > $user_id = $_SESSION['user_id']; > > // Grab variables and insert into database > > $avname = $_POST['avname']; > > > $query = "INSERT INTO users AVATARS WHERE id =$user_id > '','$avname')"; The format for insert queries is: insert into table(field1, field2) values ('value1', 'value2') .... or insert into table set field1=value2, field2=value2 etc. What exactly is the tablename? Also you don't need the ) on the end: $query = "INSERT INTO tablename SET id =$user_id '','$avname'"; -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.general (#232598) next »