کد PHP:
require_once('chheader.php');
require_once('connection.php');
require_once('db_fns.php');
$catid=$_GET['catid'];
function get_books_details($catid)
{
//تابعی برای دردیافت اطلاعات هر کتاب
db_connect();
$query="select author,title,price,description from books where catid=$catid";
$result=@mysql_query($query);
if(!$result)
retu false;
global $num_books;
$num_books=mysql_num_rows($result);
if($num_books==0)
{
do_header('no result');
echo "<div class=wrapper><b>there is no book in this category</b></div>";
do_footer();
exit;
}
$res_array=array();
for($count=0;$count<$num_books;$count++)
{
while($row=mysql_fetch_array($result))
{
$res_array['author']=$row;
$res_array['title']=$row;
$res_array['price']=$row;
$res_array['description']=$row;
}
}
retu $res_array;
}
$result=get_books_details($catid);
do_header("show books details");
echo '<div class=wrapper>';
echo "<b>Result: $num_books books</b>";
echo '<ul class=box>';
foreach ($result as $index => $row)
{
echo '<li><strong>'.$index.':</strong> '.$row[$index].'</li>';
}
echo '</ul>';
echo '</div>';
do_footer();
- - , .
php مرکز کد های سایت...ما را در سایت php مرکز کد های سایت دنبال میکنید
برچسب: نویسنده: استخدام کار بازدید: 162