Parse error: parse error, unexpected $ in - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Parse error: parse error, unexpected $ in

darthmoobeydarthmoobey Posts: 140Member
Hello folks, I am pretty new at php programming, I am trying to learn it and I'm having some difficulties with this project I am working on. I keep getting this error:

Parse error: parse error, unexpected $ in /homepages/36/d106608162/htdocs/createpc.php on line 945

I did not include the html code, with this post, I Was not sure if it was needed. Though I will say the error points to the very last line, which happens to be the closing ?>. It sounded like it it was an unexpected variable, that has not been defined, but I have reviewed it over and over and cannot find what might be wrong. Could anyone please help. Also, I had a question on the implode() command, I set it up to implode various variables, but I know it works with arrays. IE. Implode("|",$array1), if array1 has array1[0]-array1[5] or something, but will it implode various variables like I have it set?

Thank you anyone for your help, and I Apologise ahead of time if this question seems a bit trivial to anyone else.

the darthmoob.

[code]
<?php
include('php/config.php');
$connect=mysql_connect($host,$user,$pw);
echo mysql_error();
mysql_select_db($db);

if($Submit){ //Start of Submit Routine
$mysqlphysical=implode("|",$str,$dex,$stam);
$mysqlsocial=implode("|",$cha,$man,$app);
$mysqlmental=implode("|",$per,$int,$wit);
$mysqltalents=implode("|",$alert,$ath,$bra,$dod,$emp,$exp,$intim,$lead,$street,$sub);
$mysqlskills=implode("|",$anim,$cra,$dri,$etiq,$fire,$mel,$perf,$sec,$stea,$surv);
$mysqlknows=implode("|",$aca,$comp,$fin,$inve,$law,$ling,$med,$occ,$pol,$sci);

switch($gen){ //Start of Switch Routine checking Generation to Assign Blood Pool
case 13:
$blood="10";
break;
case 12:
$blood="11";
break;
case 11:
$blood="12";
break;
case 10:
$blood="13";
break;
case 9:
$blood="14";
break;
case 8:
$blood="15";
break;
case 7:
$blood="20";
break;
case 6:
$blood="30";
break;
case 5:
$blood="40";
break;
}//end of Case Switch for Determining Blood Pool

$r="INSERT INTO $table SET
CharName='$charname',
Type='$type',
Gen='$gen',
Sect='$sect',
Concept='$concept',
Sex='$sex',
URL='$url',
Age1='$age1',
Age2='$age2',
Nature='$nature',
Demeanor='$demeanor',
Description='$description',
Physicals='$mysqlphysical',
Socials='$mysqlsocial',
Mentals='$mysqlmental',
Talents='$mysqltalents',
Skills='$mysqlskills',
Knowledges='$mysqlknows',
Secondary='$second',
Backgrounds='$backs',
Disciplines='$powers',
MF='$merits',
Willpower='$willpower',
Path='$path',
pathrate='$pathrate',
Blood='$blood',
Virtue1='$virtue1',
Virtue2='$virtue2',
Virtue3='$virtue3',
Equipment='$equipment',
Notes='$notes'"; //End of Database Submission Statement

$result=mysql_query($r);
if($result){
echo<<<eof
"<center>
Success!! Your Character was Successfully Created.


You may now close this window.
"
eof;
exit;
}
else{
echo"Failure! ! Mysql Error Says:

".mysql_error()."";
}
}//End of If Submit Statement
[/code]

Comments

  • netgertnetgert Posts: 331Member
    [b][red]This message was edited by netgert at 2004-9-17 11:7:6[/red][/b][hr]
    : Hello folks, I am pretty new at php programming, I am trying to learn it and I'm having some difficulties with this project I am working on. I keep getting this error:
    :
    : Parse error: parse error, unexpected $ in /homepages/36/d106608162/htdocs/createpc.php on line 945
    :
    : I did not include the html code, with this post, I Was not sure if it was needed. Though I will say the error points to the very last line, which happens to be the closing ?>. It sounded like it it was an unexpected variable, that has not been defined, but I have reviewed it over and over and cannot find what might be wrong. Could anyone please help. Also, I had a question on the implode() command, I set it up to implode various variables, but I know it works with arrays. IE. Implode("|",$array1), if array1 has array1[0]-array1[5] or something, but will it implode various variables like I have it set?
    :
    : Thank you anyone for your help, and I Apologise ahead of time if this question seems a bit trivial to anyone else.
    :
    : the darthmoob.
    :
    : [code]
    : <?php
    : include('php/config.php');
    : $connect=mysql_connect($host,$user,$pw);
    : echo mysql_error();
    : mysql_select_db($db);
    :
    : if($Submit){ //Start of Submit Routine
    : $mysqlphysical=implode("|",$str,$dex,$stam);
    : $mysqlsocial=implode("|",$cha,$man,$app);
    : $mysqlmental=implode("|",$per,$int,$wit);
    : $mysqltalents=implode("|",$alert,$ath,$bra,$dod,$emp,$exp,$intim,$lead,$street,$sub);
    : $mysqlskills=implode("|",$anim,$cra,$dri,$etiq,$fire,$mel,$perf,$sec,$stea,$surv);
    : $mysqlknows=implode("|",$aca,$comp,$fin,$inve,$law,$ling,$med,$occ,$pol,$sci);
    :
    : switch($gen){ //Start of Switch Routine checking Generation to Assign Blood Pool
    : case 13:
    : $blood="10";
    : break;
    : case 12:
    : $blood="11";
    : break;
    : case 11:
    : $blood="12";
    : break;
    : case 10:
    : $blood="13";
    : break;
    : case 9:
    : $blood="14";
    : break;
    : case 8:
    : $blood="15";
    : break;
    : case 7:
    : $blood="20";
    : break;
    : case 6:
    : $blood="30";
    : break;
    : case 5:
    : $blood="40";
    : break;
    : }//end of Case Switch for Determining Blood Pool
    :
    : $r="INSERT INTO $table SET
    : CharName='$charname',
    : Type='$type',
    : Gen='$gen',
    : Sect='$sect',
    : Concept='$concept',
    : Sex='$sex',
    : URL='$url',
    : Age1='$age1',
    : Age2='$age2',
    : Nature='$nature',
    : Demeanor='$demeanor',
    : Description='$description',
    : Physicals='$mysqlphysical',
    : Socials='$mysqlsocial',
    : Mentals='$mysqlmental',
    : Talents='$mysqltalents',
    : Skills='$mysqlskills',
    : Knowledges='$mysqlknows',
    : Secondary='$second',
    : Backgrounds='$backs',
    : Disciplines='$powers',
    : MF='$merits',
    : Willpower='$willpower',
    : Path='$path',
    : pathrate='$pathrate',
    : Blood='$blood',
    : Virtue1='$virtue1',
    : Virtue2='$virtue2',
    : Virtue3='$virtue3',
    : Equipment='$equipment',
    : Notes='$notes'"; //End of Database Submission Statement
    :
    : $result=mysql_query($r);
    : if($result){
    : echo<<<eof
    : <center>
    : Success!! Your Character was Successfully Created.


    : You may now close this window.
    :
    [red]eof;[/red]
    : exit;
    : }
    : else{
    : echo"Failure! ! Mysql Error Says:

    ".mysql_error()."";
    : }
    : }//End of If Submit Statement
    : [/code]
    :
    the HEREDOC syntax is invalid. the last line must contain NO OTHER CHARS before & after the identifier and MUST be immediately followed by semi-comma (;) and newline

    edit: you dont need to put double quotes into the HEREDOC
Sign In or Register to comment.