[PHP-DB] is the following query legal?

2002-08-26 Thread Adam Williams

I have an informix database with a table called phptesttable.  It has a
SERIAL field (for mysql users that can help, its the same as INT NOT NULL
PRIMARY KEY AUTO_INCREMENT) and a CHAR field (CHAR in Informix is the
same as VARCHAR in mysql).

In my PHP script if I submit an array and then insert all the data by
looping through with for loop to INSERT all the data from the array my the
value it inserts is empty.  For example I have:

INSERT INTO phptesttable (textname) VALUES ('$statement[$counter]')

but when I echo $querya it shows:

INSERT INTO phptesttable (textname) VALUES ('')

It should show the value of the $statement[$counter] that I am looping
through.  But as above you can see the value is empty, but when I echo
$statement[$counter] and $counter, they are shown correctly:

the counter is set to 1
the statement is testing this field

So it should echo INSERT INTO phptesttable (textname) VALUES ('testing
this field' but obviously it is not.

When I change the query to not use an array and only insert one variable:

INSERT INTO phptesttable (textname) VALUES ('$statement')

it echos and inserts correctly.  So my question is, is it legal to loop
through an array and insert the array $statement[$counter]?  I am at a
loss as to what is happening, because if I change the form to submit one
variable instead of an array, it works fine.  Any idea as to what is
happening?

Adam




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] is the following query legal?

2002-08-26 Thread Adam Williams

I got it to work.  I have to put the statement in ifx_prepare right before
I call it in the loop.  I think its because when I define the statement at
the start of the code, $statement[$counter] has not been asigned yet so it
sets its value to nothing.

Adam


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php