LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 04-21-2005, 09:50 PM   #1
verbatim
Member
 
Registered: Apr 2005
Posts: 31

Rep: Reputation: 15
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();

Last edited by verbatim; 04-21-2005 at 10:12 PM.
 
Old 04-21-2005, 10:10 PM   #2
cyent
Member
 
Registered: Aug 2001
Location: ChristChurch New Zealand
Distribution: Ubuntu
Posts: 273

Rep: Reputation: 48
What language?

Just from a wild wild guess base on common languages I would say replace the , by +
 
Old 04-21-2005, 10:15 PM   #3
verbatim
Member
 
Registered: Apr 2005
Posts: 31

Original Poster
Rep: Reputation: 15
thanks for the reply. it is php language [ i edited the 1st post to reflect]

i attempted your solution, it didnt work.

thanks though
 
Old 04-22-2005, 10:16 AM   #4
trevelluk
Member
 
Registered: Nov 2003
Location: Bristol, UK
Distribution: Debian Lenny, Gentoo (at work)
Posts: 388

Rep: Reputation: 32
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"
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Parse Error, but why? Mistro116@yahoo.com Programming 2 11-13-2005 03:38 PM
in gcc compiler error: parse error before string constsnt cynthia_thomas Linux - Networking 1 10-20-2005 02:29 AM
parse error with bc fisayo Programming 7 08-04-2005 10:23 AM
parse error? ams Programming 5 03-02-2005 05:56 AM
What is parse error ? edhan Linux - Newbie 64 09-17-2003 07:49 AM


All times are GMT -5. The time now is 11:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration