Forum Moderators: coopster

Message Too Old, No Replies

After scrutiny, still stuck, unexpected T VARIABLE

unexpected T_VARIABLE Help

         

slademadefilms

10:56 pm on Feb 6, 2008 (gmt 0)

10+ Year Member



After much scrutiny, I'm still stuck. The funny thing is, the page wasn't giving me that error until I changed something, then I changed it back, now I'm still getting the error.

Any help is much appreciated.

Error:
unexpected T_VARIABLE in /home/content/r/e/v/revjohnny/html/testimony/index.php on line 29

Note: Line 29 is the one that starts with $contents, in my editor, that string is one line, not two as below.

Code:

<?
if ($submit == 1) {
mysql_query("INSERT INTO testimonials (fname, lname, email, text, img, url)
VALUES ('$fname', '$lname', '$email', '$text', '$img', '$url')");
$records = mysql_query('Select `id` from `testimonials`);
$num = mysql_num_rows($records);
$page = mysql_fetch_array($records);
$pagenumber = $page[id][$num];
print $pagenumber."<br><br>";
$pageid = "testimonial".$pagenumber.".php";
$file=fopen("$pageid","w");
$contents="<" . "? \$fname = '$fname'; \$lname='$lname'; \$text = '$text'; \$img='$img'; \$url='$url'; include(\"display.php\");?" . ">";
fwrite($file,$contents);
fclose($file);
print "Thank you, $fname, now please read our other testimonials.";
print "<br><br>";
$result = mysql_query('SELECT * FROM `testimonials` WHERE `active` = 1 ORDER BY `rank` ASC');
while($row = mysql_fetch_array($result)) {
print "<a href='http://example.com/testimony/testimonial$row[id].php'><font face='arial' color='#ffffff' size='3'><b>$row[fname]&nbsp;$row[lname]</b></font></a><br>";
};
} else {

$result = mysql_query('SELECT * FROM `testimonials` WHERE `active` = 1 ORDER BY `rank` ASC');
while($row = mysql_fetch_array($result)) {
print "<a href='http://example.com/testimony/testimonial$row[id].php'><font face='arial' color='#ffffff' size='3'><b>$row[fname]&nbsp;$row[lname]</b></font></a><br>";
};
};?>

[edited by: eelixduppy at 11:13 pm (utc) on Feb. 6, 2008]
[edit reason] example.com [/edit]

slademadefilms

11:01 pm on Feb 6, 2008 (gmt 0)

10+ Year Member



How funny, right after I posted this, I found the error. Missing a ' in the mysql query.

GamingLoft

11:11 pm on Feb 6, 2008 (gmt 0)

10+ Year Member



Welcome to WebMasterWorld, thanks for pointing out that you had solved you're problem yourself. However there is no need to double post, please in the future please use the " Owner Edit " button.

- Having trouble finding it?

It's located underneath you're name (<<-- over there) between the " User Profile " and " Sticky Mail " buttons.

[edited by: GamingLoft at 11:12 pm (utc) on Feb. 6, 2008]