I really need help with this code... Ready to shoot myself!

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Jacques
New php-forum User
New php-forum User
Posts: 10
Joined: Fri Oct 18, 2002 8:07 am

I really need help with this code... Ready to shoot myself!

Postby Jacques » Thu Nov 21, 2002 11:32 am

I am trying to do a multiple insert.

$sdcount=10;
for ($i=0;$i<$stdcount;$i++){
$query = "Insert into $mysql_cat (id, user, category) values ('', '$user','$category[$i]')";
$result = mysql_query($query) or die("ERROR: cannot INSERT data into database");
}
// for ($i = 0; $i < $stdcount; $i ++)
?>
<form method=post>
<input type="text" name="category[]">
<input type="text" name="category[]">
<input type=hidden name=sdcount value=$sdcount>
<input type="submit" value="Upload/Submit">
</form>

Jacques
New php-forum User
New php-forum User
Posts: 10
Joined: Fri Oct 18, 2002 8:07 am

Postby Jacques » Thu Nov 21, 2002 12:59 pm

Never mind. I found a solution.


Return to “PHP coding => General”

Who is online

Users browsing this forum: Google [Bot] and 4 guests