php - SQL Variable Inserting INSIDE mysql_query -
i trying make price slider php , sql , have problem when have problem in code
$query = mysql_query("select * price phone_price between" .$from. "and" .$to. ); while($row = mysql_fetch_array($query)){ print $row['phone_name']; print $row['phone_price']; print ''; }
i want run sql query select * price phone_price between 300 , 500
i making beta version therefore accepting $from , $to values <input>
, think making error in inserting variable in mysql_query .
the error -warning: mysql_fetch_array() expects parameter 1 resource, boolean given in c:\xampp\htdocs\login\slide\slide.php on line 28
you have mistake in query. spaces needed after between , and. otherwise php reads query ...between123and1234...
. , should better use quotes place vars:
$query = mysql_query("select * `price` `phone_price` between '".$from."' , '".$to."'");
Comments
Post a Comment