One more newbie question. About foreach..

[email protected] (Karl-Arne Gjersøyen)
Newsgroups php.general
Message-ID <CAN78Z6BHCgq+eez2nUVf7=BbgPvpV1Y8Hrazn2YkY-zd9U1G4Q@mail.gmail.com>
Hello again. I Got the solution for my last mention problem. Now I can
update several rows at once by one single submit action.

In my form I have many records and therefor I use an checkbox to just mark
those records I like to update. This work just fine in PHP/HTML5 form and I
got it as I want.

But the problem now is, how to recognize just those selected records by
serialnumber?

include('../../connect.php');

// Foreach get all given serialnumbers as I want it
    foreach($serialnumber as $snr){

// I got the number of serialnumbers given in the array
   $count = count($serialnumber);

// I thought that a for loop would do the trick together with foreach
// And repeat the $sql = SELECT below but that did not happen.
    for($i = 0; $i <= $count; $i++){


// Connect and get only those records with given serialnumber
$sql = "SELECT * FROM explosive WHERE serialnumber = '$snr'";
    } // End of for loop
    } // End of foreach loop
$result = mysql_query($sql, $connect) or die(mysql_error());
$count = mysql_num_rows($result);

I have tried to search in google and on PHP.net but can't fine anything
that explain my problem.
I like to have new $sql = SELECT queries for every given serialnumber ($snr)

Thanks for your help.

Karl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.