php mysqlidb - PHP file using mysqli_query -


im trying use php file found on tutorial, seems old , want upgrade it, tried , got warning on localhost, how can solve it?

<?php require_once 'dbdetails.php'; //$objconnect = mysql_connect("localhost","root","root"); //$objdb = mysql_select_db("userapp"); $strsql = "select * `reportes2`  order id  asc ";  $objquery = mysqli_query($strsql) or die(mysqli_error()); $arrrows = array(); $arryitem = array();  while($arr = mysql_fetch_array($objquery)) {  $arryitem["id"] = $arr["id"]; $arryitem["latitude"] = $arr["latitude"]; $arryitem["longitude"] = $arr["longitude"]; $arryitem["locationname"] = $arr["locationname"];  $arrrows[] = $arryitem; }  echo json_encode($arrrows); ?> 

shown on localhost:

warning: mysqli_query() expects @ least 2 parameters, 1 given in  c:\xampp\htdocs\mapamarker\getlanlong.php on line 7  warning: mysqli_error() expects 1 parameter, 0 given in  c:\xampp\htdocs\mapamarker\getlanlong.php on line 7 

i can see json array on web browser, change code follow:

<?php require_once 'dbdetails.php'; $sql = "select * `reportes2` order id asc"; $objquery = mysqli_query($con,$sql);  $arrrows = array(); $arryitem = array();  while($arr = mysqli_fetch_array($objquery)) {  $arryitem["id"] = $arr["id"]; $arryitem["campo_latitud"] = $arr["campo_latitud"]; $arryitem["campo_longitud"] = $arr["campo_longitud"]; $arryitem["campo_categoria"] = $arr["campo_categoria"];  $arrrows[] = $arryitem;  }  echo json_encode($arrrows); ?> 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -