AV1611 Posted June 3, 2006 Share Posted June 3, 2006 Trying to do a join on a query via odbc with PHP...Problem: Both tables have a column name of the same name.The Database is FoxProIt would seem that ODBC for foxpro doesn't allow the column_name as alias_name SO...And to boot, PHP has a bug? that makes the array not associative, so I can't just use $row[0]... it comes up as Undefined Index: 0...If I echo it out as $row['column name'], it works like normal, but each time I get to the second tables identical name, it echo the value from the first table's column...Any suggestion for a work around????????????????????????????????????Is there a way to dump the array en mass into another array then pull it out from there???HelP! Quote Link to comment https://forums.phpfreaks.com/topic/11114-column-alias/ Share on other sites More sharing options...
AV1611 Posted June 3, 2006 Author Share Posted June 3, 2006 // EditThis doesn't fix it only partly - see last post for solution...// End EditWell, it's ugly, but I found a way around it...Someone might want to make a note of it (Barand?)Please let me know if there is a prettier solution...I know I'll use this again... [code]WHILE($row=ODBC_fetch_array($result)){ foreach ($row as $temp[]); echo $temp[0]." ".$temp[1]." ".$temp[3]." ".$temp[4]." ".$temp[5]." ".$temp[6]." ".$temp[7]." ".$temp[8]." ".$temp[9]." ".$temp[10]." ".$temp[11]." ".$temp[12]."\n";[/code]-Ciao[!--quoteo(post=379723:date=Jun 3 2006, 04:15 PM:name=AV1611)--][div class=\'quotetop\']QUOTE(AV1611 @ Jun 3 2006, 04:15 PM) [snapback]379723[/snapback][/div][div class=\'quotemain\'][!--quotec--]Trying to do a join on a query via odbc with PHP...Problem: Both tables have a column name of the same name.The Database is FoxProIt would seem that ODBC for foxpro doesn't allow the column_name as alias_name SO...And to boot, PHP has a bug? that makes the array not associative, so I can't just use $row[0]... it comes up as Undefined Index: 0...If I echo it out as $row['column name'], it works like normal, but each time I get to the second tables identical name, it echo the value from the first table's column...Any suggestion for a work around????????????????????????????????????Is there a way to dump the array en mass into another array then pull it out from there???HelP![/quote] Quote Link to comment https://forums.phpfreaks.com/topic/11114-column-alias/#findComment-41557 Share on other sites More sharing options...
Barand Posted June 3, 2006 Share Posted June 3, 2006 I'd do a print_r($row) just see what data and keys are there, just in case it is in the array but with another key name. Quote Link to comment https://forums.phpfreaks.com/topic/11114-column-alias/#findComment-41560 Share on other sites More sharing options...
AV1611 Posted June 5, 2006 Author Share Posted June 5, 2006 //editsee next post Quote Link to comment https://forums.phpfreaks.com/topic/11114-column-alias/#findComment-42028 Share on other sites More sharing options...
AV1611 Posted June 5, 2006 Author Share Posted June 5, 2006 FORGET IT!JUST FORGET IT ALL!!!I feel like an idiot...Here is the problem... When I aliased, I did it like this:serialnum as SNbut in the array the key was snSO...when I wentecho $row['SN']it didn't find it, because is should have been $row['sn']I don't think MySQL does it, just happens to do it in Foxpro via ODBC...OUCH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Thanks, Barand, for leading me to the answer... Quote Link to comment https://forums.phpfreaks.com/topic/11114-column-alias/#findComment-42034 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.