So here is what I'm having problems with... I'll explain the table layout.

I have a table called "reg\_users"

inside this table i have "email" "uuid" "token" etc....

When the user creates an account, it posts a row to the reg\_users table containing email.
However the UUID remains blank, as I would like them to be able to update the UUID field.

Using the script below, I can replace the uuid and update it - but it only works if the uuid field isnt empty. 

```
      <?php
require_once 'includes/main.php';

$user = new User();

if(!$user->loggedIn()){
    redirect('index.php');
}

 mysql_connect("sqlhost", "myusername", "password") or die(mysql_error()); 
 mysql_select_db("gl1tchr") or die(mysql_error());
 $uuidold = "$user->uuid";
 // Collects data from "reg_users" table 
 $data = mysql_query("UPDATE `reg_users` SET `uuid` = replace(uuid, '$uuidold', '$newuuid')") 
 or die(mysql_error()); 
 ?>

```

So I need to know how to go into the table "reg\_users" and find what row their email is on - and update the field "uuid" on the specific row.

Either that or a script to generate a random number in the "uuid" field for that specific user so my search and replace script will work.

Thank you to anyone who can help me - I'm new to SQL.