$sql5 = "SELECT * FROM $table_name WHERE passcode = ''";
$result = mysql_query($sql5, $connection) or die("couldn't connect.");$j = 1;
function random_string($length) {$key = '';$keys = array_merge(range(1, 9), range('A', 'Z'));for ($i = 0; $i < $length; $i++) {$key .= $keys[array_rand($keys)];}return $key;}while ($row = mysql_fetch_array($result)) {$_POST["matric_id"] = $row['matric'];$passcode = random_string(8);
$sql1 = "UPDATE $table_name SET passcode = '$passcode' WHERE matric = '".$_POST["matric_id"]."'";$result = mysql_query($sql1, $connection) or die(mysql_error());}$j++;Try this and let me know.Thanks & Regard,
Jigar Savla | Software Engineer
M - 997 080 0919 | E - savla...@gmail.com
Twitter - @savlajigar | Facebook - @savlajigSave Paper, Save Trees, Save the Planet.
Please do not print until & unless it is very necessary.
--
This group is managed by the web application development team at www.360psg.com
---
You received this message because you are subscribed to the Google Groups "Professional PHP Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to professional-p...@googlegroups.com.
Visit this group at https://groups.google.com/group/professional-php.
To view this discussion on the web visit https://groups.google.com/d/msgid/professional-php/CAERp-YOTLbWPqWZir1OfUSqiHLjBen5dTjz3VbSNeuGbaaXPdA%40mail.gmail.com.
The last $result var needs to be changed, you are overriding the original $result var
To view this discussion on the web visit https://groups.google.com/d/msgid/professional-php/CAJOK3gWTwHcKHB-vgO8%2BW1nwLhXFq7L7gf5QQhVrEf_Jum1_-Q%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/professional-php/CAOj8Mue3hN3hbEiDyqHPu640RATRihKEk52ukzKmCfwZOGj2og%40mail.gmail.com.