going crazy? cannot find the reason for parse error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tharkas
Forum Newbie
Posts: 2
Joined: Wed Jun 08, 2005 9:05 pm

going crazy? cannot find the reason for parse error

Post by tharkas »

Hello,

I'm very tired at the moment but I don't think I did anything wrong with the script. But obviously I'm wrong and php parser is right. Here's the code. Its very simple but I cannot what's causing the error.

The error is "Parse error: parse error in artwork.php on line 49"

line 49 is the line after

Code: Select all

while ($test = mysql_fetch_array($viewthumb)
which is just a

Code: Select all

}
Here's the full script

Code: Select all

<?php
$i=1;
while($i < 4){
$i++;
$viewthumb = mysql_query("select * FROM  pictures where pictures.SecID=2 LIMIT 1, 15");
print('<tr>');
while ($test = mysql_fetch_array($viewthumb)
 {
print('
<td align="center" width="120"><img src="images/thumb/'.$test["PicFileName"].' alt="" width="100" height="137" border="1"></td>
');
}
print('</tr>');
}?>
There is no php code before this script except db connection which is working perfectly fine.

Thanks
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

Code: Select all

while ($test = mysql_fetch_array($viewthumb))
theres only 3 brackets, there should always be an even number as brackets come in pairs only
Last edited by malcolmboston on Wed Jun 08, 2005 9:18 pm, edited 1 time in total.
User avatar
MathewByrne
Forum Commoner
Posts: 38
Joined: Sat Mar 27, 2004 9:49 pm
Location: Australia

Post by MathewByrne »

Very simple:

Code: Select all

while ($test = mysql_fetch_array($viewthumb))
You needed the extra ')' on the end of the while statement.
tharkas
Forum Newbie
Posts: 2
Joined: Wed Jun 08, 2005 9:05 pm

Post by tharkas »

thanks a million :D
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

no problem, im here to help and be helped
Post Reply