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
nikko50
Forum Commoner
Posts: 43
Joined: Thu Apr 08, 2004 6:28 am

parse error

Post by nikko50 »

Hi there. I keep receiving a parse error at the while statement in the program below. I ca'nt figure it out!. Please help??
Sharon

<?
if($radiogo =="update")
{

print $stores;

}
elseif($radiogo =="viewall")
{
$query= "SELECT * FROM shiplist WHERE quantity > 0 AND store = '$stores' ORDER BY date";
$result= mysql_query($query) or print(mysql_error());
$getstorearray=mysql_fetch_array($result, MYSQL_ASSOC) or print(mysql_error());

echo "<p align='center'><font size='4'>Shipped Log: Store $stores</font></p>";
print "<br>";

while ($row= mysql_fetch_array($getstorearray));
{ extract($row);
PRINT<<<END
<table border="1" width="75%" cellpadding="0" cellspacing="0" align="center">
<tr>
<td width="20%">$date</td>
<td width="35%">$item</td>
<td width="5%">$quantity</td>
<td width="15%">$enteredby</td>
</tr>
</table>
END;
}
}

?>
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

while ($row= mysql_fetch_array($getstorearray)); <---
nikko50
Forum Commoner
Posts: 43
Joined: Thu Apr 08, 2004 6:28 am

Post by nikko50 »

Hi there. Thanks for the response. I removed the ; and now I'm getting a parse error on another line which I thnk may be at the bottom of the program. Do you seen anything?
SHaron


<?
if($radiogo =="update")
{

print $stores;

}
elseif($radiogo =="viewall")
{
$query= "SELECT * FROM shiplist WHERE quantity > 0 AND store = '$stores' ORDER BY date";
$result= mysql_query($query) or print(mysql_error());
$getstorearray=mysql_fetch_array($result, MYSQL_ASSOC) or print(mysql_error());

echo "<p align='center'><font size='4'>Shipped Log: Store $stores</font></p>";
print "<br>";

while ($row= mysql_fetch_array($getstorearray)){
extract($row);
PRINT<<<END
<table border="1" width="75%" cellpadding="0" cellspacing="0" align="center">
<tr>
<td width="20%">$date</td>
<td width="35%">$item</td>
<td width="5%">$quantity</td>
<td width="15%">$enteredby</td>
</tr>
</table>
END;
}

}

?>
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

nothing jumps out at me. Can you post the error message?
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

<table border="1" width="75%" cellpadding="0" cellspacing="0" align="center">


you cant have that set-up within a php tag (the <? and ?>)
<table border=1 width=75% cellpadding=0 cellspacking=0 align=center>

or end the php before it and start a new <? to continue with the php code.

or:

<table border=\"1\" cellpadding=\"0\" and so forth, u get the idea.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

tim wrote:<table border="1" width="75%" cellpadding="0" cellspacing="0" align="center">


you cant have that set-up within a php tag (the <? and ?>)
<table border=1 width=75% cellpadding=0 cellspacking=0 align=center>

or end the php before it and start a new <? to continue with the php code.

or:

<table border="1" cellpadding="0" and so forth, u get the idea.
It's in a HEREDOC block so it should be ok as is. It would probably be easier to read if it was in tags :? .

Mac
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

For mac since he's too lazy to copy and paste :P

Code: Select all

<? 
if($radiogo =="update") 
{ 

print $stores; 

} 
elseif($radiogo =="viewall") 
{ 
$query= "SELECT * FROM shiplist WHERE quantity > 0 AND store = '$stores' ORDER BY date"; 
$result= mysql_query($query) or print(mysql_error()); 
$getstorearray=mysql_fetch_array($result, MYSQL_ASSOC) or print(mysql_error()); 

echo "<p align='center'><font size='4'>Shipped Log: Store $stores</font></p>"; 
print "<br>"; 

while ($row= mysql_fetch_array($getstorearray)){ 
extract($row); 
PRINT<<<END 
<table border="1" width="75%" cellpadding="0" cellspacing="0" align="center"> 
<tr> 
<td width="20%">$date</td> 
<td width="35%">$item</td> 
<td width="5%">$quantity</td> 
<td width="15%">$enteredby</td> 
</tr> 
</table> 
END; 
} 

} 

?>
If i see something i'll respond again..
Post Reply