php - Warning: mysql_num_rows() -


what wrong in code .... when run show message ...

warning: mysql_num_rows() expects parameter 1 resource, boolean

given in

$startindex = 1 ;     $finalindex = 3;      $select_order = "select orders.orderid,orders.orederdate,customer.firstname,customer.lastname,orders.shippingaddress,shopping_cart.grandtotal,orders.status orders "             . "inner join customer on orders.customerid = customer.customerid"             . "inner join shopping_cart on shopping_cart.orderid = orders.orderid limit $startindex,$finalindex";      $result = mysql_query($select_order);        $jsonorder = array();    if (mysql_num_rows($result) > 0) {     // output data of each row        while($row = mysql_fetch_assoc($result)) {              $jsonorder[] = array('order id' => $row["orders.orderid"] ,'purchased date' => $row["orders.orederdate"],'customer name' => $row["cutomer.firstname"] ."  ". $row["customer.lastname"], // can use concat(,)function add 2 strings 'customer name' => $row['concat(firstname,lastname)']                            'shipping address' => $row["orders.shippingaddress"] ,'total price' => $row["shopping_cart.grandtotal"],                            'status' => $row["orders.status"]);         }          $jsonstring = json_encode($jsonorder);            echo $jsonstring;        } else {             echo "0 results";        } 

you need add space here

 . " inner join shopping_cart on shopping_cart.orderid = orders.orderid limit $startindex,$finalindex";     ^^ 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -