WA
11-22-2002, 08:44 AM
I have a question regarding the INSERT command, specifically, inserting sets of data. As an example:
$sql="insert into thebooks set
Bookname='$temp[0]',
Bookimage='$temp[1]',
Bookurl='$temp[2]'";
I noticed that the variable $temp contains only the data it was set to when the page first loaded, and in a for loop querying the above multiple times, even if I change $temp, the data that gets inserted remains that of the original $temp content.
My question are:
1) Is there a way to make the above query dynamic in the sense that variable $temp will be dynamically evalulated?
2) Also, what's the syntax to assigning a 2 dimensional array in place of $temp above? For example:
Bookname='$temp[0]["test"]',
The above doesn't work.
Thanks,
$sql="insert into thebooks set
Bookname='$temp[0]',
Bookimage='$temp[1]',
Bookurl='$temp[2]'";
I noticed that the variable $temp contains only the data it was set to when the page first loaded, and in a for loop querying the above multiple times, even if I change $temp, the data that gets inserted remains that of the original $temp content.
My question are:
1) Is there a way to make the above query dynamic in the sense that variable $temp will be dynamically evalulated?
2) Also, what's the syntax to assigning a 2 dimensional array in place of $temp above? For example:
Bookname='$temp[0]["test"]',
The above doesn't work.
Thanks,