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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
boo_lolly
Forum Contributor
Posts: 154
Joined: Tue Nov 14, 2006 5:04 pm

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

Post 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!!!
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

Post the FULL file.
User avatar
boo_lolly
Forum Contributor
Posts: 154
Joined: Tue Nov 14, 2006 5:04 pm

Post 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;
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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;
User avatar
boo_lolly
Forum Contributor
Posts: 154
Joined: Tue Nov 14, 2006 5:04 pm

Post by boo_lolly »

yeah i figured that one out =) thanks tho.
Post Reply