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
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
> 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
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
- 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
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);
?>
-
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
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
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/
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
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
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
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
>
>
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
""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
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?
>
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
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'
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
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
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
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
22 matches
Mail list logo