Forum Moderators: coopster

Message Too Old, No Replies

Help with php error

         

JuicyScript

5:27 pm on Nov 25, 2010 (gmt 0)

10+ Year Member



Someone please help me with this error on my script
Parse error: parse error in C:\Program_Files\wamps\www\health_data\search_results.php on line 70

search.php
<?php
include("config.php");
include("constants.php");
?>
<?php
function makeDrop ($database,$table,$teamname,$groups)
{

include("config.php");


$query = "select id,name from category order by name";

$results = MYSQL_QUERY($query);

if (mysql_Numrows($results)>0)
{
$numrows=mysql_NumRows($results);
$x=0;
while ($x<$numrows)
{

$id=mysql_result($results,$x,"id");
$name=mysql_result($results,$x,"name");


echo "<option value=\"$id\">$name</option>\n";

$x++;
}
}
}
?>

<h2>Print Booklist by Staff</h2>

<br>Select a category to Print out a Staff<br>
<form method="post" action="search_results.php">

<table>
<tr>
<td><font color=blue><b>Choose a Category :</b></font></td>
<td><select name="catid">



<?php
echo"<option value=\"-1\" selected>All Categories</option>";

makeDrop("health_data","category","id",$name);
?>


</select>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<br>
<input type="submit" name="Submit" value="Get Book List">
<input type="reset" value="Clear" name="Reset">
</td>
</tr>
</table>
</form>

</body>
<html>


search_results.php
<?php
include("config.php");
include("constants.php");
?>


<?php

if ($catid=="-1")
{

$catname="All Categories";
$thisKeyword = $_REQUEST['catid'];
$query = "SELECT * FROM staff WHERE id like '%$thisKeyword%' OR title like '%$thisKeyword%'";

}
else
{

$thisKeyword = $_REQUEST['catid'];
$query = "SELECT * FROM staff WHERE id like '%$thisKeyword%' OR title like '%$thisKeyword%'";

}

$result = MYSQL_QUERY($query);
$numberOfRows = MYSQL_NUM_ROWS($result);

/* How many of these books are there? */
if ($result>0) { $number = MYSQL_NUM_ROWS($result); }
else {$number=0;}


/* Print these results to the screen in a nice format */
$i = 0;

IF ($number == 0)
{

echo "<h2>Sorry, No books found in Category </font> !</h2>";

}
else if($number>0)
{
echo "<br><h3><b>Category:</b>$thisKeyword</h3>";
echo "<h4>$number books found:<b> $number</b></h4>";

?>


<?php


WHILE ($i < $number):

$q=$i+1;

$book_id1 = mysql_result($result,$i,"id");
$name1 = mysql_result($result,$i,"name");
$year1 = mysql_result($result,$i,"year");


$check=checkbookstatus($bookid1);
$catsymbol=getcatsymbol($catid);


?>

<? echo $check; ?>
<? echo $name1; ?>
<? echo $year1; ?>

Demaestro

8:23 pm on Nov 25, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Looking at line 70 I see you have pasting in this script twice.

This looks to be the offender... check your line 70

search_results.php
<?php
include("config.php");
include("constants.php");
?>

JuicyScript

7:49 am on Nov 26, 2010 (gmt 0)

10+ Year Member



I took it out but still getting the error

Matthew1980

8:26 am on Nov 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi all,

Your also mixing and matching your opening code tags: <? should be: <?php I have seen this kill scripts before...

>>Demaestro: Looking at line 70 I see you have pasting in this script twice.

I think as this was another file, but I see what your referring to.

There is probably a missing ; } or " or ' in the mix somewhere, parsing error's are where the code breaks when it shouldn't.

Cheers,
MRb

JuicyScript

10:35 am on Nov 26, 2010 (gmt 0)

10+ Year Member



Thank you that solved my problem

Matthew1980

2:12 pm on Nov 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there JuicyScript,

Cool, happy coding for the rest of your project then..

Cheers,
MRb