Hello, I have used .htaccess code to make my website URL static for products and categories pages like : RewriteRule ^maincategory/([0-9]+)/([0-9A-Za-z-]+).html category.php?subcatID=$1 [L] RewriteRule ^product/([0-9]+)/([0-9A-Za-z-]+).html product.php?productID=$1 [R=301,L] and in php page for link is used : <a href='www.mydomain.com/product/".$product_rs['id']."/".format_str(stripslashes($product_rs['name'])).".html'> where $product_rs['id'] is product ID from database and $product_rs['name'] is product name category page is working perfectly with this all configuration but product page is having error. like static page for product is http://www.mydomain.com/product/19/nokian72.html and on product.php i have line which retrieve query string from URL $prdid = getVar('productID'); echo "Select * From products Where id=1" $prd_sql = "Select * From products Where id=".$prdid; $prd_result = $mysql->select_query($prd_sql); $prd_rs = mysql_fetch_array($prd_result); its returning me error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 as query string return 0 when i echo $prdid. getvar() function to retrieve querystring function getVar($var){ if(isset($_REQUEST[$var])){ return $_REQUEST[$var]; }else { return 0; } } Please suggest what is the problem. Thanks
Try enclosing the string in a single quote $prd_sql = "SELECT * FROM products WHERE id='$prdid'"; $prd_result = $mysql->select_query($prd_sql); $prd_rs = mysql_fetch_array($prd_result); PHP: