Jump to content

[SOLVED] Parse Error


EagleAmerican

Recommended Posts

Hi again,

 

I thought I had my last question but adding improvments to the site I came across problems. :(

 

Right now on my view.php file, which retrieves all of the data for that parasite and displays it for the user by the id. I used to have it by name but ran into problems with spaces in names and thought id's are a much better way to go. Here is the error I get when trying to go to that page:

 

 

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/www/parasitedb.freehostia.com/view.php on line 66

 

And here is the view.php file:

 

<html>
<head>
<title>ParasiteDB - Research and Remove Parasites!</title>
<META content="parasite, virus, malware, removal, computer, pc, database, pdb, db" name=keywords>
<META content="You can research and find ways to remove hundreds of different parasites here. Come take a look!" name=description>
<style TYPE="text/css">
A{text-decoration:none}
A:hover{color:#FFFFFF;text-decoration:underline}
}
BODY {
SCROLLBAR-FACE-COLOR: #000000; SCROLLBAR-HIGHLIGHT-COLOR: #000000; SCROLLBAR-SHADOW-COLOR: #0099CC; SCROLLBAR-3DLIGHT-COLOR: #0099CC; SCROLLBAR-ARROW-COLOR: #0099CC; SCROLLBAR-TRACK-COLOR: #000000; SCROLLBAR-DARKSHADOW-COLOR: #0000000;
}
</style>
</head>

<BODY BGCOLOR="#000000" TEXT="#FFFFFF" VLINK="#0099CC" ALINK="#0099CC" LINK="#0099CC" topmargin="0">
<table border="0" cellspacing="1" width="100%">
  <tr>
    <td width="100%" background="logo.jpg">
      <table border="0" cellpadding="0" cellspacing="0" width="100%" bordercolor="#FFFFFF">
        <tr>
          <td width="100%" background="images/logo.jpg" height="80">
            <p align="center"><font color="#FFFFFF" size="4" face="Arial"><b>ParasiteDB - Research and Remove Parasites!</b></font></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="100%">
      <table border="1" cellpadding="5" cellspacing="5" width="100%" bordercolor="#FFFFFF">
        <tr>
          <td width="20%" valign="top">
        <font face="Arial" size="2"><b> Navigation</b></font><br>

            <font face="Arial" size="2">
           - <a href="index.php">Home</a><br>
           - <a href="mailto:Webmaster@parasitedb.freehostia.com?subject=Contact Us">Contact Us</a><br>
				  - <a href="mailto:Webmaster@parasitedb.freehostia.com?subject=Advertise">Advertise</a><br>
           - <a href="search.php">Search</a><br>
           - <a href="staff/index.php">Staff Login</a></font>

          <font face="Arial" size="1">
          <p>

          </font><font face="Arial" size="2">
				<font face="Arial" size="2">Google Ads Coming Soon!</font></a><font face="Arial" size="1">
          <p>

          <font face="Arial" size="2"><b> Sponsors</b></font><br>


				 </font><font face="Arial" size="2">- <a href="http://malwareremoval.com/">Malware Removal</a><br>
           - <a href="http://pchelpforum.com/">PC Help Forum</a><br>
            </font></td>
          <td width="80%" valign="top"><b><font face="Arial"><font size="2" color="#FFFFFF"><center><br>


<?php

$dbcnx = @mysql_connect('', 'adaarm_db', '');
if (!$dbcnx) {
   exit('<p>Unable to connect to the ' .
       'database server at this time.</p>');
}

$query = "select * from parasite WHERE id='$_GET['id']'";

$result = mysql_db_query("adaarm_db", $query);

echo "Search Results:<br><br>";
echo "<table width=90% align=center border=1><tr>
<td align=center>Name</td>
<td align=center>From</td>
<td align=center>Genre</td>
<td align=center>Technical Info</td>
<td align=center>Genre</td>
<td align=center>Genre</td>
</tr>";

while ($r = mysql_fetch_array($result)) { // Begin while
$name = $r["parasitename"];
$from = $r["parasitefrom"];
$genre = $r["parasitegenre"];
$description = $r["parasitedescription"];
$techinfo = $r["parasitetechinfo"];
$removal = $r["parasiteremoval"];
echo "<h2>Info for: $name</h2><br><br><br>From: $from<br><br>Genre: $genre<br><br>Description: $description<br><br>Technical Info: $techinfo<br><br>Removal Instructions: $removal<br><br>";
} // end while

?>
</center>
            </div>
            <p> </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="100%">
      <p align="center"><font size="2"><font face="Arial">All Site Content &copy 2007 - ParasiteDB<br>All Rights Reserved</font></td>
  </tr>
</table>
</BODY>
</html>

 

Thanks in advance,

Adam

Link to comment
Share on other sites

Change

$query = "select * from parasite WHERE id='$_GET['id']'";

to

$_GET['id'] = (int) $_GET['id'];
$query = "select * from parasite WHERE id='$_GET[id]'";

 

Change $_GET['id'] to $_GET[id]. Added the $_GET['id'] = (int) $_GET['id']; to make sure its an integer.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.