Re: [PHP] INSERT INTO using foreach

2004-07-25 Thread Marek Kilimajer
Alex Hogan wrote: Hi All, I have a form with several values to insert. I thought that I remember a thread that discussed using a loop to insert $_POSTed values. I am trying; foreach($_POST as $key => $value){ if($key == 'Submit'){ exit; i think you want break; or continue; here, exit; ends

Re: [PHP] INSERT INTO using foreach

2004-07-23 Thread Jason Davidson
It may be a matter of opinion, but i beleive this is a poor method of doing what your doing. I would get my values thru $_REQUEST and use addslashes to escape what needs to be escaped, and i would write my SQL query with full column listing and string values in quotes. eg.. INSERT INTO table (col

Re: [PHP] INSERT INTO using foreach

2004-07-23 Thread Matt M.
> foreach($_POST as $key => $value){ > if($key == 'Submit'){ > exit; > } > else{ > $sql = "INSERT INTO registration ('$key') > VALUES ('$value')"; > $result = mssql_query($sql); > } > } not sure if wrapping columns names in single quotes is valid mssql, try: $sql = "INSERT INTO

[PHP] INSERT INTO using foreach

2004-07-23 Thread Alex Hogan
Hi All, I have a form with several values to insert. I thought that I remember a thread that discussed using a loop to insert $_POSTed values. I am trying; foreach($_POST as $key => $value){ if($key == 'Submit'){ exit; } else{ $sql = "INSERT INTO registration ('$key') VALUES ('$va

Re: [PHP] INSERT into mysql from dynamic drop down

2004-01-07 Thread Nitin Mehta
- Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, January 07, 2004 12:07 PM Subject: [PHP] INSERT into mysql from dynamic drop down > > Hi all, > >Right now i would like to INSERT the v

[PHP] INSERT into mysql from dynamic drop down

2004-01-06 Thread irinchiang
Hi all, Right now i would like to INSERT the values from a dynamic drop down menu into mysql database but encountered some problem here. Values in the drop down menu are retrieved from DB as follows: " .$row["tutor_name"]. ""; } $result = $db->query($sql); ?> -

Re: [PHP] Insert into array...

2003-12-26 Thread Marek Kilimajer
Please don't start a new thread by hijacking an existing thread. Always start with "new massage". Simple answer for your question is: foreach($orders as $order_key => $dummy) { $orders[$order_key]['Newitem'] = "something"; } Andras Kende wrote: Hello All, I would like to put 1 new field

[PHP] Insert into array...

2003-12-26 Thread Andras Kende
Hello All, I would like to put 1 new field into this multidimensional array... $orders = 1 => Array (11) Name => JUDY Order => 334455 2 => Array (11) Name => MARY Order => 12590 TO: $orders = 1 => Array (11) Name => JUDY Order => 334455 Newitem => someting 2 => Array (11) Nam

Re: [PHP] [php] INSERT INTO

2002-12-17 Thread Marek Kilimajer
For 40 variables I would recomend keeping them in a single array and then loop the array: $vars['part1']='something'; $vars['part2']='something else'; foreach($vars as k => $v) { $vars[$k]=addslashes($v); } John Taylor-Johnston wrote: Yes I'm reading the FM :) http://www.php.net/manual/en/

Re: [PHP] [php] INSERT INTO

2002-12-17 Thread Jason Wong
On Tuesday 17 December 2002 15:12, John Taylor-Johnston wrote: > I'm particularily concerned aboute single quotes. How do I escape them? > Should I? > > Here is what I think is right. > > --snip-- > $myconnection = mysql_connect($server,$user,$pass); > mysql_select_db($db,$myconnec

[PHP] [php] INSERT INTO

2002-12-16 Thread John Taylor-Johnston
Yes I'm reading the FM :) http://www.php.net/manual/en/ref.mysql.php I should know this. How will I PHP this SQL into my MySQL table? INSERT INTO testals VALUES ($part1, $part2, $part3, $part4); I'm particularily concerned aboute single quotes. How do I escape them? Should I? Here is what I thi

[PHP] insert into problems.

2001-09-03 Thread Martin
Can someone tell me whats wrong with this... im getting a " Syntax error in INSERT INTO statement "... but i cant find anything wrong with the sql code., or have i missed something..? /martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: [PHP] insert into

2001-04-24 Thread Sterling
H- You are right. My bust. Sorry for the errant info. Although I still highly recommend the site. 8^) -Sterling Philip Olson wrote: > > Sterling, it appears Shawn is using MySQL, not PostgreSQL. That said, > Shawn, have a look here : > > http://www.php.net/manual/en/ref.mysql.php > >

Re: [PHP] insert into

2001-04-24 Thread Philip Olson
Sterling, it appears Shawn is using MySQL, not PostgreSQL. That said, Shawn, have a look here : http://www.php.net/manual/en/ref.mysql.php You'll see a list of MySQL functions, which are in your snippet below. PHP functions such as : mysql_connect, mysql_select_db, mysql_query, mysql_fetc

Re: [PHP] insert into

2001-04-24 Thread Johannes Janson
""shawn"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 001c01c0cce3$c114c420$5c52a040@admin">news:001c01c0cce3$c114c420$5c52a040@admin... >Could someone tell me how to actually execute this script please? $mysql_query = mysql_query("INSERT INTO $userstable (client, contact, email, address, city, s

Re: [PHP] insert into

2001-04-24 Thread Sterling
H- Here ya go. http://www.php.net/manual/en/function.pg-connect.php This page and the links on the left hand column have everything you'll ever want to know about db connects and sql queries. 8^) -Sterling shawn wrote: > > Could someone tell me how to actually execute this script please? >

[PHP] insert into

2001-04-24 Thread shawn
Could someone tell me how to actually execute this script please? $hostname = ""; $username = ""; $password = ""; $dbName = ""; $userstable = "booking"; MYSQL_CONNECT($hostname, $username, $password) or die("Unable to connect to database"); @mysql_select_db( "$dbName") or die( "Unable to sele

Re: [PHP] insert into multiple tables

2001-04-04 Thread David Robley
On Thu, 5 Apr 2001 02:29, Toni Barskile wrote: > Can someone please help me w/the following code? I'm trying to insert > data collected on a form into two tables into my database. I > know the SQL statements work because I tested them individually, but I > keep getting the error "Couldn'

[PHP] insert into multiple tables

2001-04-04 Thread Toni Barskile
Can someone please help me w/the following code? I'm trying to insert data collected on a form into two tables into my database. I know the SQL statements work because I tested them individually, but I keep getting the error "Couldn't execute query 2". Does anyone have any s

Re: [PHP] INSERT into MSSQL Server

2001-02-13 Thread Michael McGlothlin
Have you tried addslashes () on the input lines before the insert? Conover, Ryan wrote: > I trying to insert some data into a MSSQL Server 7.0 database from Php. Some > of the data has various characters ', > . How can I tell SQL Server to > treat these characters as part of the input. > > Rya

RE: [PHP] INSERT into MSSQL Server

2001-02-13 Thread Peter Houchin
in mysql i'd treat them as a char or varchar i would assume it would be the same in MSSQL -Original Message- From: Conover, Ryan [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 14, 2001 9:32 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP] INSERT into MSSQL Serve

[PHP] INSERT into MSSQL Server

2001-02-13 Thread Conover, Ryan
I trying to insert some data into a MSSQL Server 7.0 database from Php. Some of the data has various characters ', > . How can I tell SQL Server to treat these characters as part of the input. Ryan Conover -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECT