robrodp
asked on
php msysql problem
I have this php script in my siteground account
https://lapalabramx.com/ip.php
I get
Fatal error: Call to a member function query() on boolean in /home/galaplas/public_html /lapalabra mx.com/ip. php on line 21
In hostgator the same script:
http://apuntatemx.com/ip1.ph
Works ok
Code error line is
$result = $conn->query($sql);
I have googled and find nothing. I dont know if it is adiffrence in php or my sql
https://lapalabramx.com/ip.php
I get
Fatal error: Call to a member function query() on boolean in /home/galaplas/public_html
In hostgator the same script:
http://apuntatemx.com/ip1.ph
Works ok
Code error line is
$result = $conn->query($sql);
I have googled and find nothing. I dont know if it is adiffrence in php or my sql
<?php
$servername = "localhost";
$username = "***";
$password = "***";
$dbname = "galaplast_respuestas";
$actividad="Paco";
// Create connection
$conn = mysqli_connect($servername, $username, $password,$dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
} else {
echo "ConnectionOk";
}
$ip=get_client_ip();
echo $ip;
$ipdec=ip2long($ip);
echo $ipdec;
$sql="select * from blocks where " . $ipdec ." BETWEEN ips AND ipe";
echo $sql ."<br>";
$result = $conn->query($sql);
$resultip = $conn->query($sql);
$rowip = $resultip->fetch_assoc();
if( $resultip->num_rows>0) {
$pais="MEXICO";
} else {
$pais="NOMEX";
}
$conn->close();
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER