[PHP] Parse error: syntax error, unexpected ''
Good morning Everyone, I'm have trouble with a simple HTML Checkbox list. I keep getting *Parse error*: syntax error, unexpected ''. I'm sure I'm doing something really simple and basic wrong I just cannot seem to see what it is, any assistance is appreciated. Script: form method=post action=http://bw.org/misc/cgi-test/test.cgi; ?php $sql = SELECT * FROM melstatus WHERE custID=$custID ORDER BY aircraftRegistration; $q = mysql_query($q) or die (could not execute query.); echo fieldset ul style='list-style: none'\n; while($row = mysql_fetch_array($q)) { echo li.$row['melID'].input type=checkbox name=\.$row['melID].\/input ; /li\n; } echo /ul/fieldset ? /form Many Thanks Haig
RE: [PHP] parse error
Parse error: parse error, unexpected '}' in /home/content/c/u/t/cuteirka/html/commonlogin_new.php on line 37 Because I am not starting the brackets anywhere else. My only php function is between line 37 and 39 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, May 04, 2007 9:43 PM To: Brad Sumrall Subject: Re: [PHP] parse error }else{ Brad Sumrall wrote: Hi folk, I am writing a login in script and get the following: Parse error: parse error, unexpected T_ELSE in /home/content/c/u/t/cuteirka/html/commonlogin_new.php on line 37 I am basically pulling this straight out the php for dummies manual. Can someone kindly point me in the right direction on this one! Brad 1 form action=/phpBB/login.php method=post target=_top 2 table width=200 cellpadding=4 cellspacing=1 border=0 class=forumline align=center 3 tr 4 th background=images/login_top2.jpg height=30 class=thHead nowrap=nowrap/th 5 /tr 6 tr 7 td class=row1table border=0 cellpadding=3 cellspacing=1 width=100% 8 tr 9 td width=11% align=rightdiv align=leftspan class=genUsername:/span/div/td 10 /tr 11 tr 12 td align=rightinput type=text class=post name=username size=25 maxlength=40 value= //td 13 /tr 14 tr 15 td align=rightdiv align=leftspan class=genPassword/span/div/td 16 /tr 17 tr 18 td align=rightspan class=gen 19 input type=password class=post name=password size=25 maxlength=32 / 20 :/span/td 21 /tr 22 tr align=center 23 td colspan=2span class=genLog me on automatically: 24 input type=checkbox name=autologin //span/td 25 /tr 26 tr align=center 27 td colspan=2input type=hidden name=redirect value= /input type=submit name=login class=mainoption value=Log in //td 28 /tr 29 tr align=center 30 td colspan=2span class=gensmalla href=forgot_password.php class=gensmallI forgot my password/a/span/td 31 /tr 32 /table 33 /td 34 25 /tr 36 ?php 37 {else} 38 ? tr td width=207 height=32 background=images/login_top2.jpg class=headerlogout align=center table width=100% tr td width=30 height=27/td td align=lefta href=javascript:logout() class=link1Log out/a/td /tr /table /td /tr tr td align=center class=logincenterbg table width=88% border=0 cellspacing=0 cellpadding=0 tr td height=10 align=left class=bluetext/td /tr tr td align=left class=link2Welcome : ?php echo $_SESSION[userid] ?/td /tr tr td height=22 align=left class=bluetext/td /tr tr td height=20 align=lefta class=link1 href=editaccount.phpManage Account/a/td /tr tr td height=20 align=lefta class=link1 href=editprofile.phpManage Profile/a/td /tr /table /td /tr tr td align=left valign=topimg src=images/login_bottom.jpg width=200 height=8 alt= //td /tr /table /form -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] parse error
I dug deeper and realized I needed to open it correctly. You were right! Thank you! Here is the correct code that works like a charm! Brad ?php if(!isset($_SESSION[userid])) { ? form action=/phpBB/login.php method=post target=_top table width=200 cellpadding=4 cellspacing=1 border=0 class=forumline align=center tr th background=images/login_top2.jpg height=30 class=thHead nowrap=nowrap/th /tr tr td class=row1table border=0 cellpadding=3 cellspacing=1 width=100% tr td width=11% align=rightdiv align=leftspan class=genUsername:/span/div/td /tr tr td align=rightinput type=text class=post name=username size=25 maxlength=40 value= //td /tr tr td align=rightdiv align=leftspan class=genPassword/span/div/td /tr tr td align=rightspan class=gen input type=password class=post name=password size=25 maxlength=32 / :/span/td /tr tr align=center td colspan=2span class=genLog me on automatically: input type=checkbox name=autologin //span/td /tr tr align=center td colspan=2input type=hidden name=redirect value= /input type=submit name=login class=mainoption value=Log in //td /tr tr align=center td colspan=2span class=gensmalla href=forgot_password.php class=gensmallI forgot my password/a/span/td /tr /table /td /tr ?php }else{ ? tr td width=207 height=32 background=images/login_top2.jpg class=headerlogout align=center table width=100% tr td width=30 height=27/td td align=lefta href=javascript:logout() class=link1Log out/a/td /tr /table /td /tr tr td align=center class=logincenterbg table width=88% border=0 cellspacing=0 cellpadding=0 tr td height=10 align=left class=bluetext/td /tr tr td align=left class=link2Welcome : ?php echo $_SESSION[userid] ?/td /tr tr td height=22 align=left class=bluetext/td /tr tr td height=20 align=lefta class=link1 href=editaccount.phpManage Account/a/td /tr tr td height=20 align=lefta class=link1 href=editprofile.phpManage Profile/a/td /tr /table /td /tr tr td align=left valign=topimg src=images/login_bottom.jpg width=200 height=8 alt= //td /tr /table /form ?php } ? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, May 04, 2007 9:43 PM To: Brad Sumrall Subject: Re: [PHP] parse error }else{ Brad Sumrall wrote: Hi folk, I am writing a login in script and get the following: Parse error: parse error, unexpected T_ELSE in /home/content/c/u/t/cuteirka/html/commonlogin_new.php on line 37 I am basically pulling this straight out the php for dummies manual. Can someone kindly point me in the right direction on this one! Brad 1 form action=/phpBB/login.php method=post target=_top 2 table width=200 cellpadding=4 cellspacing=1 border=0 class=forumline align=center 3 tr 4 th background=images/login_top2.jpg height=30 class=thHead nowrap=nowrap/th 5 /tr 6 tr 7 td class=row1table border=0 cellpadding=3 cellspacing=1 width=100% 8 tr 9 td width=11% align=rightdiv align=leftspan class=genUsername:/span/div/td 10 /tr 11 tr 12 td align=rightinput type=text class=post name=username size=25 maxlength=40 value= //td 13 /tr 14 tr 15 td align=rightdiv align=leftspan class=genPassword/span/div/td 16 /tr 17 tr 18 td align=rightspan class=gen 19 input type=password class=post name=password size=25 maxlength=32 / 20 :/span/td 21 /tr 22 tr align=center 23
RE: [PHP] parse error
Maybe not The following passes me on without error, but does not actually log me on? Put in a fake name, and it still passes me on to the index page. I took this straight off the phpbb help files? Brad ?php if(!isset($_SESSION[userid])) { ? form action=/phpbb/index.php method=post target=_top ?php }else{ ? ?php echo $_SESSION[userid] ? /form ?php } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parse error on a basic call?
$SESSION = get_include_contents'/phpbb/login.php'; I pulled this tright out of the text book. I am trying to pull a phpbb session on an outside page. Any suggestions? Here is the error! Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/content/c/u/t/cuteirka/html/contest_stories.php on line 2 Brad
Re: [PHP] Parse error on a basic call?
On Apr 28, 2007, at 9:08 PM, Brad Sumrall wrote: $SESSION = get_include_contents'/phpbb/login.php'; I pulled this tright out of the text book. I am trying to pull a phpbb session on an outside page. Any suggestions? Here is the error! Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/content/c/u/t/cuteirka/html/contest_stories.php on line 2 You've got an unexpected string on line 2 of contest_stories.php. I'm going to assume that get_include_contents is a function? It should probably be: get_include_contents('/phpbb/login.php'); Notice the parens... There is a *real* good reference to the language here: http://www.php.net/manual/en/ The parser tokens are listed at: http://www.php.net/manual/en/tokens.php You can also usually google for T_CONSTANT_ENCAPSED_STRING and php (or whatever the error is) and probably get some good info too. Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parse error help.., thanks..
Hi everyone, i am new to PHP, but not a programmer.., i got this php code to workout on something on my blog, but it seems that it gives me the following error: Parse error: syntax error, unexpected ';' in /hxxx/x/domains/x.com/public_html/blog/labels.php on line 15 ul class=labels ?php define('PREFIX', 'http://.x.com/labels'); define('SEARCH_DIR','//x/domains/x.com/public_html/blog/labels'); define('THIS_FILE', 'cloud.php'); if(file_exists(SEARCH_DIR.'_cloud_include_cache.html') filemtime(SEARCH_DIR.'_cloud_include_cache.html')(time()-(60*60))) echo file_get_contents(SEARCH_DIR.'_cloud_include_cache.html'); else { $output = ''; $files = array(); $dir = opendir(SEARCH_DIR); while($file = readdir($dir)) if($file != '.' $file != '..' $file != THIS_FILE amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp; $file != CACHE_FILE) { $files[] = $file; } Anyhelp on this will ve be very much appreciated, thanks.. Ian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse error help.., thanks..
Em Sexta 30 Março 2007 18:55, Ian escreveu: Parse error: syntax error, unexpected ';' in /hxxx/x/domains/x.com/public_html/blog/labels.php on line 15 ul class=labels ?php 1 define('PREFIX', 'http://.x.com/labels'); 2 define('SEARCH_DIR','//x/domains/x.com/public_html/blog/labels'); 3 define('THIS_FILE', 'cloud.php'); 4 if(file_exists(SEARCH_DIR.'_cloud_include_cache.html') 5 filemtime(SEARCH_DIR.'_cloud_include_cache.html')(time()-(60*60))) 6 echo file_get_contents(SEARCH_DIR.'_cloud_include_cache.html'); 7 else 8 { 9 $output = ''; 10 $files = array(); 11 $dir = opendir(SEARCH_DIR); 12 while($file = readdir($dir)) 13 if($file != '.' $file != '..' $file != THIS_FILE 14 amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;am 15 p;amp;amp; $file != CACHE_FILE) 16 { 17 $files[] = $file; 18 } Try remove the amp;s... []s -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: Toothpaste never hurts the taste of good scotch. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse error help.., thanks..
On 3/30/07, Ian [EMAIL PROTECTED] wrote: Hi everyone, i am new to PHP, but not a programmer.., i got this php code to workout on something on my blog, but it seems that it gives me the following error: Parse error: syntax error, unexpected ';' in /hxxx/x/domains/x.com/public_html/blog/labels.php on line 15 ul class=labels ?php define('PREFIX', 'http://.x.com/labels'); define('SEARCH_DIR','//x/domains/x.com/public_html/blog/labels'); define('THIS_FILE', 'cloud.php'); if(file_exists(SEARCH_DIR.'_cloud_include_cache.html') filemtime(SEARCH_DIR.'_cloud_include_cache.html')(time()-(60*60))) echo file_get_contents(SEARCH_DIR.'_cloud_include_cache.html'); else { $output = ''; $files = array(); $dir = opendir(SEARCH_DIR); while($file = readdir($dir)) if($file != '.' $file != '..' $file != THIS_FILE amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp; How can above string be ever correct $file != CACHE_FILE) { $files[] = $file; } Anyhelp on this will ve be very much appreciated, thanks.. Ian Try this code: ul class=labels ?php define('PREFIX', 'http://.x.com/labels'); define('SEARCH_DIR','//x/domains/x.com/public_html/blog/labels'); define('THIS_FILE', 'cloud.php'); if(file_exists(SEARCH_DIR.'_cloud_include_cache.html') filemtime(SEARCH_DIR.'_cloud_include_cache.html')(time()-(60*60))) echo file_get_contents(SEARCH_DIR.'_cloud_include_cache.html'); else { $output = ''; $files = array(); $dir = opendir(SEARCH_DIR); while($file = readdir($dir)) if($file != '.' $file != '..' $file != THIS_FILE $file != CACHE_FILE) { $files[] = $file; } It should work, if not, come back here :) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse error help.., thanks..
Hehe.., didn't i told i am poor in this, actually, never learn PHP before.. :) No more such errors anymore thank you Tijnema! =) Ian Tijnema ! [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 3/30/07, Ian [EMAIL PROTECTED] wrote: Hi everyone, i am new to PHP, but not a programmer.., i got this php code to workout on something on my blog, but it seems that it gives me the following error: Parse error: syntax error, unexpected ';' in /hxxx/x/domains/x.com/public_html/blog/labels.php on line 15 ul class=labels ?php define('PREFIX', 'http://.x.com/labels'); define('SEARCH_DIR','//x/domains/x.com/public_html/blog/labels'); define('THIS_FILE', 'cloud.php'); if(file_exists(SEARCH_DIR.'_cloud_include_cache.html') filemtime(SEARCH_DIR.'_cloud_include_cache.html')(time()-(60*60))) echo file_get_contents(SEARCH_DIR.'_cloud_include_cache.html'); else { $output = ''; $files = array(); $dir = opendir(SEARCH_DIR); while($file = readdir($dir)) if($file != '.' $file != '..' $file != THIS_FILE amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp; How can above string be ever correct $file != CACHE_FILE) { $files[] = $file; } Anyhelp on this will ve be very much appreciated, thanks.. Ian Try this code: ul class=labels ?php define('PREFIX', 'http://.x.com/labels'); define('SEARCH_DIR','//x/domains/x.com/public_html/blog/labels'); define('THIS_FILE', 'cloud.php'); if(file_exists(SEARCH_DIR.'_cloud_include_cache.html') filemtime(SEARCH_DIR.'_cloud_include_cache.html')(time()-(60*60))) echo file_get_contents(SEARCH_DIR.'_cloud_include_cache.html'); else { $output = ''; $files = array(); $dir = opendir(SEARCH_DIR); while($file = readdir($dir)) if($file != '.' $file != '..' $file != THIS_FILE $file != CACHE_FILE) { $files[] = $file; } It should work, if not, come back here :) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse error help.., thanks..
Thanks very much for the help, Davi,, no more such errors.. :) Ian Davi [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Em Sexta 30 Março 2007 18:55, Ian escreveu: Parse error: syntax error, unexpected ';' in /hxxx/x/domains/x.com/public_html/blog/labels.php on line 15 ul class=labels ?php 1 define('PREFIX', 'http://.x.com/labels'); 2 define('SEARCH_DIR','//x/domains/x.com/public_html/blog/labels'); 3 define('THIS_FILE', 'cloud.php'); 4 if(file_exists(SEARCH_DIR.'_cloud_include_cache.html') 5 filemtime(SEARCH_DIR.'_cloud_include_cache.html')(time()-(60*60))) 6 echo file_get_contents(SEARCH_DIR.'_cloud_include_cache.html'); 7 else 8 { 9 $output = ''; 10 $files = array(); 11 $dir = opendir(SEARCH_DIR); 12 while($file = readdir($dir)) 13 if($file != '.' $file != '..' $file != THIS_FILE 14 amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;am 15 p;amp;amp; $file != CACHE_FILE) 16 { 17 $files[] = $file; 18 } Try remove the amp;s... []s -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: Toothpaste never hurts the taste of good scotch. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] parse error
Greetings All, Please have a look at the following code: if ($numrows 1) // the member does not exist { include ($adminfolderpath./include/headeradmin.php); echo pThat email does not exist in the members list./p; echo pa href='login.php'Please login/a./p; include ($adminfolderpath./include/footeradmin.php); exit; } if (md5($memberpassword) !=$dbmemberpassword) // the password does not match the one in the database { include ($adminfolderpath./include/headeradmin.php); echo pIncorrect password, please try again./p; login(); include ($adminfolderpath./include/footeradmin.php); exit; } else { header(Location: http://demo.bdiverse.com/accessible/admin/listmypages.php;); exit; } ? I am getting the following error:* Parse error*: parse error, unexpected $ in */home/httpd/vhosts/demo.bdiverse.com/httpdocs/accessible/processlogin.php* on line *69 In my code the last line i.e. ? is marked as line 69 Can someone please let me know what is causing this error? Thanks! * -- Kind Regards Schalk Neethling Web Developer.Designer.Programmer.President Volume4.Business.Solution.Developers -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] parse error
Schalk wrote: Greetings All, Please have a look at the following code: your missing a closing brace some where - by the looks of things not in the code you sent. if ($numrows 1) // the member does not exist { include ($adminfolderpath./include/headeradmin.php); echo pThat email does not exist in the members list./p; echo pa href='login.php'Please login/a./p; include ($adminfolderpath./include/footeradmin.php); exit; } if (md5($memberpassword) !=$dbmemberpassword) // the password does not match the one in the database { include ($adminfolderpath./include/headeradmin.php); echo pIncorrect password, please try again./p; login(); include ($adminfolderpath./include/footeradmin.php); exit; } else { header(Location: http://demo.bdiverse.com/accessible/admin/listmypages.php;); exit; } ? I am getting the following error:* Parse error*: parse error, unexpected $ in */home/httpd/vhosts/demo.bdiverse.com/httpdocs/accessible/processlogin.php* on line *69 In my code the last line i.e. ? is marked as line 69 Can someone please let me know what is causing this error? Thanks! * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] parse error
Thanks everyone. Jochem Maas wrote: Schalk wrote: Greetings All, Please have a look at the following code: your missing a closing brace some where - by the looks of things not in the code you sent. if ($numrows 1) // the member does not exist { include ($adminfolderpath./include/headeradmin.php); echo pThat email does not exist in the members list./p; echo pa href='login.php'Please login/a./p; include ($adminfolderpath./include/footeradmin.php); exit; } if (md5($memberpassword) !=$dbmemberpassword) // the password does not match the one in the database { include ($adminfolderpath./include/headeradmin.php); echo pIncorrect password, please try again./p; login(); include ($adminfolderpath./include/footeradmin.php); exit; } else { header(Location: http://demo.bdiverse.com/accessible/admin/listmypages.php;); exit; } ? I am getting the following error:* Parse error*: parse error, unexpected $ in */home/httpd/vhosts/demo.bdiverse.com/httpdocs/accessible/processlogin.php* on line *69 In my code the last line i.e. ? is marked as line 69 Can someone please let me know what is causing this error? Thanks! * -- Kind Regards Schalk Neethling Web Developer.Designer.Programmer.President Volume4.Business.Solution.Developers -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] parse error
At 08:11 AM 7/10/2006, Schalk wrote: I am getting the following error:* Parse error*: parse error, unexpected $ in */home/httpd/vhosts/demo.bdiverse.com/httpdocs/accessible/processlogin.php* on line *69 In my code the last line i.e. ? is marked as line 69 I don't see anything wrong with the code you posted, so I'd look earlier in your script or in your included scripts. Generally speaking when the parser complains at the final ? tag it means a missing close-bracket } at the end of a code block or a heredoc expression that isn't closed properly. If you're using heredocs, remember that the closing expression must end in a semicolon and neither the the opening expression nor the closing may have trailing spaces or tabs. Good luck, Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parse error: syntax error, unexpected '}'
Hi All, can anone see what's wrong with the below code? I get this error, *Parse error*: syntax error, unexpected '}' in */usr/local/apache2/htdocs/moviedata2.php* on line *18 * $age=1; while($age=100) { $insert = INSERT INTO age (age_label) VALUES ($age); $results = mysql_query($insert) or die(mysql_error()); $age++ } Cheers. Mark Sargent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse error: syntax error, unexpected '}'
Quoting Mark Sargent [EMAIL PROTECTED]: Hi All, can anone see what's wrong with the below code? I get this error, *Parse error*: syntax error, unexpected '}' in */usr/local/apache2/htdocs/moviedata2.php* on line *18 * $age=1; while($age=100) { $insert = INSERT INTO age (age_label) VALUES ($age); $results = mysql_query($insert) or die(mysql_error()); $age++ } There's a semi-colon missing at the end of the last line ($age++). Hope thi shelps, Rick -- Rick Emery When once you have tasted flight, you will forever walk the Earth with your eyes turned skyward, for there you have been, and there you will always long to return -- Leonardo Da Vinci -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Parse error: syntax error, unexpected '}'
how about like this --- $insert = INSERT INTO age (age_label) VALUES ('$age'); --- From: Mark Sargent [mailto:[EMAIL PROTECTED] Sent: Sat 03-Jun-2006 10:02 To: PHP List Subject: [PHP] Parse error: syntax error, unexpected '}' Hi All, can anone see what's wrong with the below code? I get this error, *Parse error*: syntax error, unexpected '}' in */usr/local/apache2/htdocs/moviedata2.php* on line *18 * $age=1; while($age=100) { $insert = INSERT INTO age (age_label) VALUES ($age); $results = mysql_query($insert) or die(mysql_error()); $age++ } Cheers. Mark Sargent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse error: syntax error, unexpected '}'
Hi All, sorry, found it. Forgot the ; after $age++. Cheers. Mark Sargent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Recall: [PHP] Parse error: syntax error, unexpected '}'
Bagus Nugroho would like to recall the message, [PHP] Parse error: syntax error, unexpected '}'.
[PHP] Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in
Hi All, I get the error for line 15 for this code, ?php 15 echo font face='$_SESSION['font']'; 16 echo size='$_SESSION['size']'; 17 echo color='$_SESSION['colour']'; 18 echo $_SESSION['text']; 19 echo /font; 20 ? I have put ' ' quotes around the quotes for each font attribute so that the parser doesn't think the echo is finished too early. Is that wrong? I know that this code would get tedious for lots of text and CSS would be better, but, it's just a little study project from the book I'm following. Cheers. Mark Sargent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in
Mark Sargent wrote: Hi All, I get the error for line 15 for this code, ?php 15 echo font face='$_SESSION['font']'; 16 echo size='$_SESSION['size']'; 17 echo color='$_SESSION['colour']'; 18 echo $_SESSION['text']; 19 echo /font; 20 ? I have put ' ' quotes around the quotes for each font attribute so that the parser doesn't think the echo is finished too early. Is that wrong? I know that this code would get tedious for lots of text and CSS would be better, but, it's just a little study project from the book I'm following. Cheers. Mark Sargent. any of these will work: echo font face='.$_SESSION['font'].'; //note the . before and after the variable. echo font face='{$_SESSION['font']}'; echo font face='$_SESSION[font]';//no quotes around the index key ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in
Mark Sargent wrote: Hi All, I get the error for line 15 for this code, ?php 15 echo font face='$_SESSION['font']'; 16 echo size='$_SESSION['size']'; 17 echo color='$_SESSION['colour']'; 18 echo $_SESSION['text']; 19 echo /font; 20 ? I have put ' ' quotes around the quotes for each font attribute so that the parser doesn't think the echo is finished too early. Is that wrong? I know that this code would get tedious for lots of text and CSS would be better, but, it's just a little study project from the book I'm following. Cheers. Mark Sargent. Hi All, sorry, I forgot the fundamentals again, . variableName . echo font face=' . $_SESSION['font'] . '; and no around the variable in an echo statement when no other text in it. echo $_SESSION['text']; Cheers. Mark Sargent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parse error: syntax error, unexpected ',' in
Hi All, this code, ?php $flavour[] = blue raspberry; $flavour[] = root beer; $flavour[] = pineapple; sort($flavour); print_r($flavour); echo br; echo My favourite flavours are:br; foreach ($flavour as $currentValue) { //these lines will execute as long as there is a value in $flavour echo $currentValue br\n; } ? gives this, *Parse error*: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in */usr/local/apache2/htdocs/sorting.php* on line *18 * and adding a , to this line, foreach ($flavour, as $currentValue) { gives this error, *Parse error*: syntax error, unexpected ',' in */usr/local/apache2/htdocs/sorting.php* on line *16* The code in the book I'm following has the , in that line. Can anyone tell me what I'm doing wrong? Cheers. Mark Sargent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse error: syntax error, unexpected ',' in
Mark Sargent wrote: Hi All, this code, ?php $flavour[] = blue raspberry; $flavour[] = root beer; $flavour[] = pineapple; sort($flavour); print_r($flavour); echo br; echo My favourite flavours are:br; foreach ($flavour as $currentValue) { //these lines will execute as long as there is a value in $flavour echo $currentValue br\n; } ? gives this, *Parse error*: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in */usr/local/apache2/htdocs/sorting.php* on line *18 The echo in the foreach loop has no concatenation operator. echo $currentValue br\n; should be echo $currentValue.br\n; and adding a , to this line, foreach ($flavour, as $currentValue) { gives this error, *Parse error*: syntax error, unexpected ',' in */usr/local/apache2/htdocs/sorting.php* on line *16* The code in the book I'm following has the , in that line. Can anyone tell me what I'm doing wrong? Cheers. If the code in the book you're reading really has a , in the foreach line I suggest you throw it away and find another book, because that's not valid PHP. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse error: syntax error, unexpected ',' in
On 24/05/06, Mark Sargent [EMAIL PROTECTED] wrote: Hi All, this code, ?php $flavour[] = blue raspberry; $flavour[] = root beer; $flavour[] = pineapple; sort($flavour); print_r($flavour); echo br; echo My favourite flavours are:br; foreach ($flavour as $currentValue) { //these lines will execute as long as there is a value in $flavour echo $currentValue br\n; } ? gives this, *Parse error*: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in */usr/local/apache2/htdocs/sorting.php* on line *18 * and adding a , to this line, foreach ($flavour, as $currentValue) { No, you were right the first time. No comma is required there. Line 18 is the line with the echo statement on it. The items you want to echo should be separated by commas: So it should be: echo $currentValue, br\n; -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse error: syntax error, unexpected ',' in
Mark Sargent wrote: Hi All, this code, ?php $flavour[] = blue raspberry; $flavour[] = root beer; $flavour[] = pineapple; sort($flavour); print_r($flavour); echo br; echo My favourite flavours are:br; foreach ($flavour as $currentValue) { //these lines will execute as long as there is a value in $flavour echo $currentValue br\n; } ? gives this, *Parse error*: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in */usr/local/apache2/htdocs/sorting.php* on line *18 * and adding a , to this line, foreach ($flavour, as $currentValue) { gives this error, *Parse error*: syntax error, unexpected ',' in */usr/local/apache2/htdocs/sorting.php* on line *16* Since there aren't actually 18 lines this isn't the real code.. The problem is here: echo $currentValue br\n; it should be echo $currentValue . br\n; or echo $currentValue , br\n; -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse error: syntax error, unexpected ',' in
Chris wrote: Since there aren't actually 18 lines this isn't the real code.. true, as I only posted the php code The problem is here: echo $currentValue br\n; it should be echo $currentValue . br\n; or echo $currentValue , br\n; thanx to all. The book is Beginning PHP, Apache, MySQL, Web Development and it seems to only be a typo on that page(section) as the next page shows similar code using the right syntax. I just didn't notice it till after I posted. Cheers. Mark Sargent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Error on SQL Insert [Solved]
Sorry guys - knew it would be obvious! I was using $_FILE['image']['name'][0], instead of $_FILES['image']['name'][0] However, thanks for all your help. Tom On 07/04/06, Joe Henry [EMAIL PROTECTED] wrote: On Friday 07 April 2006 1:56 pm, Chrome wrote: Backticks (`) encapsulate table or database names I was thinking maybe if the array references were encapsulated in curly braces {}: $_POST['model'] to {$_POST['model']} Of course if the field in the DB isn't numeric this would be '{$_POST['model']}' Dan --- http://chrome.me.uk -Original Message- From: Joe Henry [mailto:[EMAIL PROTECTED] Sent: 07 April 2006 20:53 To: php-general@lists.php.net; [EMAIL PROTECTED] Subject: Re: [PHP] Parse Error on SQL Insert On Friday 07 April 2006 1:37 pm, Tom Chubb wrote: $insertSQL = INSERT INTO cars (model, `year`, details, price, image1, Not sure if this is your problem, but those look like backticks around year instead of single quotes. Should there even be quotes there? HTH -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ NOD32 1.1475 (20060406) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com Good to know. Thanks. -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- Tom Chubb [EMAIL PROTECTED] 07915 053312
[PHP] Parse Error on SQL Insert
I'm working on an insert record page with a multiple file upload script of which I understand the fundamentals. However, on submission I am getting the following error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\apache2triad\htdocs\damotors\admin\insertnew.php on line 34 Where line 34 is... $insertSQL = INSERT INTO cars (model, `year`, details, price, image1, image2, image3, forsale) VALUES ($_POST['model'], $_POST['year'], $_POST['details'], $_POST['price'], $_FILE['image']['name'][0], $_FILE['image']['name'][1], $_FILE['image']['name'][2], $_POST['forsale']); For info, the HTML for the form is as follows: tr valign=baseline td nowrap align=rightImage1:/td tdinput type=file name=image[]/td /tr tr valign=baseline td nowrap align=rightImage2:/td tdinput type=file name=image[]/td /tr tr valign=baseline td nowrap align=rightImage3:/td tdinput type=file name=image[]/td /tr I've been slaving away for an hour and it's probably something really obvious but I'd really appreciate it if someone could point it out to me please? Previously I was getting an image1 cannot be null error which I couldn't work out either. That's gone, but I still can't work out what's going on. Many thanks, Tom -- Tom Chubb [EMAIL PROTECTED] 07915 053312
Re: [PHP] Parse Error on SQL Insert
Tom Chubb wrote: I'm working on an insert record page with a multiple file upload script of which I understand the fundamentals. However, on submission I am getting the following error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\apache2triad\htdocs\damotors\admin\insertnew.php on line 34 Where line 34 is... $insertSQL = INSERT INTO cars (model, `year`, details, price, image1, image2, image3, forsale) VALUES ($_POST['model'], $_POST['year'], $_POST['details'], $_POST['price'], $_FILE['image']['name'][0], $_FILE['image']['name'][1], $_FILE['image']['name'][2], $_POST['forsale']); snip I've been slaving away for an hour and it's probably something really obvious but I'd really appreciate it if someone could point it out to me please? Previously I was getting an image1 cannot be null error which I couldn't work out either. That's gone, but I still can't work out what's going on. Without seeing more code (the error is probably above line 34), I can only guess that the problem is with your posted data. Escape your data before you insert it into a db. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Error on SQL Insert
why do you have single quotes around year? -B Tom Chubb wrote: I'm working on an insert record page with a multiple file upload script of which I understand the fundamentals. However, on submission I am getting the following error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\apache2triad\htdocs\damotors\admin\insertnew.php on line 34 Where line 34 is... $insertSQL = INSERT INTO cars (model, `year`, details, price, image1, image2, image3, forsale) VALUES ($_POST['model'], $_POST['year'], $_POST['details'], $_POST['price'], $_FILE['image']['name'][0], $_FILE['image']['name'][1], $_FILE['image']['name'][2], $_POST['forsale']); For info, the HTML for the form is as follows: tr valign=baseline td nowrap align=rightImage1:/td tdinput type=file name=image[]/td /tr tr valign=baseline td nowrap align=rightImage2:/td tdinput type=file name=image[]/td /tr tr valign=baseline td nowrap align=rightImage3:/td tdinput type=file name=image[]/td /tr I've been slaving away for an hour and it's probably something really obvious but I'd really appreciate it if someone could point it out to me please? Previously I was getting an image1 cannot be null error which I couldn't work out either. That's gone, but I still can't work out what's going on. Many thanks, Tom -- Tom Chubb [EMAIL PROTECTED] 07915 053312 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Error on SQL Insert
On Friday 07 April 2006 1:37 pm, Tom Chubb wrote: $insertSQL = INSERT INTO cars (model, `year`, details, price, image1, Not sure if this is your problem, but those look like backticks around year instead of single quotes. Should there even be quotes there? HTH -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Error on SQL Insert
Complete code... ?php require_once('../Connections/damotors.php'); ? ?php function GetSQLValueString($theValue, $theType, $theDefinedValue = , $theNotDefinedValue = ) { $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue; switch ($theType) { case text: $theValue = ($theValue != ) ? ' . $theValue . ' : NULL; break; case long: case int: $theValue = ($theValue != ) ? intval($theValue) : NULL; break; case double: $theValue = ($theValue != ) ? ' . doubleval($theValue) . ' : NULL; break; case date: $theValue = ($theValue != ) ? ' . $theValue . ' : NULL; break; case defined: $theValue = ($theValue != ) ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= ? . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST[MM_insert])) ($_POST[MM_insert] == form1)) { $insertSQL = INSERT INTO cars (model, `year`, details, price, image1, image2, image3, forsale) VALUES ($_POST['model'], $_POST['year'], $_POST['details'], $_POST['price'], $_FILE['image']['name'][0], $_FILE['image']['name'][1], $_FILE['image']['name'][2], $_POST['forsale']); mysql_select_db($database_damotors, $damotors); $Result1 = mysql_query($insertSQL, $damotors) or die(mysql_error()); $insertGoTo = uploadhandler.php; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? : ?; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf(Location: %s, $insertGoTo)); } ?!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 / titleUntitled Document/title /head body form method=post name=form1 action=?php echo $editFormAction; ? table align=center tr valign=baseline td nowrap align=rightModel:/td tdinput type=text name=model value= size=32/td /tr tr valign=baseline td nowrap align=rightYear:/td tdinput type=text name=year value= size=32/td /tr tr valign=baseline td nowrap align=right valign=topDetails:/td tdtextarea name=details cols=50 rows=5/textarea /td /tr tr valign=baseline td nowrap align=rightPrice:/td tdinput type=text name=price value= size=32 input type=hidden name=MAX_FILE_SIZE value=190 //td /tr tr valign=baseline td nowrap align=rightImage1:/td tdinput type=file name=image[]/td /tr tr valign=baseline td nowrap align=rightImage2:/td tdinput type=file name=image[]/td /tr tr valign=baseline td nowrap align=rightImage3:/td tdinput type=file name=image[]/td /tr tr valign=baseline td nowrap align=rightForsale:/td tdinput type=text name=forsale value= size=32/td /tr tr valign=baseline td nowrap align=rightnbsp;/td tdinput type=submit value=Insert record/td /tr /table input type=hidden name=MM_insert value=form1 /form pnbsp;/p /body /html The reason for the single quotes around the year is something to do with Dreamweaver's insert wizard. On 07/04/06, Brad Bonkoski [EMAIL PROTECTED] wrote: why do you have single quotes around year? -B Tom Chubb wrote: I'm working on an insert record page with a multiple file upload script of which I understand the fundamentals. However, on submission I am getting the following error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\apache2triad\htdocs\damotors\admin\insertnew.php on line 34 Where line 34 is... $insertSQL = INSERT INTO cars (model, `year`, details, price, image1, image2, image3, forsale) VALUES ($_POST['model'], $_POST['year'], $_POST['details'], $_POST['price'], $_FILE['image']['name'][0], $_FILE['image']['name'][1], $_FILE['image']['name'][2], $_POST['forsale']); For info, the HTML for the form is as follows: tr valign=baseline td nowrap align=rightImage1:/td tdinput type=file name=image[]/td /tr tr valign=baseline td nowrap align=rightImage2:/td tdinput type=file name=image[]/td /tr tr valign=baseline td nowrap align=rightImage3:/td tdinput type=file name=image[]/td /tr I've been slaving away for an hour and it's probably something really obvious but I'd really appreciate it if someone could point it out to me please? Previously I was getting an image1 cannot be null error which I couldn't work out either. That's gone, but I still can't work out what's going on. Many thanks, Tom -- Tom Chubb [EMAIL PROTECTED] 07915 053312 -- Tom Chubb [EMAIL PROTECTED] 07915 053312
Re: [PHP] Parse Error on SQL Insert
On Friday 07 April 2006 12:53, Joe Henry wrote: On Friday 07 April 2006 1:37 pm, Tom Chubb wrote: $insertSQL = INSERT INTO cars (model, `year`, details, price, image1, Not sure if this is your problem, but those look like backticks around year instead of single quotes. Should there even be quotes there? HTH -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] The backticks should be fine. They tell MySQL that you mean the column year of the table cars and not the MySQL special word year which can be used in date calculations. The same thing would apply if you wanted a column named create. I would agree with John on the POST data. Make sure you at least run mysql_real_escape_string(). -- Ray Hauge Programmer/Systems Administrator American Student Loan Services www.americanstudentloan.com 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Parse Error on SQL Insert
Backticks (`) encapsulate table or database names I was thinking maybe if the array references were encapsulated in curly braces {}: $_POST['model'] to {$_POST['model']} Of course if the field in the DB isn't numeric this would be '{$_POST['model']}' Dan --- http://chrome.me.uk -Original Message- From: Joe Henry [mailto:[EMAIL PROTECTED] Sent: 07 April 2006 20:53 To: php-general@lists.php.net; [EMAIL PROTECTED] Subject: Re: [PHP] Parse Error on SQL Insert On Friday 07 April 2006 1:37 pm, Tom Chubb wrote: $insertSQL = INSERT INTO cars (model, `year`, details, price, image1, Not sure if this is your problem, but those look like backticks around year instead of single quotes. Should there even be quotes there? HTH -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ NOD32 1.1475 (20060406) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Error on SQL Insert
thanks for the clarification, I guess the other solution would be to avoid using names with special meaning for column names... -B Ray Hauge wrote: On Friday 07 April 2006 12:53, Joe Henry wrote: On Friday 07 April 2006 1:37 pm, Tom Chubb wrote: $insertSQL = INSERT INTO cars (model, `year`, details, price, image1, Not sure if this is your problem, but those look like backticks around year instead of single quotes. Should there even be quotes there? HTH -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] The backticks should be fine. They tell MySQL that you mean the column year of the table cars and not the MySQL special word year which can be used in date calculations. The same thing would apply if you wanted a column named create. I would agree with John on the POST data. Make sure you at least run mysql_real_escape_string(). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Error on SQL Insert
Tom Chubb wrote: Complete code... snip $insertSQL = INSERT INTO cars (model, `year`, details, price, image1, image2, image3, forsale) VALUES ($_POST['model'], $_POST['year'], $_POST['details'], $_POST['price'], $_FILE['image']['name'][0], $_FILE['image']['name'][1], $_FILE['image']['name'][2], $_POST['forsale']); /snip Looks like a problem with your input data. Escape it. You should be escaping it anyway, and not putting raw user input into your db. The reason for the single quotes around the year is something to do with Dreamweaver's insert wizard. year is a special word in MySQL. The back ticks are to let MySQL know that it's a column name. Without the back ticks, MySQL will 'guess', but that can cause problems...best to just back tick all the column names anyway. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Error on SQL Insert
On Friday 07 April 2006 12:56, Chrome wrote: Of course if the field in the DB isn't numeric this would be '{$_POST['model']}' Dan That's what I was thinking. Even if data is a number, I still generally put quotes around it to make sure I don't have an issue. -- Ray Hauge Programmer/Systems Administrator American Student Loan Services www.americanstudentloan.com 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Error on SQL Insert
Mi vote goes to the curly braces The error is given by php, not by SQL When exploding variables within double quotes it is hard for php to distinguish when a variable end unless it is a simple variable like $foo. When it is an array element and even worst, when it is an element of a multidimensional array, php cannot assert when it is over (really, it is not a bug, try to figure out how to do it and you'll see it is not easy) so you tell php by enclosing the whole variable in curly braces. Which it says so in the manual Satyam - Original Message - From: Chrome [EMAIL PROTECTED] To: 'Joe Henry' [EMAIL PROTECTED]; php-general@lists.php.net; [EMAIL PROTECTED] Sent: Friday, April 07, 2006 9:56 PM Subject: RE: [PHP] Parse Error on SQL Insert Backticks (`) encapsulate table or database names I was thinking maybe if the array references were encapsulated in curly braces {}: $_POST['model'] to {$_POST['model']} Of course if the field in the DB isn't numeric this would be '{$_POST['model']}' Dan --- http://chrome.me.uk -Original Message- From: Joe Henry [mailto:[EMAIL PROTECTED] Sent: 07 April 2006 20:53 To: php-general@lists.php.net; [EMAIL PROTECTED] Subject: Re: [PHP] Parse Error on SQL Insert On Friday 07 April 2006 1:37 pm, Tom Chubb wrote: $insertSQL = INSERT INTO cars (model, `year`, details, price, image1, Not sure if this is your problem, but those look like backticks around year instead of single quotes. Should there even be quotes there? HTH -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ NOD32 1.1475 (20060406) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Error on SQL Insert
On Friday 07 April 2006 1:56 pm, Chrome wrote: Backticks (`) encapsulate table or database names I was thinking maybe if the array references were encapsulated in curly braces {}: $_POST['model'] to {$_POST['model']} Of course if the field in the DB isn't numeric this would be '{$_POST['model']}' Dan --- http://chrome.me.uk -Original Message- From: Joe Henry [mailto:[EMAIL PROTECTED] Sent: 07 April 2006 20:53 To: php-general@lists.php.net; [EMAIL PROTECTED] Subject: Re: [PHP] Parse Error on SQL Insert On Friday 07 April 2006 1:37 pm, Tom Chubb wrote: $insertSQL = INSERT INTO cars (model, `year`, details, price, image1, Not sure if this is your problem, but those look like backticks around year instead of single quotes. Should there even be quotes there? HTH -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ NOD32 1.1475 (20060406) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com Good to know. Thanks. -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parse Error
Hi all, I am a noob and super confused right now. I have some really simple code and i am getting an error that reads: *Parse error*: syntax error, unexpected T_VARIABLE in */var/www/mysql_up.php* on line here is the code: html headtitleTest MySQL/title/head body !-- mysql_up.php -- ?php $host=localhost $user=ray $password=* mysql_connect($host,$user,$password) ; $sql=show status; $result = mysql_query($sql); if ($result == 0) echo bError . mysql_errno() . : . mysql_error() . /b; else { ? !-- Table That Displays the results -- table border=1 trtdbVariable_name/b/tdtdbValue/b /td/tr ?php for ($i = 0; $i mysql_num_rows($result); $i++) { echo TR; $row_array = mysql_fetch_row($result); for ($j = 0; $j mysql_num_fields(result); $j++) {/ echo TD . $row_array[$j] . /td; } echo /tr; } ? /table ?php } ? /body/html I am really confused because i cannot see any obvious errors. any help would be appreciated. Ray.
RE: [PHP] Parse Error
[snip] I am a noob and super confused right now. I have some really simple code and i am getting an error that reads: *Parse error*: syntax error, unexpected T_VARIABLE in */var/www/mysql_up.php* on line here is the code: html headtitleTest MySQL/title/head body !-- mysql_up.php -- ?php $host=localhost $user=ray $password=* [/snip] Notice anything missing here? Semi-colons at the end of each line. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Error
On Tuesday 21 February 2006 14:27, Ray Cantwell wrote: Hi all, I am a noob and super confused right now. I have some really simple code and i am getting an error that reads: *Parse error*: syntax error, unexpected T_VARIABLE in */var/www/mysql_up.php* on line here is the code: html headtitleTest MySQL/title/head body !-- mysql_up.php -- ?php $host=localhost $user=ray $password=* mysql_connect($host,$user,$password) ; $sql=show status; $result = mysql_query($sql); if ($result == 0) echo bError . mysql_errno() . : . mysql_error() . /b; else { ? !-- Table That Displays the results -- table border=1 trtdbVariable_name/b/tdtdbValue/b /td/tr ?php for ($i = 0; $i mysql_num_rows($result); $i++) { echo TR; $row_array = mysql_fetch_row($result); for ($j = 0; $j mysql_num_fields(result); $j++) {/ echo TD . $row_array[$j] . /td; } echo /tr; } ? /table ?php } ? /body/html I am really confused because i cannot see any obvious errors. any help would be appreciated. Ray. It looks like you need some semi-colons after assigning values to variables at the top of your file. If that's not the problem, let us know what line number this is happening on. It makes it a lot easier to spot the problem ;) -- Ray Hauge Programmer/Systems Administrator American Student Loan Services http://www.americanstudentloan.com 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Error
This one time, at band camp, Ray Cantwell [EMAIL PROTECTED] wrote: ?php $host=localhost $user=ray $password=* these need to be terminated with ; $host = 'localhost'; etc etc Kevin -- Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Error
Hi, you need to finish every line with ; $host=localhost ; $user=ray ; $password=* ; Bye Ray Cantwell wrote: Hi all, I am a noob and super confused right now. I have some really simple code and i am getting an error that reads: *Parse error*: syntax error, unexpected T_VARIABLE in */var/www/mysql_up.php* on line here is the code: html headtitleTest MySQL/title/head body !-- mysql_up.php -- ?php $host=localhost ; $user=ray ; $password=* ; mysql_connect($host,$user,$password) ; $sql=show status; $result = mysql_query($sql); if ($result == 0) echo bError . mysql_errno() . : . mysql_error() . /b; else { ? !-- Table That Displays the results -- table border=1 trtdbVariable_name/b/tdtdbValue/b /td/tr ?php for ($i = 0; $i mysql_num_rows($result); $i++) { echo TR; $row_array = mysql_fetch_row($result); for ($j = 0; $j mysql_num_fields(result); $j++) {/ echo TD . $row_array[$j] . /td; } echo /tr; } ? /table ?php } ? /body/html I am really confused because i cannot see any obvious errors. any help would be appreciated. Ray.
Re: [PHP] Parse Error
Jay Blanchard wrote: [snip] I am a noob and super confused right now. I have some really simple code and i am getting an error that reads: *Parse error*: syntax error, unexpected T_VARIABLE in */var/www/mysql_up.php* on line here is the code: html headtitleTest MySQL/title/head body !-- mysql_up.php -- ?php $host=localhost $user=ray $password=* [/snip] Notice anything missing here? Semi-colons at the end of each line. Thanks. did i say i was a n00b? :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Error
Ray Cantwell wrote: Hi all, I am a noob and super confused right now. I have some really simple code and i am getting an error that reads: *Parse error*: syntax error, unexpected T_VARIABLE in */var/www/mysql_up.php* on line here is the code: html headtitleTest MySQL/title/head body !-- mysql_up.php -- ?php $host=localhost $user=ray $password=* snip Terminate your php lines with a semi-colon ';' -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Error
- Original Message - From: Ray Cantwell [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Tuesday, February 21, 2006 1:27 PM Subject: [PHP] Parse Error Hi all, I am a noob and super confused right now. I have some really simple code and i am getting an error that reads: *Parse error*: syntax error, unexpected T_VARIABLE in */var/www/mysql_up.php* on line here is the code: html headtitleTest MySQL/title/head body !-- mysql_up.php -- ?php $host=localhost $user=ray $password=* mysql_connect($host,$user,$password) ; $sql=show status; $result = mysql_query($sql); if ($result == 0) echo bError . mysql_errno() . : . mysql_error() . /b; else { ? !-- Table That Displays the results -- table border=1 trtdbVariable_name/b/tdtdbValue/b /td/tr ?php for ($i = 0; $i mysql_num_rows($result); $i++) { echo TR; $row_array = mysql_fetch_row($result); for ($j = 0; $j mysql_num_fields(result); $j++) {/ echo TD . $row_array[$j] . /td; } echo /tr; } ? /table ?php } ? /body/html I am really confused because i cannot see any obvious errors. any help would be appreciated. Ray. you need to add a ; to every variable you assign... you had: $host=localhost $user=ray $password=* it should be: $host=localhost; $user=ray; $password=*; also i belive a better way to get the result of your query would be mysql_connect($host, $user, $pass) or die(mysql_error()); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Parse Error
[snip] for ($j = 0; $j mysql_num_fields(result); $j++) [/snip] need to change this as well (forgot a $). should be: for ($j = 0; $j mysql_num_fields($result); $j++) -Original Message- From: John Nichel [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 21, 2006 1:34 PM To: php-general@lists.php.net Subject: Re: [PHP] Parse Error Ray Cantwell wrote: Hi all, I am a noob and super confused right now. I have some really simple code and i am getting an error that reads: *Parse error*: syntax error, unexpected T_VARIABLE in */var/www/mysql_up.php* on line here is the code: html headtitleTest MySQL/title/head body !-- mysql_up.php -- ?php $host=localhost $user=ray $password=* snip Terminate your php lines with a semi-colon ';' -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parse error: parse error, unexpected T_ELSE
Hi All, again, I'm following an example from webmonkey, http://webmonkey.wired.com/webmonkey/99/21/index3a_page2.html?tw=programming and I'm changing only what's relevant to me. I haven't altered the code basics, though. But I get the error regarding else. I don't see what it is. Anyone..? Cheers. Mark Sargent. *Parse error*: parse error, unexpected T_ELSE in */var/www/html/phpmysqltable.php* on line *41* 25 if ($myrow = mysql_fetch_array($result)); { 26 27 echo table border=1\n; 28 29 echo trtdProduct Name/tdtdProduct Model Number/tdtdProduct 30 Serial Number/td/tr\n; 31 32 do { 33 34 printf(trtd%s/tdtd%s/tdtd%s/td/tr\n, $myrow[product_name], $myrow[product_model_number], 35 $myrow[product_serial_number]); 36 37 } while ($myrow = mysql_fetch_array($result)); 38 39 echo /table\n; 40 41 } else { 42 43 echo Sorry, no data is available for that request; 44 45 } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse error: parse error, unexpected T_ELSE
Mark, Back to basics budy!! 25 if ($myrow = mysql_fetch_array($result)); { should be 25 if ($myrow = mysql_fetch_array($result)) { Note that extra semicolon? Prathap -- Original Message --- From: Mark Sargent [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Tue, 26 Apr 2005 16:01:24 +0900 Subject: [PHP] Parse error: parse error, unexpected T_ELSE Hi All, again, I'm following an example from webmonkey, http://webmonkey.wired.com/webmonkey/99/21/index3a_page2.html?tw=programming and I'm changing only what's relevant to me. I haven't altered the code basics, though. But I get the error regarding else. I don't see what it is. Anyone..? Cheers. Mark Sargent. *Parse error*: parse error, unexpected T_ELSE in */var/www/html/phpmysqltable.php* on line *41* 25 if ($myrow = mysql_fetch_array($result)); { 26 27 echo table border=1\n; 28 29 echo trtdProduct Name/tdtdProduct Model Number/tdtdProduct 30 Serial Number/td/tr\n; 31 32 do { 33 34 printf(trtd%s/tdtd%s/tdtd%s/td/tr\n, $myrow[product_name], $myrow[product_model_number], 35 $myrow[product_serial_number]); 36 37 } while ($myrow = mysql_fetch_array($result)); 38 39 echo /table\n; 40 41 } else { 42 43 echo Sorry, no data is available for that request; 44 45 } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- End of Original Message --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse error: parse error, unexpected T_ELSE
Prathaban Mookiah wrote: Mark, Back to basics budy!! 25 if ($myrow = mysql_fetch_array($result)); { should be 25 if ($myrow = mysql_fetch_array($result)) { Note that extra semicolon? Prathap -- Original Message --- From: Mark Sargent [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Tue, 26 Apr 2005 16:01:24 +0900 Subject: [PHP] Parse error: parse error, unexpected T_ELSE Hi All, again, I'm following an example from webmonkey, http://webmonkey.wired.com/webmonkey/99/21/index3a_page2.html?tw=programming and I'm changing only what's relevant to me. I haven't altered the code basics, though. But I get the error regarding else. I don't see what it is. Anyone..? Cheers. Mark Sargent. *Parse error*: parse error, unexpected T_ELSE in */var/www/html/phpmysqltable.php* on line *41* 25 if ($myrow = mysql_fetch_array($result)); { 26 27 echo table border=1\n; 28 29 echo trtdProduct Name/tdtdProduct Model Number/tdtdProduct 30 Serial Number/td/tr\n; 31 32 do { 33 34 printf(trtd%s/tdtd%s/tdtd%s/td/tr\n, $myrow[product_name], $myrow[product_model_number], 35 $myrow[product_serial_number]); 36 37 } while ($myrow = mysql_fetch_array($result)); 38 39 echo /table\n; 40 41 } else { 42 43 echo Sorry, no data is available for that request; 44 45 } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- End of Original Message --- Hi All, yep, basics are good, hence my following the tut at webmonkey(so I can learn the basics), and I obviously missed that little error. Cheers. P.S. Some people are mailig me direct. That's great, but, I'd prefer you reply in here, so all can see/comment. Cheers, again. Mark Sargent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse error: parse error, unexpected T_ELSE
On Tuesday 26 April 2005 11:10, Mark Sargent wrote: Prathaban Mookiah wrote: Mark, Back to basics budy!! 25 if ($myrow = mysql_fetch_array($result)); { should be 25 if ($myrow = mysql_fetch_array($result)) { Note that extra semicolon? Prathap -- Original Message --- From: Mark Sargent [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Tue, 26 Apr 2005 16:01:24 +0900 Subject: [PHP] Parse error: parse error, unexpected T_ELSE Hi All, again, I'm following an example from webmonkey, http://webmonkey.wired.com/webmonkey/99/21/index3a_page2.html?tw=programm ing and I'm changing only what's relevant to me. I haven't altered the code basics, though. But I get the error regarding else. I don't see what it is. Anyone..? Cheers. Mark Sargent. *Parse error*: parse error, unexpected T_ELSE in */var/www/html/phpmysqltable.php* on line *41* 25 if ($myrow = mysql_fetch_array($result)); { 26 27 echo table border=1\n; 28 29 echo trtdProduct Name/tdtdProduct Model Number/tdtdProduct 30 Serial Number/td/tr\n; 31 32 do { 33 34 printf(trtd%s/tdtd%s/tdtd%s/td/tr\n, $myrow[product_name], $myrow[product_model_number], 35 $myrow[product_serial_number]); 36 37 } while ($myrow = mysql_fetch_array($result)); 38 39 echo /table\n; 40 41 } else { 42 43 echo Sorry, no data is available for that request; 44 45 } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- End of Original Message --- Hi All, yep, basics are good, hence my following the tut at webmonkey(so I can learn the basics), and I obviously missed that little error. Cheers. P.S. Some people are mailig me direct. That's great, but, I'd prefer you reply in here, so all can see/comment. Cheers, again. Some people have intelligent mail agents that rely on mailing list headers. And since you use Reply-To header that's not been overwritten by the mainling-list daemon, we replied (me too) directly to you. Remove the Reply-To and you'll have no worries. Mark Sargent. -- Cyberly yours, Petar Nedyalkov Devoted Orbitel Fan :-) PGP ID: 7AE45436 PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436 pgpiM6dmv3CQl.pgp Description: PGP signature
Re: [PHP] parse error, unexpected T_CLASS
Dasmeet Singh wrote: ... Get some decent editor with syntax highlighting ditto. :-) Thanks.. That was really silly.. BTW.. pls suggest some good editor.. I use notepad currently.. OFFS. http://www.php-editors.com/ http://www.google.com/search?hl=enlr=q=good+editor+for+phpbtnG=Search choose one. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] parse error, unexpected T_CLASS
On 4/20/05, Jochem Maas [EMAIL PROTECTED] wrote: Dasmeet Singh wrote: BTW.. pls suggest some good editor.. I use notepad currently.. http://www.php-editors.com/ http://www.google.com/search?hl=enlr=q=good+editor+for+phpbtnG=Search choose one. This can take a long time, I know. My favorite by far on Windows is Crimson Editor (also free as in beer). http://www.crimsoneditor.com/ -KB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] parse error, unexpected T_CLASS
Hi! When i try to run the following line: echo (div class=pmini h1 $row[1] /h1 p Location- $row[4] br Property Type- $ptypebrMin Price- $row[9] /div); it gives an error.. Parse error: parse error, unexpected T_CLASS in /home/real/public_html/functions.php on line 162 Any idea..why? Probably any stupid mistake .. :( - Free Website Promotion - A Complete Guide http://hostwindow.info/web-hosting/9/free-website-promotion/1/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] parse error, unexpected T_CLASS
Dasmeet Singh wrote: Hi! When i try to run the following line: echo (div class=pmini h1 $row[1] /h1 p Location- $row[4] br Property Type- $ptypebrMin Price- $row[9] /div); The above line is fine. Check the lines above. it gives an error.. Parse error: parse error, unexpected T_CLASS in /home/real/public_html/functions.php on line 162 Any idea..why? Probably any stupid mistake .. :( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] parse error, unexpected T_CLASS
[snip] echo (div class=pmini h1 $row[1] /h1 p Location- $row[4] br Property Type- $ptypebrMin Price- $row[9] /div); it gives an error.. Parse error: parse error, unexpected T_CLASS in /home/real/public_html/functions.php on line 162 Any idea..why? Probably any stupid mistake .. :( [/snip] Takes the parentheses out. echo div class=pmini h1 $row[1] /h1 p Location- $row[4] br Property Type- $ptypebrMin Price- $row[9] /div; From http://www.php.net/echo echo() is not actually a function (it is a language construct) so you are not required to use parentheses with it. In fact, if you want to pass more than one parameter to echo, you must not enclose the parameters within parentheses. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] parse error, unexpected T_CLASS
Jay Blanchard wrote: [snip] echo (div class=pmini h1 $row[1] /h1 p Location- $row[4] br Property Type- $ptypebrMin Price- $row[9] /div); it gives an error.. Parse error: parse error, unexpected T_CLASS in /home/real/public_html/functions.php on line 162 Any idea..why? Probably any stupid mistake .. :( [/snip] Takes the parentheses out. echo div class=pmini h1 $row[1] /h1 p Location- $row[4] br Property Type- $ptypebrMin Price- $row[9] /div; From http://www.php.net/echo echo() is not actually a function (it is a language construct) so you are not required to use parentheses with it. In fact, if you want to pass more than one parameter to echo, you must not enclose the parameters within parentheses. Removed the ()..still the same error :(.. am copying complete function..if its because of something else... function showProperty($filter, $by, $value) { if($filter==true) { $query=SELECT * FROM `Property` WHERE .$by. = '.$value.' ORDER BY DateAdded DESC; } else { $query=SELECT * FROM `Property`ORDER BY DateAdded DESC; } $result=db_query($query); while($row=mysql_fetch_row($result)) { $ptype= getName('propertyTypes', 'id', $row[8] , 'Name'); echo div class=pmini h1 $row[1] /h1 p Location- $row[4] br Property Type- $ptypebrMin Price- $row[9] /div; } } - Free Website Promotion - A Complete Guide http://hostwindow.info/web-hosting/9/free-website-promotion/1/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] parse error, unexpected T_CLASS
Dasmeet Singh wrote: Jay Blanchard wrote: [snip] echo (div class=pmini h1 $row[1] /h1 p Location- $row[4] br Property Type- $ptypebrMin Price- $row[9] /div); it gives an error.. Parse error: parse error, unexpected T_CLASS in /home/real/public_html/functions.php on line 162 Any idea..why? Probably any stupid mistake .. :( [/snip] Takes the parentheses out. echo div class=pmini h1 $row[1] /h1 p Location- $row[4] br Property Type- $ptypebrMin Price- $row[9] /div; From http://www.php.net/echo echo() is not actually a function (it is a language construct) so you are not required to use parentheses with it. In fact, if you want to pass more than one parameter to echo, you must not enclose the parameters within parentheses. Removed the ()..still the same error :(.. am copying complete function..if its because of something else... function showProperty($filter, $by, $value) { if($filter==true) { $query=SELECT * FROM `Property` WHERE .$by. = '.$value.' ORDER BY DateAdded DESC; } else { $query=SELECT * FROM `Property`ORDER BY DateAdded DESC; ^ missing double quote. Get some decent editor with syntax highlighting -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] parse error, unexpected T_CLASS
Marek Kilimajer wrote: Dasmeet Singh wrote: Jay Blanchard wrote: [snip] echo (div class=pmini h1 $row[1] /h1 p Location- $row[4] br Property Type- $ptypebrMin Price- $row[9] /div); it gives an error.. Parse error: parse error, unexpected T_CLASS in /home/real/public_html/functions.php on line 162 Any idea..why? Probably any stupid mistake .. :( [/snip] Takes the parentheses out. echo div class=pmini h1 $row[1] /h1 p Location- $row[4] br Property Type- $ptypebrMin Price- $row[9] /div; From http://www.php.net/echo echo() is not actually a function (it is a language construct) so you are not required to use parentheses with it. In fact, if you want to pass more than one parameter to echo, you must not enclose the parameters within parentheses. Removed the ()..still the same error :(.. am copying complete function..if its because of something else... function showProperty($filter, $by, $value) { if($filter==true) { $query=SELECT * FROM `Property` WHERE .$by. = '.$value.' ORDER BY DateAdded DESC; } else { $query=SELECT * FROM `Property`ORDER BY DateAdded DESC; ^ missing double quote. Get some decent editor with syntax highlighting Thanks.. That was really silly.. BTW.. pls suggest some good editor.. I use notepad currently.. - Free Website Promotion - A Complete Guide http://hostwindow.info/web-hosting/9/free-website-promotion/1/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] parse error, unexpected T_CLASS
Dasmeet Singh wrote: Jay Blanchard wrote: [snip] echo (div class=pmini h1 $row[1] /h1 p Location- $row[4] br Property Type- $ptypebrMin Price- $row[9] /div); it gives an error.. Parse error: parse error, unexpected T_CLASS in /home/real/public_html/functions.php on line 162 Any idea..why? Probably any stupid mistake .. :( [/snip] Takes the parentheses out. echo div class=pmini h1 $row[1] /h1 p Location- $row[4] br Property Type- $ptypebrMin Price- $row[9] /div; From http://www.php.net/echo echo() is not actually a function (it is a language construct) so you are not required to use parentheses with it. In fact, if you want to pass more than one parameter to echo, you must not enclose the parameters within parentheses. Removed the ()..still the same error :(.. am copying complete function..if its because of something else... function showProperty($filter, $by, $value) { if($filter==true) { $query=SELECT * FROM `Property` WHERE .$by. = '.$value.' ORDER BY DateAdded DESC; } else { $query=SELECT * FROM `Property`ORDER BY DateAdded DESC; Missing the ending above. So this line would be: $query=SELECT * FROM `Property`ORDER BY DateAdded DESC; } $result=db_query($query); while($row=mysql_fetch_row($result)) { $ptype= getName('propertyTypes', 'id', $row[8] , 'Name'); echo div class=pmini h1 $row[1] /h1 p Location- $row[4] br PHP thinks this is the ENDING instead of the BEGINNING . So when the parser reaches the text that says div class it is trying to interpret that instead of treating it like a string. Fix the quote error above and all should be fine. Property Type- $ptypebrMin Price- $row[9] /div; } } - Free Website Promotion - A Complete Guide http://hostwindow.info/web-hosting/9/free-website-promotion/1/ -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
[PHP] Parse Error on mysql_query
Hi, I'm beginning to learn PHP/MySQL, i have problem 'parse error' when using 'mysql_query' although it was simple code, like this : = 1 ?php 2 $host = localhost; 3 $user = root; 4 $pass = alpha; 5 $konek = mysql_connect($host,$user,$pass); 6 if (!$konek) { 7 die ('failed'.mysql_error()); 8 } 9 echo 'Connect'; 10 $dbname = testdb; 11 12 $db = mysql_select_db ($dbname,$konek); 13 if (!$db) { 14 die ('not connect'.mysql_error()); 15 } 16 echo 'ok' 17 $query = mysql_query(select * from clients,$konek); 18 ? == Parse error: parse error, expecting `','' or `';'' in d:\www\test\refer1.php on line 17 Can anyone help me to explain this problem Thanks in advance
Re: [PHP] Parse Error on mysql_query
Add a ; to the end of line 16. On Sun, 17 Apr 2005, Bagus Nugroho wrote: Hi, I'm beginning to learn PHP/MySQL, i have problem 'parse error' when using 'mysql_query' although it was simple code, like this : = 1 ?php 2 $host = localhost; 3 $user = root; 4 $pass = alpha; 5 $konek = mysql_connect($host,$user,$pass); 6 if (!$konek) { 7 die ('failed'.mysql_error()); 8 } 9 echo 'Connect'; 10 $dbname = testdb; 11 12 $db = mysql_select_db ($dbname,$konek); 13 if (!$db) { 14 die ('not connect'.mysql_error()); 15 } 16 echo 'ok' 17 $query = mysql_query(select * from clients,$konek); 18 ? == Parse error: parse error, expecting `','' or `';'' in d:\www\test\refer1.php on line 17 Can anyone help me to explain this problem Thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] (SOLVED) Re: [PHP] parse error, unexpected T_ENCAPSED_AND_WHITESPACE
Ok, well the mystery is solved. Earlier in the script, I had used HEREDOC string delimiting to output some html blocks (I feel, asthetically, that HEREDOC is more readable than escaping out to HTML then back into PHP). Somehow, and I'm not sure how, because I don't remember typing the spaces, but somehow, exactly 4 spaces got inserted after each of my heredoc delimiter tokens in my script. Well, PHP isn't, apparently, smart enough to ignore the white space after the delimiter, and decided that the entire rest of my script constituted one large HEREDOC block. I only caught this after putting a copy of my script on my webserver with .phps extension and looking at it, and noticing that after the heredoc, all syntax highlighting stopped. So, I guess even though HEREDOC might be more pleasing to read (imho), it has a nasty class of syntax error that is *very* hard to detect (since it is very hard to 'see' that you have whitespace after the token). Caveat coder. Actually, I think I just figured out where the whitespace came from. My text editor has a feature, normally usefull, to do automatic indenting when you start a new line of code. I think it indented the cursor 4 spaces, and I hit 'home' and typed the delimiting token, and forgot about the whitespace at the end (normally, whitespace is ignored/collapsed by the parser). Jeff Schmidt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] parse error, unexpected T_ENCAPSED_AND_WHITESPACE
Hello, I've made the source available at: http://www.weldingconsultants.com/wcapp/admin.phps Chris W. Parker wrote: print 'tdinput type=\'checkbox\' name=\'status[' . $row[profileID] . ']' . ' value='true'//td\n; Very likely the problem is not on line 82, but rather before it. Line 82 is just where the PHP parser finally gets screwed up. Yeah, that is what I was thinking too. But I can't find what the problem is earlier in the file. *sigh* $profID = $row[profileID]; print 'tdinput type=\'checkbox\' name=\'status[' . $profID . ']' . ' value='true'//td\n; When I had done that, the parser started choking at the top line. I suggest the following: (The HTML should all be on one line.) echo tdinput type=\checkbox\ name=\status[{$row['profileID']}]\ value=\true\ //td; I'll do that, simply because it is a little clearer to read, but I don't think the problem actually has to do with my string delimeters and escaping. For one thing, as I mentioned, the problem seems to be with $row[profileID], based upon the fact that I moved that out onto a line basically by itself, and the parser error 'moved' to that line. Please don't send attachments to a public mailing list. Besides, I don't think they go through anyway. Ok, I'll just post links in the future. I just thought it would be more convenient to attach it, but I can link, that's no problem. Also, from your followup: Ohh .. and if i read it more fully the first time I would have seen that you've got some funky in/out quoting problems and that you're not escaping the quotes wrapping 'true'. If you go back and look again, I don't need the single-quotes wrapping 'true' to be escaped, because that chunk of the string is wrapped in double-quotes. Yeah, I know, it's confusing lol. One of the problems of using PHP to print html, unfortunately. Well, part of the reason I have the string construction set up so strangely, is that I was testing out to see if certain things were causing problems. Originally I had it setup more like how you suggested. I only changed it to test some theories out about what might be causing the parser error. Jeff Schmidt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] parse error, unexpected T_ENCAPSED_AND_WHITESPACE
Jeff Schmidt wrote: Hello, I've made the source available at: http://www.weldingconsultants.com/wcapp/admin.phps 404 error when I just tried. -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
Re: [PHP] parse error, unexpected T_ENCAPSED_AND_WHITESPACE
Hello, Sorry about that. I took the source down after I solved the problem. The problem was a nasty type of syntax error caused by PHP implementation of HEREDOC string delimiting. I was using HEREDOC to stuff multiple lines of HTML into a string, in several places in my file, which is all fine and good. However, PHP does not recognize the delimiter token that marks the end of the string, if there is any whitespace on the same line. I had made sure that my token was all the way over to the beginning of the line, but what I *didn't* realize was that there was a couple spaces after the token. This caused the parser to basically treat the whole rest of the script file as a heredoc string, which is where the problems came from. Jeff Schmidt Jason Barnett wrote: Jeff Schmidt wrote: Hello, I've made the source available at: http://www.weldingconsultants.com/wcapp/admin.phps 404 error when I just tried. -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] parse error, unexpected T_ENCAPSED_AND_WHITESPACE
Hello, I'm beating my head, and can't figure out *WHY* PHP is giving me this error. The full error text is: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /hsphere/local/home/welding/weldingconsultants.com/wcapp/admin.php on line 82 Line 82 is: print 'tdinput type=\'checkbox\' name=\'status[' . $row[profileID] . ']' . ' value='true'//td\n; The problem seems to have something to do with the construct $row[profileID] - I say this, because I pulled that out into a seperate line before this, at one point, just to test, and assigned it to a variable, and put the variable in place of the array access. That is, to test, at one point, my file had: $profID = $row[profileID]; print 'tdinput type=\'checkbox\' name=\'status[' . $profID . ']' . ' value='true'//td\n; When I had done that, the parser started choking at the top line. I've attached the full file, to see the context that this is in. Can *anyone* explain this error? It's completely breaking my script. I suspect, that the *real* error is somewhere earlier in the file, but I've read through it 20 times and just can't find anything out of place (can't find any obvious syntax errors, for example). Thanks for any help you can give me, Jeff Schmidt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] parse error, unexpected T_ENCAPSED_AND_WHITESPACE
Jeff Schmidt mailto:[EMAIL PROTECTED] on Monday, March 14, 2005 2:58 PM said: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /hsphere/local/home/welding/weldingconsultants.com/wcapp/admin.php on line 82 Line 82 is: print 'tdinput type=\'checkbox\' name=\'status[' . $row[profileID] . ']' . ' value='true'//td\n; Very likely the problem is not on line 82, but rather before it. Line 82 is just where the PHP parser finally gets screwed up. $profID = $row[profileID]; print 'tdinput type=\'checkbox\' name=\'status[' . $profID . ']' . ' value='true'//td\n; When I had done that, the parser started choking at the top line. I suggest the following: (The HTML should all be on one line.) echo tdinput type=\checkbox\ name=\status[{$row['profileID']}]\ value=\true\ //td; I've attached the full file, to see the context that this is in. Please don't send attachments to a public mailing list. Besides, I don't think they go through anyway. Can *anyone* explain this error? It's completely breaking my script. I suspect, that the *real* error is somewhere earlier in the file, but I've read through it 20 times and just can't find anything out of place (can't find any obvious syntax errors, for example). Post the file to a web server somewhere in plain text. Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] parse error, unexpected T_ENCAPSED_AND_WHITESPACE
Chris W. Parker on Monday, March 14, 2005 3:15 PM said: Line 82 is: print 'tdinput type=\'checkbox\' name=\'status[' . $row[profileID] . ']' . ' value='true'//td\n; Very likely the problem is not on line 82, but rather before it. Line 82 is just where the PHP parser finally gets screwed up. Ohh .. and if i read it more fully the first time I would have seen that you've got some funky in/out quoting problems and that you're not escaping the quotes wrapping 'true'. :) Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] parse error, unexpected T_ENCAPSED_AND_WHITESPACE
Chris W. Parker wrote: Chris W. Parker on Monday, March 14, 2005 3:15 PM said: Line 82 is: print 'tdinput type=\'checkbox\' name=\'status[' . $row[profileID] . ']' . ' value='true'//td\n; Very likely the problem is not on line 82, but rather before it. Line 82 is just where the PHP parser finally gets screwed up. Ohh .. and if i read it more fully the first time I would have seen that you've got some funky in/out quoting problems and that you're not escaping the quotes wrapping 'true'. :) Chris. that's because he's using single quotes for his value there, and double quotes to denote it being a string in that last part... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] parse error, unexpected T_ENCAPSED_AND_WHITESPACE
Chris W. Parker wrote: Chris W. Parker on Monday, March 14, 2005 3:15 PM said: Line 82 is: print 'tdinput type=\'checkbox\' name=\'status[' . $row[profileID] . ']' . ' value='true'//td\n; Very likely the problem is not on line 82, but rather before it. Line 82 is just where the PHP parser finally gets screwed up. Ohh .. and if i read it more fully the first time I would have seen that you've got some funky in/out quoting problems and that you're not escaping the quotes wrapping 'true'. :) Quotes look ok to me? God bless VIM (even on this old windows box) :) In any case Chris' original suggestion is probably right... it's likely that the last place you used quotes *before* line 82 is missing a closing quote. -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
Re: [PHP] parse error, unexpected T_ENCAPSED_AND_WHITESPACE
On Monday 14 March 2005 06:22 pm, Chris W. Parker wrote: Chris W. Parker on Monday, March 14, 2005 3:15 PM said: Line 82 is: print 'tdinput type=\'checkbox\' name=\'status[' . ^^ should be a slash?? $row[profileID] . ']' . ' value='true'//td\n; Very likely the problem is not on line 82, but rather before it. Line 82 is just where the PHP parser finally gets screwed up. Ohh .. and if i read it more fully the first time I would have seen that you've got some funky in/out quoting problems and that you're not escaping the quotes wrapping 'true'. :) Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] parse error, unexpected T_ENCAPSED_AND_WHITESPACE
Jason Barnett mailto:[EMAIL PROTECTED] on Monday, March 14, 2005 3:57 PM said: Chris W. Parker wrote: Chris W. Parker on Monday, March 14, 2005 3:15 PM said: Line 82 is: print 'tdinput type=\'checkbox\' name=\'status[' . $row[profileID] . ']' . ' value='true'//td\n; Very likely the problem is not on line 82, but rather before it. Line 82 is just where the PHP parser finally gets screwed up. Ohh .. and if i read it more fully the first time I would have seen that you've got some funky in/out quoting problems and that you're not escaping the quotes wrapping 'true'. :) Quotes look ok to me? God bless VIM (even on this old windows box) :) I realized my mistake about two seconds after I'd send and decided not to reply to myself twice. :( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] parse error, unexpected T_ENCAPSED_AND_WHITESPACE
Why not make it simple?: // end PHP code ? tdinput type='checkbox' name='status[? echo $row['profileID']; ?]' value='true'/td ? // continue PHP code Dan T On Mar 14, 2005, at 3:58 PM, Jeff Schmidt wrote: Hello, I'm beating my head, and can't figure out *WHY* PHP is giving me this error. The full error text is: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /hsphere/local/home/welding/weldingconsultants.com/wcapp/admin.php on line 82 Line 82 is: print 'tdinput type=\'checkbox\' name=\'status[' . $row[profileID] . ']' . ' value='true'//td\n; The problem seems to have something to do with the construct $row[profileID] - I say this, because I pulled that out into a seperate line before this, at one point, just to test, and assigned it to a variable, and put the variable in place of the array access. That is, to test, at one point, my file had: $profID = $row[profileID]; print 'tdinput type=\'checkbox\' name=\'status[' . $profID . ']' . ' value='true'//td\n; When I had done that, the parser started choking at the top line. I've attached the full file, to see the context that this is in. Can *anyone* explain this error? It's completely breaking my script. I suspect, that the *real* error is somewhere earlier in the file, but I've read through it 20 times and just can't find anything out of place (can't find any obvious syntax errors, for example). Thanks for any help you can give me, Jeff Schmidt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Parse Error... how to fix?
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 16 December 2004 17:39, GH wrote: Hi All... Got a problem... here is the error: Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /var/www/html/ahrc_computerclub/ahrc_computerclub.php on line 42... I am not sure on how to fix it... line 42 is: TITLE $language['program_name'] /TITLE\n . TITLE {$language['program_name']} /TITLE\n . But: function printHeader(){ echo !DOCTYPE HTML PUBLIC \-//W3C//DTD HTML 4.0 Transitional//EN\\n . \http://www.w3.org/TR/REC-html40/loose.dtd\;HTML\n . HEAD\n . meta name=\description\ content=\\ \n . meta name=\author\ content=\Gary H\\n . meta name=\keywords\ content=\\ \n . meta http-equiv=\Content-Type\ content=\text/html; charset=iso-8859-1\\n . TITLE $language['program_name'] /TITLE\n . /HEAD\n. BODY\n; This is messy and somewhat unreadable. I would suggest either a heredoc: function printHeader(){ echo HEAD !DOCTYPE HTML PUBLIC \-//W3C//DTD HTML 4.0 Transitional//EN http://www.w3.org/TR/REC-html40/loose.dtd\; HTML HEAD meta name=description content= meta name=author content=Gary H meta name=keywords content= meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 TITLE {$language['program_name']} /TITLE /HEAD BODY HEAD; } or escaping from PHP into raw HTML: function printHeader(){ ? !DOCTYPE HTML PUBLIC \-//W3C//DTD HTML 4.0 Transitional//EN http://www.w3.org/TR/REC-html40/loose.dtd\; HTML HEAD meta name=description content= meta name=author content=Gary H meta name=keywords content= meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 TITLE ?php echo $language['program_name'] ? /TITLE /HEAD BODY ?php } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Error... how to fix?
I will try this when i get back to my other computer where development takes place the script format was originally started by an IDE that I am starting to add my code to ... so I will look at. On Thu, 16 Dec 2004 18:19:43 -, Ford, Mike [EMAIL PROTECTED] wrote: To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 16 December 2004 17:39, GH wrote: Hi All... Got a problem... here is the error: Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /var/www/html/ahrc_computerclub/ahrc_computerclub.php on line 42... I am not sure on how to fix it... line 42 is: TITLE $language['program_name'] /TITLE\n . TITLE {$language['program_name']} /TITLE\n . But: function printHeader(){ echo !DOCTYPE HTML PUBLIC \-//W3C//DTD HTML 4.0 Transitional//EN\\n . \http://www.w3.org/TR/REC-html40/loose.dtd\;HTML\n . HEAD\n . meta name=\description\ content=\\ \n . meta name=\author\ content=\Gary H\\n . meta name=\keywords\ content=\\ \n . meta http-equiv=\Content-Type\ content=\text/html; charset=iso-8859-1\\n . TITLE $language['program_name'] /TITLE\n . /HEAD\n. BODY\n; This is messy and somewhat unreadable. I would suggest either a heredoc: function printHeader(){ echo HEAD !DOCTYPE HTML PUBLIC \-//W3C//DTD HTML 4.0 Transitional//EN http://www.w3.org/TR/REC-html40/loose.dtd\; HTML HEAD meta name=description content= meta name=author content=Gary H meta name=keywords content= meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 TITLE {$language['program_name']} /TITLE /HEAD BODY HEAD; } or escaping from PHP into raw HTML: function printHeader(){ ? !DOCTYPE HTML PUBLIC \-//W3C//DTD HTML 4.0 Transitional//EN http://www.w3.org/TR/REC-html40/loose.dtd\; HTML HEAD meta name=description content= meta name=author content=Gary H meta name=keywords content= meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 TITLE ?php echo $language['program_name'] ? /TITLE /HEAD BODY ?php } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Error... how to fix?
line 42 is: TITLE $language['program_name'] /TITLE\n . Try: 'TITLE'.$language['program_name'].'/TITLE' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Error... how to fix?
GH wrote: Got a problem... here is the error: Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /var/www/html/ahrc_computerclub/ahrc_computerclub.php on line 42... I am not sure on how to fix it... line 42 is: TITLE $language['program_name'] /TITLE\n . echo !DOCTYPE HTML PUBLIC \-//W3C//DTD HTML 4.0 Transitional//EN\\n . TITLE $language['program_name'] /TITLE\n . #1. Get rid of the ''s around program_name. Those won't work inside of s. #2. Re-read the PHP on-line manual section on strings. #3. Just break out of PHP for anything more than two lines of HTML. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Error... how to fix?
GH wrote: Hi All... Got a problem... here is the error: Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /var/www/html/ahrc_computerclub/ahrc_computerclub.php on line 42... I am not sure on how to fix it... line 42 is: TITLE $language['program_name'] /TITLE\n . The language.php file only has: $language['program_name'] = AHRC Computer Club Program Leader Information Managment; Thank you for any and all assistance provided This is the entire ahrc_computerclub.php file: ?PHP #AHRC Program Leader Information Management# #Copyright (C) 2004 by Gary H # #EMAIL INFORMATION HERE # # This project is intended for Gary's use only and not to be distributed # # include language file include_once(language.php); # DOCUMENT OUTPUT ##START # printHeader(); echo $language['program_name']; printFooter(); # DOCUMENT OUTPUT ##END # # FUNCTION DEFINITIONS SECTION# function printVersion(){ $version = 0.1; return $version; } function printHeader(){ echo !DOCTYPE HTML PUBLIC \-//W3C//DTD HTML 4.0 Transitional//EN\\n . \http://www.w3.org/TR/REC-html40/loose.dtd\;HTML\n . HEAD\n . meta name=\description\ content=\\ \n . meta name=\author\ content=\Gary H\\n . meta name=\keywords\ content=\\ \n . meta http-equiv=\Content-Type\ content=\text/html; charset=iso-8859-1\\n . TITLE $language['program_name'] /TITLE\n . /HEAD\n. BODY\n; } function printFooter(){ echo \n/BODY/HTML; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Error... how to fix?
Hi All... Got a problem... here is the error: Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /var/www/html/ahrc_computerclub/ahrc_computerclub.php on line 42... I am not sure on how to fix it... line 42 is: TITLE $language['program_name'] /TITLE\n . Try: echo TITLE.$language['program_name']./TITLE\n; You need to concatenate your array. -- --Matthew Sims --http://killermookie.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] Parse Error... how to fix?
You are inside a function and not either passing the variable to the function or declaring it global within the function. In other words, as far as your function is concerned, the $language['program_name'] is empty. From: GH [EMAIL PROTECTED] Date: 2004/12/16 Thu PM 01:09:48 EST To: Marek Kilimajer [EMAIL PROTECTED] CC: php-general [EMAIL PROTECTED] Subject: Re: [PHP] Parse Error... how to fix? However, I can not get any results into the title tags all three options are not displaying On Thu, 16 Dec 2004 13:03:57 -0500, GH [EMAIL PROTECTED] wrote: Ok... thank you. On Thu, 16 Dec 2004 19:02:37 +0100, Marek Kilimajer [EMAIL PROTECTED] wrote: GH wrote: Hi All... Got a problem... here is the error: Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /var/www/html/ahrc_computerclub/ahrc_computerclub.php on line 42... I am not sure on how to fix it... line 42 is: TITLE $language['program_name'] /TITLE\n . either one: 1. TITLE $language[program_name] /TITLE\n . 2. TITLE {$language['program_name']} /TITLE\n . 3. TITLE . $language['program_name'] . /TITLE\n . -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Error... how to fix?
GH wrote: However, I can not get any results into the title tags all three options are not displaying $language is in global scope, you need: function printHeader(){ global $language; More: http://sk2.php.net/manual/en/language.variables.scope.php On Thu, 16 Dec 2004 13:03:57 -0500, GH [EMAIL PROTECTED] wrote: Ok... thank you. On Thu, 16 Dec 2004 19:02:37 +0100, Marek Kilimajer [EMAIL PROTECTED] wrote: GH wrote: Hi All... Got a problem... here is the error: Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /var/www/html/ahrc_computerclub/ahrc_computerclub.php on line 42... I am not sure on how to fix it... line 42 is: TITLE $language['program_name'] /TITLE\n . either one: 1. TITLE $language[program_name] /TITLE\n . 2. TITLE {$language['program_name']} /TITLE\n . 3. TITLE . $language['program_name'] . /TITLE\n . -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Parse Error... how to fix?
GH mailto:[EMAIL PROTECTED] on Thursday, December 16, 2004 10:10 AM said: However, I can not get any results into the title tags all three options are not displaying try: ?php echo pre; print_r($language['program_name']); echo /pre; ? If you don't see anything then there's no data in your variable. Thus the problem is not occuring during the outputting but of the data but rather the point at which the data is assigned to the variable. hth, Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Parse Error... how to fix?
Richard Lynch mailto:[EMAIL PROTECTED] on Thursday, December 16, 2004 10:46 AM said: TITLE $language['program_name'] /TITLE\n . #1. Get rid of the ''s around program_name. Those won't work inside of s. echo title{$language['program_name']}/title\n; http://us2.php.net/manual/en/language.types.array.php #3. Just break out of PHP for anything more than two lines of HTML. ...or use heredoc syntax. http://us2.php.net/manual/en/language.types.string.php#language.types.st ring.syntax.heredoc Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Error... how to fix?
Ok... thank you. On Thu, 16 Dec 2004 19:02:37 +0100, Marek Kilimajer [EMAIL PROTECTED] wrote: GH wrote: Hi All... Got a problem... here is the error: Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /var/www/html/ahrc_computerclub/ahrc_computerclub.php on line 42... I am not sure on how to fix it... line 42 is: TITLE $language['program_name'] /TITLE\n . either one: 1. TITLE $language[program_name] /TITLE\n . 2. TITLE {$language['program_name']} /TITLE\n . 3. TITLE . $language['program_name'] . /TITLE\n . -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Error... how to fix?
However, I can not get any results into the title tags all three options are not displaying On Thu, 16 Dec 2004 13:03:57 -0500, GH [EMAIL PROTECTED] wrote: Ok... thank you. On Thu, 16 Dec 2004 19:02:37 +0100, Marek Kilimajer [EMAIL PROTECTED] wrote: GH wrote: Hi All... Got a problem... here is the error: Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /var/www/html/ahrc_computerclub/ahrc_computerclub.php on line 42... I am not sure on how to fix it... line 42 is: TITLE $language['program_name'] /TITLE\n . either one: 1. TITLE $language[program_name] /TITLE\n . 2. TITLE {$language['program_name']} /TITLE\n . 3. TITLE . $language['program_name'] . /TITLE\n . -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parse Error... how to fix?
Hi All... Got a problem... here is the error: Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /var/www/html/ahrc_computerclub/ahrc_computerclub.php on line 42... I am not sure on how to fix it... line 42 is: TITLE $language['program_name'] /TITLE\n . The language.php file only has: $language['program_name'] = AHRC Computer Club Program Leader Information Managment; Thank you for any and all assistance provided This is the entire ahrc_computerclub.php file: ?PHP #AHRC Program Leader Information Management# #Copyright (C) 2004 by Gary H # #EMAIL INFORMATION HERE # # This project is intended for Gary's use only and not to be distributed # # include language file include_once(language.php); # DOCUMENT OUTPUT ##START # printHeader(); echo $language['program_name']; printFooter(); # DOCUMENT OUTPUT ##END # # FUNCTION DEFINITIONS SECTION# function printVersion(){ $version = 0.1; return $version; } function printHeader(){ echo !DOCTYPE HTML PUBLIC \-//W3C//DTD HTML 4.0 Transitional//EN\\n . \http://www.w3.org/TR/REC-html40/loose.dtd\;HTML\n . HEAD\n . meta name=\description\ content=\\ \n . meta name=\author\ content=\Gary H\\n . meta name=\keywords\ content=\\ \n . meta http-equiv=\Content-Type\ content=\text/html; charset=iso-8859-1\\n . TITLE $language['program_name'] /TITLE\n . /HEAD\n. BODY\n; } function printFooter(){ echo \n/BODY/HTML; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PARSE ERROR, unexpected T_$VARIABLE
Parse error: parse error, expecting `T_VARIABLE' or `'$'' in c:\fourh\leadership\registration_post.php on line 29 The HTML page: http://rsossam-lap.ces.ncsu.edu/leadership/registration2.php The processing Script SNIP ?php $fname= $_POST[fname]; $lname= $_POST[lname]; $addie= $_POST[addie]; $city= $_POST[city]; $state= $_POST[state]; $zip= $_POST[zip]; $county= $_POST[county]; $dphone= $_POST[dphone]; $ephone= $_POST[ephone]; $email= $_POST[email]; $first_conf= $_POST[first_conf]; $payment= $_POST[payment]; $PreConference= $_POST['PreConference']; $Conference= $_POST['Conference']; $choices = $_POST['choice']; array_splice($choices,4); $j=1; for ($i=0; $i count($choices); $i++) { $value = $choices[$i]; $tempChoice = choice . $j; $$tempChoice = $value; $j++; } $0405distoffice= $_POST['04_05_dist_office']; //line29 $0506distoffice= $_POST['05_06_dist_office']; $former= $_POST[former]; $achieve= $_POST[achieve]; ? /SNIP I pulled out the iterations above that line of code and tested it separately. Everything worked OK, so I copied it into the rest of the PHP processing. This thing is driving me bonkers. Any suggestions? -- Robert Sossomon, Business and Technology Application Technician 4-H Youth Development Department 200 Ricks Hall, Campus Box 7606 N.C. State University Raleigh NC 27695-7606 Phone: 919/515-8474 Fax: 919/515-7812 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PARSE ERROR, unexpected T_$VARIABLE
you forgot the ' in the $fname= $_POST[fname]; $lname= $_POST[lname]; $addie= $_POST[addie]; $city= $_POST[city]; fields!!! error, expecting `T_VARIABLE' or `'$'' in c:\fourh\leadership\registration_post.php on line 29 The HTML page: http://rsossam-lap.ces.ncsu.edu/leadership/registration2.php The processing Script SNIP ?php $fname= $_POST[fname]; $lname= $_POST[lname]; $addie= $_POST[addie]; $city= $_POST[city]; $state= $_POST[state]; $zip= $_POST[zip]; $county= $_POST[county]; $dphone= $_POST[dphone]; $ephone= $_POST[ephone]; $email= $_POST[email]; $first_conf= $_POST[first_conf]; $payment= $_POST[payment]; $PreConference= $_POST['PreConference']; $Conference= $_POST['Conference']; $choices = $_POST['choice']; array_splice($choices,4); $j=1; for ($i=0; $i count($choices); $i++) { $value = $choices[$i]; $tempChoice = choice . $j; $$tempChoice = $value; $j++; } $0405distoffice= $_POST['04_05_dist_office']; //line29 $0506distoffice= $_POST['05_06_dist_office']; $former= $_POST[former]; $achieve= $_POST[achieve]; ? /SNIP I pulled out the iterations above that line of code and tested it separately. Everything worked OK, so I copied it into the rest of the PHP processing. This thing is driving me bonkers. Any suggestions? -- Robert Sossomon, Business and Technology Application Technician 4-H Youth Development Department 200 Ricks Hall, Campus Box 7606 N.C. State University Raleigh NC 27695-7606 Phone: 919/515-8474 Fax: 919/515-7812 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PARSE ERROR, unexpected T_$VARIABLE
Robert Sossomon wrote: Parse error: parse error, expecting `T_VARIABLE' or `'$'' in c:\fourh\leadership\registration_post.php on line 29 snip $0405distoffice= $_POST['04_05_dist_office']; //line29 $0506distoffice= $_POST['05_06_dist_office']; snip Look in the manual, that's your first stop... http://us4.php.net/manual/en/language.variables.php -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PARSE ERROR, unexpected T_$VARIABLE
Robert Sossomon wrote: Parse error: parse error, expecting `T_VARIABLE' or `'$'' in c:\fourh\leadership\registration_post.php on line 29 [snip] $0405distoffice= $_POST['04_05_dist_office']; //line29 $0506distoffice= $_POST['05_06_dist_office']; Variable names cannot start with a number. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PARSE ERROR, unexpected T_$VARIABLE
Variable names cannot start with a digit. $distoffice0405 is kosher. $0405distoffice is not. Robert Sossomon wrote: Parse error: parse error, expecting `T_VARIABLE' or `'$'' in c:\fourh\leadership\registration_post.php on line 29 The HTML page: http://rsossam-lap.ces.ncsu.edu/leadership/registration2.php The processing Script SNIP ?php $fname= $_POST[fname]; $lname= $_POST[lname]; $addie= $_POST[addie]; $city= $_POST[city]; $state= $_POST[state]; $zip= $_POST[zip]; $county= $_POST[county]; $dphone= $_POST[dphone]; $ephone= $_POST[ephone]; $email= $_POST[email]; $first_conf= $_POST[first_conf]; $payment= $_POST[payment]; $PreConference= $_POST['PreConference']; $Conference= $_POST['Conference']; $choices = $_POST['choice']; array_splice($choices,4); $j=1; for ($i=0; $i count($choices); $i++) { $value = $choices[$i]; $tempChoice = choice . $j; $$tempChoice = $value; $j++; } $0405distoffice= $_POST['04_05_dist_office']; //line29 $0506distoffice= $_POST['05_06_dist_office']; $former= $_POST[former]; $achieve= $_POST[achieve]; ? /SNIP I pulled out the iterations above that line of code and tested it separately. Everything worked OK, so I copied it into the rest of the PHP processing. This thing is driving me bonkers. Any suggestions? -- Robert Sossomon, Business and Technology Application Technician 4-H Youth Development Department 200 Ricks Hall, Campus Box 7606 N.C. State University Raleigh NC 27695-7606 Phone: 919/515-8474 Fax: 919/515-7812 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PARSE ERROR, unexpected T_$VARIABLE
On Mon, 06 Dec 2004 11:54:50 -0500, Robert Sossomon [EMAIL PROTECTED] wrote: Parse error: parse error, expecting `T_VARIABLE' or `'$'' in c:\fourh\leadership\registration_post.php on line 29 for ($i=0; $i count($choices); $i++) This is bad. Every time the for() loop iterates, the count() function gets called again unnecessarily. Better to do: $count = count( $choices ); for ($i=0; $i $count; $i++) { $value = $choices[$i]; $tempChoice = choice . $j; $$tempChoice = $value; $j++; } $0405distoffice= $_POST['04_05_dist_office']; //line29 Variables can contain numbers, but the first character after the $ must not be one. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PARSE ERROR, unexpected T_$VARIABLE
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 06 December 2004 17:23, Greg Donald wrote: On Mon, 06 Dec 2004 11:54:50 -0500, Robert Sossomon [EMAIL PROTECTED] wrote: Parse error: parse error, expecting `T_VARIABLE' or `'$'' in c:\fourh\leadership\registration_post.php on line 29 for ($i=0; $i count($choices); $i++) This is bad. Every time the for() loop iterates, the count() function gets called again unnecessarily. Better to do: $count = count( $choices ); for ($i=0; $i $count; $i++) You can even do (keeping all the loop-related stuff within the for( ) construct): for ($i=0, $count=count($choices); $i $count; $i++) Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse error: parse error, expecting `']'' in
Richard Lynch is quoted as saying on 12/1/2004 2:57 PM: Robert Sossomon wrote: Parse error: parse error, expecting `']'' in file.php SNIP Unfortunately?? I knew exactly where the code was breaking (the lines I posted) since before I added those lines of code the script worked without any problems. But what I don't understand is why sometimes '$_POST[variable]' works and why sometimes it will only work when it is '$_POST['variable']' . Even through my reading and examples I see it both ways, so anyone able to give me a direction to go with it? I am thinking of just changing my coding to put it the second way, but...??? Thanks, Robert -- Robert Sossomon, Business and Technology Application Technician 4-H Youth Development Department 200 Ricks Hall, Campus Box 7606 N.C. State University Raleigh NC 27695-7606 Phone: 919/515-8474 Fax: 919/515-7812 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Parse error: parse error, expecting `']'' in
Hello Robert, Thursday, December 2, 2004, 1:21:33 PM, you wrote: RS Unfortunately?? I knew exactly where the code was breaking (the RS lines I posted) since before I added those lines of code the RS script worked without any problems. But what I don't understand is RS why sometimes '$_POST[variable]' works and why sometimes it will RS only work when it is '$_POST['variable']' . It should always be the second way ($_POST['var']), although the first way *will* work most of the time it was cause PHP to first check to see if 'var' is a defined constant, and then a variable. If it is a constant, it will substitute that value instead which could cause no end of problems. When called with: test.php?a=ab=b the following should print out ab. Remove the quotes from $_GET[a] and you'll see the difference. ?php define(a, b); echo $_GET['a']; echo $_GET['b']; ? Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I am not young enough to know everything. - Oscar Wilde -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Parse error: parse error, expecting `']'' in
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 01 December 2004 19:29, Matthew Sims wrote: So when using arrays with string keys within strings you need to concatenate it. $var = I live in the city of . $_POST['cityname']; No, you do not *need* to -- it is one option, certainly, but there is no necessity about it. Within double-quoted strings, it is perfectly acceptable to use unquoted array keys: $var = I live in the city of $_POST[cityname]; If you prefer to quote your keys, or have more complex expressions within the brackets, there is also the {} syntax: $var = I live in the city of {$_POST['cityname']}; $field = 'city'; $var = I live in the $field of {$_POST[$field.'name']}; Anyway, read up on it. http://uk.php.net/manual/en/language.types.string.php#language.types.string. parsing Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php