NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Argh... hate php... what is with this error mesage???

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
4 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 09-27-2005, 02:04 PM THREAD STARTER               #1 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
Join Date: Jan 2005
Location: UK
Posts: 2,408
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
 



Argh... hate php... what is with this error mesage???


Originally Posted by My PHP Script
Parse error: parse error, unexpected $ in /homepages/43/d121401701/htdocs/beta/search/index.php on line 201
I get this message, athough my script ends exactlly on line 200! What is wrong? Why won't it work!
PoorDoggie is offline  
Old 09-27-2005, 02:11 PM   #2 (permalink)
Senior Member
 
nasaboy007's Avatar
Join Date: Jul 2005
Location: NJ
Posts: 1,219
nasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud of
 



oh lol i used to get the same error. check the syntax on line 200 cuz the error is usually on the line before.

in my case, i was missing a semicolon

try posting the code here so we can see it.
nasaboy007 is offline  
Old 09-27-2005, 02:12 PM   #3 (permalink)
NamePros Regular
Join Date: Aug 2005
Posts: 214
slantednet is on a distinguished road
 



Either (A) Post the contents of the script for review, or (B) Check all instances of "$" in your script to find the errand one, or (C), check the lines starting from 200 going up, sometimes the actual error is a few lines prior to the reported one.
__________________
OnlineGames.net
slantednet is offline  
Old 09-27-2005, 02:13 PM   #4 (permalink)
A Wealth of Knowledge
 
stscac's Avatar
Join Date: Aug 2004
Posts: 3,803
stscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud of
 



You're most likely missing a semi colon on the end of one of your arguments.

Post the code and we'll try to help

-Steve
stscac is offline  
Old 09-27-2005, 02:21 PM   #5 (permalink)
Senior Member
 
legend2's Avatar
Join Date: Sep 2005
Posts: 1,089
legend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud of
 



plain simple, $ shouldn't be used somwehre in that line. mostly, this error comes from a person typing a double $$ by mistake for a variable name, or singling a $ in a statement.
legend2 is offline  
Old 09-27-2005, 02:26 PM   #6 (permalink)
A Wealth of Knowledge
 
stscac's Avatar
Join Date: Aug 2004
Posts: 3,803
stscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud of
 



Originally Posted by legend2
plain simple, $ shouldn't be used somwehre in that line. mostly, this error comes from a person typing a double $$ by mistake for a variable name, or singling a $ in a statement.
This might have been true in another situation, but if you look at the original thread, you will see that their script is only 200 lines long:
????: NamePros.com http://www.namepros.com/programming/127013-argh-hate-php-what-error-mesage.html
Originally Posted by PoorDoggie
Originally Posted by My PHP Script
Parse error: parse error, unexpected $ in /homepages/43/d121401701/htdocs/beta/search/index.php on line 201
I get this message, athough my script ends exactlly on line 200! What is wrong? Why won't it work!
This ultimately means that the coder forgot to end an argument line with the approiate close - ";".
????: NamePros.com http://www.namepros.com/showthread.php?t=127013

PHP Code:
<?
// Example of this error
if 1=={
$true 1
}
else {
$true 2;
}
?>
As you can see, there is no semi colon after;
PHP Code:
$true 
which looks until it finds the end of that line. It searches until the end of the script, and then breaks, and says it could not find the end of the argument, through the whole document.

In this case, PHP would output an error like
Originally Posted by Broken PHP
Parse error: parse error, unexpected $ in /path/to/documenet/on/server/namepros.php on line 8
-Steve
stscac is offline  
Old 09-27-2005, 02:55 PM   #7 (permalink)
Tech Support
Join Date: Mar 2005
Posts: 4,944
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
Meh, for me, it's usually a forgotten ; or } Lol.
Eric is offline  
Old 09-27-2005, 04:56 PM   #8 (permalink)
Account Suspended
 
axilant's Avatar
Join Date: May 2004
Location: /etc/passwd
Posts: 2,178
axilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to behold
 

Member of the Month
July 2005

http://www.programmingdb.com/out.php?id=28

This is a tutorial for Debugging PHP
axilant is offline  
Old 09-28-2005, 10:54 AM THREAD STARTER               #9 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
Join Date: Jan 2005
Location: UK
Posts: 2,408
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
 



here is the php code... sorry about not including it before.

PHP Code:
<?php

// search.php

// ok lets get the variables to start off with:
$q = (isset($HTTP_GET_VARS['q'])) ? $HTTP_GET_VARS['q'] : "";
$q stripslashes($q);
// $country = (isset($HTTP_GET_VARS['c'])) ? $HTTP_GET_VARS['c'] : "";


$title "PoorDoggie - Search";
if(!empty(
$q)){ $title .= " '".stripslashes($q)."'"; }

if(empty(
$q)){
  
header("Location: ../index.php");
}

// lets now connect to the database:
include "../config.php";

$sql "SELECT * FROM pd_shops WHERE MATCH (name, description, keywords) AGAINST ('$q' IN BOOLEAN MODE)";
????: NamePros.com http://www.namepros.com/showthread.php?t=127013

$m 10;
$a = (isset($HTTP_GET_VARS['p'])) ? ($HTTP_GET_VARS['p']-1)*$m 0;
if(isset(
$HTTP_GET_VARS['p'])){
  
$sql .= " LIMIT $a, 10";
}

// $sql = "SELECT * FROM pd_shops WHERE name LIKE '%$q%' OR description LIKE '%$q%' OR keywords LIKE '%$q%' ORDER BY hit_count DESC";

$result mysql_query($sql);

// here is the content variable:
$content '<table class="main" width="700">';

$f 0;
$l 1;

while(
$row mysql_fetch_array($result)){
  
$content .= '<tr><td rowspan="2" valign="top"><a href="clickthru.php?id=';
  
$content .= $row['id'];
  
$content .= '"><img src="';
  
$content .= $row['image'];
  
$content .= '" style="border: 0" alt="';
  
$content .= $row['name'];
  
$content .= '" /></td><td width="100%" valign="top"><a href="clickthru.php?id=';
  
$content .= $row['id'];
  
$content .= '">';
  
$content .= $row['name'];
  
$content .= '</a></td></tr><tr><td valign="top" align="justified">';
//  $content .= substr($row['description'],0,255);
  
$content .= $row['description'];
  
$content .= '...</td></tr><tr><td colspan="2">&nbsp;</td></tr>';
  
$l++;
}

$content .= '</table>';

$sql "SELECT * FROM pd_shops WHERE MATCH (name, description, keywords) AGAINST ('$q' IN BOOLEAN MODE)";

$result mysql_query($sql);

while(
$row mysql_fetch_array($result)){
  if(!empty(
$row['tall_banner'])){
    
$banners[$f] = $row['tall_banner'];
    
$url[$f] = $row['url'];
    
$f++;
  }
}

$i mysql_num_rows($result);

if(
$i 1){
  
$content "<center><span class=\"main\">Your search returned no results.<br /><br />If you are having trouble try cutting your search queries down to 1 word phrases.</span></center>";

if(isset(
$banners[0])){
  
srand((float) microtime() * 10000000);
  
$rand_keys array_rand($banners1);
  
$ad '<a href="';
  
$ad .= $url[$rand_keys];
  
$ad .= '"><img border="0" alt="Click Here!" src="';
  
$ad .= $banners[$rand_keys];
  
$ad .= '" /></a>';
}
else{
  
$ad "";
}

if(
$i 10){
  
$r $a+$m;
  
$t $r-$i;
  if(
0<$t && $t<10){
    
$r $a+($m-$t);
  }
  
$results "Showing $a-$r of $i results";
}
else{
  
$results "Showing $i Results";
}

$p = (isset($HTTP_GET_VARS['p'])) ? $HTTP_GET_VARS['p']++ : "1";

// lets do the page numbers
$nop $i/$m// num of pages total (ish)
$pg 1;
$pages_box '<select name="pages" id="pages" onChange="location.href=\'index.php?q=';
$pages_box .= $q;
$pages_box .= '&p=\'+this.value">';

while(
$nop>$pg){
  
$pages_box .= '<option value="';
  
$pages_box .= $pg;
  
$pages_box .= '">';
  
$pages_box .= $pg;
  
$pages_box .= '</option>';
  
$pg++;
}

$pages_box .= '</select>';

$next $p+1;
$prev $p-1;

$nav  '<table><tr><td valign="bottom" rowspan="2">';
$nav .= ($p 1) ? '<a href="index.php?q='.$q.'&p='.$prev.'"><img src="../images/nav/prev.gif" alt="Go back one page..."></a>' '<img src="../images/nav/prevpaw.gif" alt="PoorDoggie Web Directory">';
$nav .= '</td><td valign="bottom" align="center"><img src="../images/nav/goto.gif" alt="Go to page.."></td><td valign="bottom" rowspan="2">';
$nav .= ($p $pg) ? '<a href="index.php?q='.$q.'&p='.$next.'"><img src="../images/nav/next.gif" alt="Go back one page..."></a>' '<img src="../images/nav/nextpaw.gif" alt="PoorDoggie Web Directory">';
$nav .= '</td></tr><tr><td align="center" valign="bottom">'.$pages_box.'</td></tr></table>';

?>

<html>

<head>
  <title><?php echo $title?></title>
  <meta name="description" content="A large web directory with countless sites." />
  <meta name="keywords" content="web, directory, search, sites" />
  <style>
    body{
      font-family: arial, tahoma, serif;
      font-size: 12px;
    }
    a, a:visited, a:active{
      color: 6c96ba;
    }
    a:hover{
      color: 89ba6c;
      text-decoration: none;
????: NamePros.com http://www.namepros.com/showthread.php?t=127013
    }
    .description, .main{
      font-size: 12px;
    }
    .search{
      background: 89ba6c;
    }
    .query_bar{
      background: 6c96ba;
      color: #ffffff;
    }
    img{
      border: 0;
    }
  </style>
</head>

<body onLoad="document.all.q.focus()">
  <center>
  <table class="main" width="800">
    <tr>
      <td align="left"><a href="../index.php"><img src="../images/logo.gif" alt="PoorDoggie - The web directory!" /></a></td>
    </tr>
    <tr>
      <form method="get" action="index.php">
        <td class="search" width="100%" align="center"><input id="q" name="q" style="width: 254" value="<?php echo stripslashes($q); ?>" />&nbsp;<input type="submit" value="Search" style="width: 55px;"/></td>
      </form>
    </tr>
    <tr>
      <td class="query_bar" align="right">Search results for "<?php echo $q?>" - <?php echo $results?></td>
    </tr>
    <tr>
      <td>
        <table width="100%">
          <tr>
            <td valign="top" width="700"><?php echo $content?></td>
            <td valign="top" align="right"><?php echo $ad?></td>
          </tr>
        </table>
      </td>
    </tr>
    <tr>
      <td valign="top" align="center">
        <?php echo $nav?>
      </td>
    </tr>
  </table>
  </center>
  
</body>

</html>
There is an include... will that make more "lines"? When I paste the content of that page into this page then there is just HTML on line 201.

Aha! I have found the problem! I was missing a curly bracket here:

PHP Code:
if($i 1){ 
  
$content "<center><span class=\"main\">Your search returned no results.<br /><br />If you are having trouble try cutting your search queries down to 1 word phrases.</span></center>"
and now it works... thanks to Axillant's helpful link! Thanks a lot!

Originally Posted by http://codewalkers.com/tutorials/17/3.html
PHP Code:
Parse errorparse errorunexpected in ?????????? on line 265 
How can this be when the file is only 264 lines long? You've forgotten to close a brace '}' somewhere in your code. Get yourself a editor that can show you where the brace/bracket starts/ends when your cursor is on it. Also, with proper auto-indenting, this should never be an issue.
PoorDoggie is offline  
Old 09-28-2005, 11:51 AM   #10 (permalink)
dre
NamePros Regular
Join Date: Jul 2005
Posts: 594
dre has a spectacular aura aboutdre has a spectacular aura about
 



Your missing a } count all the { and }'s there should be a even not odd amount
dre is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tutorial: Getting started with PHP (The Basics) deadserious Webmaster Tutorials 60 11-17-2007 11:35 AM
Googlism - What does google think of you? deadserious The Break Room 55 12-15-2005 09:09 AM
PHP Editor Software List Ber|Art Free Resources 3 08-22-2004 08:59 AM

 
All times are GMT -7. The time now is 02:00 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger