Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
parse error, unexpected T_CONSTANT_ENCAPSED_STRING
Old 06-04-2005, 03:14 PM parse error, unexpected T_CONSTANT_ENCAPSED_STRING
Junior Talker

Posts: 4
Trades: 0
Hi everyone, im having prblems with one line of code that refuses to work and throws up errors everytime i touch it, any ideas why its throwing up a parse error, unexpected T_CONSTANT_ENCAPSED_STRING. If it helps im I have a form that pulls up data from the database, i want to update the data and it get written back in to the database in to its id row.
PHP Code:
 <?php
 
 
if ($submit) {
 
   
// process form
 
 
$db mysql_connect("localhost""----""------") or die("Could Not Connect To The Database. <br>" mysql_error());
 
 
mysql_select_db("-----",$db) or die("Could Not Select The Proper Database. <br>" mysql_error());
 
 
$name $_POST['id'];
 
$name $_POST['name'];
 
$emailadress $_POST['emailaddress'];
 
$approval $_POST['approval'];
 
 >>>>> 
ERROR LINE<<<<< $sql*=*'UPDATE*klmreal*SET*name*= '$name',*emailaddress*= '$emailaddress',*approval*= '0'*WHERE*id*= '$_POST[id]'';
 
   
$result mysql_query($sql);
 
 if(
$result)
 
 {
 
 echo 
"Data Properly Inserted";
 
$url="formmail.php";
 
 }
 
 else
 
 {
 
 echo 
"An Error occured while trying to process your information.";
 
     print (
"<br>" mysql_error());
 
 }
   
   echo 
$sql ;
 
   echo 
"Thank you! Information entered.\n";
 
 }
 
 else 
 
 {
 
   
// display form
 
   
?>
Any help would be great

Thanks
Lee

Last edited by 0beron; 06-04-2005 at 03:50 PM.. Reason: [php ] tags added
ld0121 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-04-2005, 03:53 PM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
Err? what are those *s doing in there?

try this:

PHP Code:
$sql "UPDATE klmreal SET name='$name', emailaddress='$emailaddress', approval=0 WHERE id='".$_POST['id']."'"
Remember that variables are only expanded in strings with " around them and not ' .
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 06-04-2005, 04:16 PM
Junior Talker

Posts: 4
Trades: 0
I couldnt see the *s on my code.... strange..... but your code works

You are a php god


Thanks
Lee
ld0121 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to parse error, unexpected T_CONSTANT_ENCAPSED_STRING
 

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.49627 seconds with 12 queries