This question already has an answer here:
- How to change mysql to mysqli? 10 answers
Im trying to use this PHP file that i found on a tutorial, but it seems old and i want to upgrade it, so i tried it and got this warning on the localhost, how can i solve it?
<?php
require_once 'dbDetails.php';
//$objConnect = mysql_connect("localhost","root","root");
//$objDB = mysql_select_db("userapp");
$strSQL = "SELECT * FROM `reportes2` ORDER BY 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 at least 2 parameters, 1 given in
C:\xampp\htdocs\MapaMarker\getLanLong.php on line 7
Warning: mysqli_error() expects exactly 1 parameter, 0 given in
C:\xampp\htdocs\MapaMarker\getLanLong.php on line 7