Page 1 of 1

not seeing where the error is coming from. some help needed

Posted: Tue Nov 21, 2006 10:26 am
by boo_lolly
i get this error:
Parse error: parse error, expecting `';'' in /../../../../addCouple.php on line 156

Code: Select all

@ $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!!!

Posted: Tue Nov 21, 2006 10:29 am
by d3ad1ysp0rk
Post the FULL file.

Posted: Tue Nov 21, 2006 10:38 am
by boo_lolly

Code: Select all

//rand_gen.inc
$totalChar = 30; // number of chars in the password
$salt = "abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ1234567890";  // salt to select chars from
srand((double)microtime()*1000000); // start the random generator
$password=""; // set the inital variable
for ($i=0;$i<$totalChar;$i++)  // loop and create password
            $password = $password . substr ($salt, rand() % strlen($salt), 1);
$uID = $password;

Posted: Tue Nov 21, 2006 11:01 am
by volka
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";
}
There is no do{}while{} construct in php. It's either while(){} or do{}while;

Posted: Tue Nov 21, 2006 11:09 am
by boo_lolly
yeah i figured that one out =) thanks tho.