PHP/MYSQL: 2 similar codes, one fails
Back Story: Hired to do PHP/MYSQL work on a race website. Need to dump MYSQL database into Windoze spreadsheet (though that part works just fine) This is what works: PHP Code:
$sql = "SELECT * FROM participants AS T1, race2011 AS T2 WHERE T1.id = T2.racerid";
$result = mysql_query($sql);
while($cols = mysql_fetch_assoc($result) ){
if( !isset($columnLabels) ){
foreach($cols AS $key){
$columnLabels[] = ucwords( str_replace("_", " ", $key) ); &n! bsp;&nbs p; } $row[] = $columnLabels; } $row[] = $cols; }
This dumps a spreadsheet of 2011's racers. Now, I need a dump of all racers ever. When I try replacing $sql with "SELECT * FROM PARTICIPANTS", it doesn't work for an unknown reason. I know for a fact that it's not a server or Apache problem. I @THINK@ that the search results aren't being stored to $row properly, but I have no idea. Can someone please help me? I've been working on this all day and can't manage to figure this one out. Thanks in advance. |
No comments:
Post a Comment