LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Parse Error (https://www.linuxquestions.org/questions/programming-9/parse-error-315880/)

verbatim 04-21-2005 08:50 PM

Parse Error
 
unexpected t constant encapsed string on line 14 below. what is it please?



php language

Code:


<? php

$ID = uniqid("userID");

$db = mysql_connect("localhost","xxxxx","xxxxx");

mysql_select_db (secretDB);

$result = mysql_query ("INSERT INTO users (id, real_name, username, password, email)
                VALUES ('$ID', '$real_name', '$username', '$userpass',
'$email')              ");
if(!$result)
{
  echo '<b>User not added:</b>' , mysql_error();
  exit;
}
if($result)
    {
    mysql_close($db);
    print "User <b>$username</b> added sucessfully!";
    }
else
{
print ("Wrong Password");
}
?>

and what am i supposed to change the uniqueid to ?


line 14 :
Code:

  echo '<b>User not added:</b>' , mysql_error();
i tried it with double quotations too

Code:

  echo "<b>User not added:</b>" , mysql_error();

cyent 04-21-2005 09:10 PM

What language?

Just from a wild wild guess base on common languages I would say replace the , by +

verbatim 04-21-2005 09:15 PM

thanks for the reply. it is php language [ i edited the 1st post to reflect]

i attempted your solution, it didnt work.

thanks though

trevelluk 04-22-2005 09:16 AM

The string concatenation character in PHP is the dot.

So try: echo '<b>User not added:</b>'.mysql_error();

Hmm, thinking about it, that might not work. Try a two liner:

$errmsg=mysql_error();
echo "<b>User not added:</b>$errmsg"


All times are GMT -5. The time now is 03:43 AM.