Forum Moderators: coopster

Message Too Old, No Replies

PHP Error / Help me please

         

smartcard

11:40 pm on Nov 4, 2005 (gmt 0)

10+ Year Member



I am getting the following error from my codes:


Parse error: parse error, unexpected T_STRING, expecting T_VARIABLE or '$' in /home/dom2/public_html/frontpage.php on line 35

frontpage.php codes is:


<?php
require 'admin/definitions.php';
require 'admin/config.php';
$link = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname, $link);
$sql="SELECT img.thumb,inv.numimages, inv.itemno,inv.make,
inv.model,inv.price, inv.year, inv.exterior as color
FROM $dbtoday_spec t
INNER JOIN $dbvin inv ON (inv.itemno = t.itemno)
INNER JOIN $dbimg img ON (img.itemno = t.itemno)
GROUP BY t.itemno
ORDER BY inv.stock
";
$rsItems=mysql_query($sql,$link);
$item_count=mysql_num_rows($rsItems);
$item_per_row=4;
$row_per_page=1;
?>
<link href="style.css" rel="stylesheet" type="text/css">
<table width="95%" border="0" cellpadding="1" cellspacing="0">
<tr>
<td colspan="<?php echo $item_per_row;?>" height="20" valign="top" class="item_special_header">
<font face="Verdana" size="4">TODAY'S SPECIAL</td></tr></font>
<?php
$item_number=0;
while ( ($item_row=mysql_fetch_array($rsItems) ) && ($row_number<$row_per_page) )
{
if ($item_number % $item_per_row ==0) {
echo "<tr>";
}
$item_number++;
$row_number=($item_number / $item_per_row);
if($item_row['num ']) {
$ uery = "SELECT thumb FROM $dbimg WHERE itemno='$item_row[itemno]' ORDER BY id DESC LIMIT 1";
$image = mysql_db_query($dbname, $query, $link);
$image = mysql_fetch_array($image);
$thumb = '<img src="photo/'. $image['thumb'] .'" border="0">';
} else {
$thumb = "no photo";
}
$item_brand=$item_row['make'];
$item_model=$item_row['model'];
$item_year=$item_row['year'];
$item_price=$item_row['price'];
$item_html=<<<EOF
<table width="170" height="170" border="0" cellpadding="5" cellspacing="0" class="items_special1">
<!--DWLayoutTable-->
<tr>
<td height="42" colspan="2" valign="top" ><div align="center">
<a class="navigation" href="details.php/itemno/{$item_row['itemno']}.htm{$linkstring}">{$thumb}</a>
</div></td>
</tr>
<tr>
<td width="58" height="19" valign="top" class="item_caption_left">Brand</td>
<td width="119" valign="top" class="item_caption_right">{$item_brand}&nbsp;</td>
</tr>
<tr>
<td height="19" valign="top" class="item_caption_left">Model</td>
<td valign="top" class="item_caption_right">{$item_model}&nbsp;</td>
</tr>
<tr>
<td height="19" valign="top" class="item_caption_left">Year</td>
<td valign="top" class="item_caption_right">{$item_year}&nbsp;</td>
</tr>
<tr>
<td height="24" valign="top" class="item_caption_left">Price</td>
<td valign="top" class="item_caption_right">{$item_price}&nbsp;</td>
</tr>
<tr>
<td height="25" class="item_caption_left">&nbsp;</td>
<td class="item_caption_right">&nbsp;</td>
</tr>
</table>
EOF;
echo "<td width=\"\" height=\"\" valign=\"\" class=\"\">
$item_html
</td>";
if ($item_number / 2 ==0) {
echo "</tr>";
}
}
?>
</table>

sned

11:55 pm on Nov 4, 2005 (gmt 0)

10+ Year Member



$ uery = "SELECT thumb FROM $dbimg WHERE itemno='$item_row[itemno]' ORDER BY id DESC LIMIT 1";

is the $ uery a typo?

-sned

smartcard

9:39 am on Nov 5, 2005 (gmt 0)

10+ Year Member



I changed the $ uery to $query but still the same problem.

AcsCh

9:51 am on Nov 5, 2005 (gmt 0)

10+ Year Member



this is THE error when the brackets {} are not correctly closed.

smartcard

1:10 pm on Nov 5, 2005 (gmt 0)

10+ Year Member



I checked the { }, but could not find any error.

Is there any tools or editors that can identify such errors from PHP codes?

tucj7

2:46 pm on Nov 5, 2005 (gmt 0)

10+ Year Member



I pasted your code into my IDE. The problem seems to have been with the $ query. When corrected the syntax seemed fine.

sunveria

11:26 am on Nov 22, 2005 (gmt 0)

10+ Year Member



if($item_row['num ']) {

do you have "num " field in your database?
make sure if it is "num" or "num "

^ ^