- Code: Select all
$zip = mysql_real_escape_string($_GET['zip']);
$query="SELECT * FROM int_weather AS w, int_forecast AS f WHERE w.zip = f.zip AND f.zip = $zip";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
so when I type in my browser http://my.domain.com/intweather.php?zip=99999
the above will return the correct row.
But I am trying to pull internation weather so I am using EGLL (Heathrow Airport, London) and my gather weather is inserting EGLL as the zip. MySQL field for zip is 'varchar'
when I do http://mydomain.com/intweather.php?zip=EGLL
I get :
Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /var/www/html/rss/intweather.php on line 10.
Line 10 is $num=mysql_numrows($result);
is there something with the mysql_real_escape_string can only be a number?
If I do zip=458974594378 or some number I know is not in the db, it returns a blank page. if I do any sort of letter I get the Error message above.
Any ideas?

