PDA

توجه ! این یک نسخه آرشیو شده میباشد و در این حالت شما عکسی را مشاهده نمیکنید برای مشاهده کامل متن و عکسها بر روی لینک مقابل کلیک کنید : order کردن



arash8695
February 11th, 2015, 17:06
سلام اساتید
من این خط کد رو order by productid desc کجای کد پاین بذارم که جواب بده

$p="select * from tblproduct where catid=".$_GET['cat'];

yourhosting
February 11th, 2015, 17:40
این کد برای چه کاری میخواید استفاده کنید؟

yastheme
February 11th, 2015, 17:47
$p="select * from tblproduct where catid='$_GET['cat']' order by 'productid' desc";

به صورت بالاست ولی این کد شما مشکل امنیتی داره؛ SQL Injection.
کد زیر امن تره:



function sqi( $value ){
if( get_magic_quotes_gpc() ){
$value = stripslashes( $value );
}
if( function_exists("mysql_real_escape_string") ){
$value = mysql_real_escape_string( $value );
}
else
{
$value = addslashes( $value );
}
return $value;
}
$cat= $_GET['cat'];
$cat= sqi($cat);

$p="select * from tblproduct where catid='$cat' order by 'productid' desc";