This is driving me nuts. Code used to work but then I did something (probably stupid) and now can’t figure out why it wont work.
Trying to add a unique code (accesskey) to each row of a column. All I get is the first row and then it dies. Any help would be appreciated.
require_once ('./admin/connect.php');
$db = mysqli_connect($db_hostname,$db_username,$db_password,"xxxxx_members");
$result = mysqli_query($db,"SELECT id FROM memberlist WHERE (accesskey ='')");
while ($row = mysqli_fetch_array($result)) {
extract($row);
$length = 10;
$randomString = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length);
echo $row['lname']. " $id - $randomString<br>";
$query = "UPDATE memberlist SET accesskey = '$randomString' WHERE (id = '$id')";
$result = mysqli_query($db,$query);
unset($randomString);
}