One more newbie question. About foreach..

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux