Ok I need help. I have a couple hundred databases, which are different cities, that I am trying to connect with one query. each city has the same Sports table in it. I want to put the 100 most recent results on one page . The code below gets the following error. SELECT command denied to user
On godaddy I have the highest hosting you can have without having to handle the server myself. My nightmare would be that I would have to upgrade and take full control over the server. Please help me!!!
If I take off the mysql_error() then the warning shows Warning: mysql_fetch_array() expects parameter 1 to be resource
... PS the code did work on my local WAMP. Not sure if i have added privilages on my local server that I do not have with Godaddy.
$sql= 'select * from city ORDER BY id DESC';
$result=mysql_query($sql);
$counter=mysql_num_rows($result);
$i=1;
$all="";
while($rows = mysql_fetch_array($result)){
$city =$rows['city'];
$state=$rows['state'];
$citytrimmed = str_replace(' ','',$city);
$statetrimmed = str_replace(' ','',$state);
$cityst2= $citytrimmed . $statetrimmed;
$cityst = strtolower($cityst2);
$citydbhost = $cityst;
$citydbuser = $cityst;
$citydbpass = 'XXXXXX';
$citydbname = $cityst;
}
include 'cityopendb.php';
$all.= 'Select * From '.$citydbname.'.Sports ' ;
if($i < $counter){
$all.= ' UNION ALL ';
$i=$i+1;
}else{;
$all.= ' ORDER BY timestamp DESC LIMIT 100; ';
}
}
$query=mysql_query($all) or die(mysql_error());
while($row=mysql_fetch_array($query)){
}