SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
Thread: Bug in PHP script but clueless
-
Aug 18, 2000, 04:19 #1
- Join Date
- Feb 2000
- Location
- xyz
- Posts
- 158
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
This is a PHP script I made to show a MySQL record:
<?
// connect to our database
require("includes/includes.inc");
if (isset($rID)):
// SHOW ARTICLE
$result = mysql_query("SELECT * FROM reviews WHERE rID = $rID");
if (!$result) {
echo("<p>Houston, we have a problem. Error: " . mysql_error() . "</P>");
exit();
}
$row = mysql_fetch_array($result); ?>
<HTML>
<HEAD>
<TITLE>Adventure Gamer - Reviews - <? echo "$row["title"]" ?></TITLE>
</HEAD>
<BODY>
<b><? echo "$row["title"]" ?></b><br>
<? echo "$row["title"]" ?><br>
<h1><? echo "$row["title"]" ?></H1><br>
</BODY>
</HTML>
I am getting the error "Parse error: parse error, expecting `STRING' or `NUM_STRING' or `'$'' in /home/qgamer/questgamer-www/reviews.php on line 18"
Line 18 is the one with the <TITLE> tag. I went through the script over and over again but couldn't find any slip ups. Does anyone see a bug?
-
Aug 18, 2000, 07:14 #2
hi
this is not the answer to the parse problem you have but i always get an error with this line of code.
require("includes/includes.inc");
what my server wants is
require("/includes/includes.inc");
hope this helps.
ed
-
Aug 18, 2000, 08:25 #3
- Join Date
- Aug 2000
- Location
- San Diego, CA
- Posts
- 5,460
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
it is the use of two sets of double quotes try using <? print $row["title"] ?> Since its a vraible you wont need the outer quotes when using print
-
Aug 18, 2000, 09:59 #4
- Join Date
- Feb 2000
- Location
- xyz
- Posts
- 158
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
That did the trick
If you use PHP files in subdirectories, it is best to include the / slash in the includes.inc address. It works fine if all your PHP files are in the root though
Bookmarks