here is my sql data from my search.php page

mysql_connect("localhost", "username", "password") or die( mysql_error() );
mysql_select_db("dbname") or die( mysql_error() );
mysql_query("SET NAMES utf8");

$find = strtoupper($find); 
$find = strip_tags($find); 
$find = trim ($find); 
mysql_query("SET NAMES utf8");

$data = mysql_query("SELECT * from database WHERE upper($field) LIKE'%$find%' ORDER BY Catalog ASC"); 

while($result = mysql_fetch_assoc($data)) 
{   
$Catalog = $result['Catalog'];
echo "<center>";
echo "<table cellpadding=5 border=0 width=1000>";
echo "<td width=800 align=center><a href==/image/Set/".$result['Picture'].".jpg target=_blank><img src=/image/set/".$result['Picture'].".jpg></a></td></tr></table>";
echo "<table cellpadding=5 border=0 width=1000>";
echo "<tr><td width=50 align=middle bgcolor=#FFF380><a href=Detail.php?Catalog=".$Catalog.">".$Catalog."</a><br></td>"; 
echo "<td width=60 align=center bgcolor=#ADD8E6><font color=blue>English / Japan</font></td>"; 
echo "<td width=400>".$result['Title']."/".$result['japan_title']."</td>"; 
echo "<td width=60 align=center>".$result['Number of Products']."</td>"; 
echo "<td width=60 align=center>".$result['Date']." <hr> ".$result['Japan_date']."</td>"; 
echo "<td width=80 align=right><font color=red><b>".$result['Total Value']."</b></font><br></td></tr></table>"; 

Here is my detail.php page which I found on this site.

<?php
mysql_connect("localhost", "username", "password") or die( mysql_error() );
mysql_select_db("dbname") or die( mysql_error() );
mysql_query("SET NAMES utf8");

$sql =sprintf('SELECT * FROM database WHERE Catalog=%d', intval($_GET['Catalog']);
$result = mysql_query( $sql ) or die( "Error executing:$sql".mysql_error() ) ;
if( mysql_num_rows($result) )
{
echo '<div>No records found</div>';
}
else
{
$row=mysql_fetch_assoc($result);
echo '<table><thead>';
echo '<tr><th>' . implode('</th><th>', array_keys($row)) . '</th></tr></thead><tbody>';
do{
echo '<tr><td>' . implode('</th><th>', $row) . '</td></tr>';
}while($row=mysql_fetch_assoc($result));
echo '</tbody></table>';
}
?>

Here is the example of my search result

381 English Japan New Year - Doll 4 01-12-1988 01-12-2531 60

I tried to add a link (detail.php) to the catalog no. and in this case is 381

The webpage redirect to /Detail.php?Catalog=381

However, when I clicked on it, it said " Parse error: syntax error, unexpected " with the code on this line

$sql =sprintf('SELECT * FROM database WHERE Catalog=%d', intval($_GET['Catalog']);

I guess something is wrong somewhere around " Catalog=%d ", but I couldn't figure it out.

I am not really if I should use the codes on detail.php or not. From my understanding, I need to pass the catalog no. from my search page to my detail page which I am unable to do.

I created my database from phpmyadmin. Someone please help me out. I stuck on this thing for over 2 days now and have no clue.

I, also, don't really understand what " %d " is.

Thank you in advance.

You seem to be missing a ')' closing bracket on line 6. :)

Thank you very much. You just save my life :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.