I have this code:
<?php
include 'config.php';
date_default_timezone_set('America/Los_Angeles');
$d = date('Y-m-d');
$m = date("m");
$day = date("d");
$t = date("His");
$ip = $_SERVER['REMOTE_ADDR'];
$c = file_get_contents('http://api.wipmania.com/'.$ip);
echo "<h2>ALL RESULTS TODAY:</h2><table>";
$_GET['c'] = $c;
$sc = $_GET['sc'];
if($c === "key"){
if($sc === "t"){
$result = "SELECT * FROM main WHERE date = '$d' ORDER BY time";
while($row = mysqli_fetch_array($result))
{echo "<tr><td>".$row['key'] . "</td><td> " . $row['country']."</td><td>".$row['ip']."</td></tr>"; }
}
}
echo '</table>';
?>
i have tried without $con
: mysqli_fetch_array($result)
, but it was the same...
But nothings appear... no error no results... Please help... Thanks!
$result = mysqli_query($con, $sql) or die (mysqli_error($con))
, where $sql is the query you want to run, and $con is a valid mysqli database connection. – andrewsi Aug 30 at 18:47mysqli
you should be using parameterized queries andbind_param
to add user data to your query. Never use string interpolation to accomplish this. – tadman Aug 30 at 19:03