i get this error:
Parse error: parse error, expecting `';'' in /../../../../addCouple.php on line 156

@ $db = mysql_connect("yah", "blah", "blah");
    mysql_select_db("registry_DB", $db);

    if(!$db)
    {
        echo "Error: Could not connect to the database. Please try again later.";
        exit;
    }

    $sql = "SELECT uID FROM my_search_table WHERE uID LIKE '%". $uID ."%'";
    $query = mysql_query($sql);

    do
    {
        include "rand_gen.inc";
        $sql_array = mysql_fetch_array($query);
    }
    while($uID === $sql_array['uID']) //if there WAS a match in the database
    {    //<--  LINE 156.... weird i know...
        include "rand_gen.inc";
    }

    $uID          = $_POST['uID'];
    $brideFname   = $_POST['brideFname'];
    $brideLname   = $_POST['brideLname'];
    $gooomFname   = $_POST['groomFname'];
    $groomLname   = $_POST['groomLname'];
    $event_day    = $_POST['event_day'];
    $event_month  = $_POST['event_month'];
    $event_year   = $_POST['event_year'];
    $ship_add     = $_POST['ship_add'];
    $ship_city    = $_POST['ship_city'];
    $ship_zip     = $_POST['ship_zip'];
    $ship_state   = $_POST['ship_state'];

    //insert row of data into 'my_search_table'
    //create table named the unique ID AND a few
    //preset columnfield names (registry info)

a little background... basically this is an administrative page, where the admin can enter information inside an HTML form, then when the admin clicks the 'Submit' button, it stores all the information into a SQL table, THEN creates another SQL table, and names it the unique ID (uID).

rand_gen.inc is exactly that. it's a random ID generator. as you may be able to tell from my code, after the unique ID is generated it checks the uID column in 'my_search_table' to see if it's already there. if it is, run the ID generator again and again until it doesn't match anything in that column. once it generates a completely unique ID, it inserts all the information entered by the admin into a row in 'my_search_table'. my question is, is it necessary to put 'uID' inside $sql_array... since i'm only selecting one column... is that right? or should i put $uID in there for some reason? am i doing this correctly? HELP ME!!! :eek:

Recommended Answers

All 2 Replies

The only potential problem I see is putting an "include" inside of a loop. That include could potentially be processed multiple times.

it's supposed to be processed as many times as it needs to be in order to generate an ID that hasn't already been created. it checks every time it is generated by connecting to the SQL table and seeing if there is one there.

the problem, however, was my do/while statement. i fixed it.

The only potential problem I see is putting an "include" inside of a loop. That include could potentially be processed multiple times.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.