Log in

View Full Version : stoopid php.



RyanS
19-09-2006, 08:41 PM
why does this give me an unexpected T_ECHO...



$category = $row[category]

echo("
<a href=\"index.php?view=tutorials\">Tutorial Index</a> > <a href=\"index.php?view=tutorials&category=".$category."\">$category</a> > ".$title."<br />
<table width=\"100%\" style=\"border: 1px solid #BBCDA3;\">
<tr>
<td>$title by - ".$author." ($views Views)</td>
</tr>
<tr>
<td>

</td>
</tr>
<tr>
<td>
".$tutorial."</td>
</tr>
");

echo("
<tr>
<td>
<br /><br />
<a href=\"index.php?view=tutorials&action=report&id=$id\">Report This Tutorial</a>
</td>
</tr>
");
}
echo("
</table>
<br />
");
if (mysql_num_rows($comments) == "0") {
echo("There are no comments!<br />");


the line with the error is the first line on the above script.

Kyle™
19-09-2006, 08:43 PM
Coding Section, :p

RyanS
19-09-2006, 08:45 PM
Will you just get lost pls mod wannabe.

Josh-H
19-09-2006, 08:56 PM
A cautioned member giving advice ... well yer ryan should be coding section BUT techincally it is to do with web design so this is right forum too.

Kyle™
19-09-2006, 08:57 PM
There is a coding section for a reason. ;)

Hitman
19-09-2006, 09:00 PM
Hey Ryan, shouldn't it be:


$category = $row[category];

echo("
<a href=\"index.php?view=tutorials\">Tutorial Index</a> > <a href=\"index.php?view=tutorials&category=".$category."\">$category</a> > ".$title."<br />
<table width=\"100%\" style=\"border: 1px solid #BBCDA3;\">
<tr>
<td>$title by - ".$author." ($views Views)</td>
</tr>
<tr>
<td>

</td>
</tr>
<tr>
<td>
".$tutorial."</td>
</tr>
");

echo("
<tr>
<td>
<br /><br />
<a href=\"index.php?view=tutorials&action=report&id=$id\">Report This Tutorial</a>
</td>
</tr>
");
}
echo("
</table>
<br />
");
if (mysql_num_rows($comments) == "0") {
echo("There are no comments!<br />");

? You missed off the ; i think.

RyanS
19-09-2006, 09:04 PM
nope :(

Hitman
19-09-2006, 09:07 PM
Try:


$category = $row['category'];

echo("
<a href=\"index.php?view=tutorials\">Tutorial Index</a> > <a href=\"index.php?view=tutorials&category=".$category."\">$category</a> > ".$title."<br />
<table width=\"100%\" style=\"border: 1px solid #BBCDA3;\">
<tr>
<td>$title by - ".$author." ($views Views)</td>
</tr>
<tr>
<td>

</td>
</tr>
<tr>
<td>
".$tutorial."</td>
</tr>
");

echo("
<tr>
<td>
<br /><br />
<a href=\"index.php?view=tutorials&action=report&id=$id\">Report This Tutorial</a>
</td>
</tr>
");
}
echo("
</table>
<br />
");
if (mysql_num_rows($comments) == "0") {
echo("There are no comments!<br />");

If that doesn't work I'm unsure, because I only know simple PHP :p

RyanS
19-09-2006, 09:09 PM
no soz.

ty anyway!

im normally good at spotting erros i must just be tired xD

tom get yo fat assss on msn.

Hitman
19-09-2006, 09:12 PM
:( I tried :p

No problem.

Lol, I've been on my DS all day xP

Can't I'm on the really laggy computer =[

Eric30
20-09-2006, 01:22 PM
Is that the whole code?

nets
20-09-2006, 02:51 PM
You need a semicolon before the echo function. Is the array named row defined?

RyanS
20-09-2006, 02:54 PM
Joshua i aint getting you >.>

:Blob
20-09-2006, 03:49 PM
Some times you dont need "'s by the $strings

Or, the T_ECHO could be caused by the thing above it.

Another edit

Find:

$category = $row[category]

Replace with:

$category = $row;[category]

Want to hide these adverts? Register an account for free!