Jump to content

Unknown problem facing with my database...


Go to solution Solved by mac_gyver,

Recommended Posts

Hello every body

I have a database and it consist of more than 200,000 rows and the problem i'm facing is that whenever i'm quering the database from my localhost it shows correct output but whenver i'm, uploading them in the server, it misses some output...

The image is shown below...

 

In my localhost

 

cqs1394261777m.jpg

 

When ever I queried the same ip in my server it shows nothing... As shown below....

 

viu1394261901d.png

 

The code i'm using to query is shown below

<?php
$con = mysql_connect("***","****","****") or die(mysql_error());
 mysql_select_db("****") or die(mysql_error());
 ?>
 <div style="margin: 0px auto;width: 980px;">
<form method="post" action="">
    Enter the ip <input type="text" name="ip" size="35" style="height:28; font-size: 18px"/><input type="submit" name="submit" value="Check Country" style="height: 30px; margin-left: 15px;" />
</form>

<?php
    if(isset($_REQUEST['submit']))
    {
	$ip = ip2long($_REQUEST['ip']);
	
	$res = mysql_query("SELECT * from ip2country WHERE $ip BETWEEN begin_long_ip AND end_long_ip") or die(mysql_error());
	$row = mysql_fetch_array($res);
	echo "<h1>Country Name :  ".$row['country_name']."</h1><br />";
	echo "<h1>Country Code :  ".$row['country_code']."</h1><br />";	

	$res1 = mysql_query("SELECT COUNT(*) AS Total FROM ip2country") or die(mysql_error());
	$row1 = mysql_fetch_array($res1);
	echo $row1['Total'];
    }
?>
</div>

Any help will be greatly appreciated....

Thank you in advance... :)

Edited by Ch0cu3r
Link to comment
https://forums.phpfreaks.com/topic/286810-unknown-problem-facing-with-my-database/
Share on other sites

  • Solution

it's possible that your actual column names have different capitalization between the two servers. what does using the following - print_r($row);,  immediately after the $row = mysql_fetch_array($res); statement show?

Edited by mac_gyver
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.