gurulay Posted August 20, 2008 Share Posted August 20, 2008 please somebody help me, i don't know what's wrong with the following code... if i don't use alias, it's ok, but if i use alias on query statement, it doesn't display anything. $sql='SELECT u.name FROM user u'; $result=mysql_query($sql) or die(mysql_error()); while($row=mysql_fetch_array($result)) { echo $row['u.name']; } thanks in advanced Link to comment https://forums.phpfreaks.com/topic/120451-can-not-use-alias-on-php/ Share on other sites More sharing options...
JD* Posted August 20, 2008 Share Posted August 20, 2008 try doing a print_r($row) to see if 'u.name' is properly defined in your array. Link to comment https://forums.phpfreaks.com/topic/120451-can-not-use-alias-on-php/#findComment-620635 Share on other sites More sharing options...
gurulay Posted August 20, 2008 Author Share Posted August 20, 2008 when i make print_r($row) it show like following - Array([0]=>Admin[name]=>Admin) could u explain me why it doesn't display on my php code please, Thanks in advanced Link to comment https://forums.phpfreaks.com/topic/120451-can-not-use-alias-on-php/#findComment-620644 Share on other sites More sharing options...
awpti Posted August 20, 2008 Share Posted August 20, 2008 It's echo $row['name'] not ['u.name'] Link to comment https://forums.phpfreaks.com/topic/120451-can-not-use-alias-on-php/#findComment-620650 Share on other sites More sharing options...
gurulay Posted August 20, 2008 Author Share Posted August 20, 2008 Ohh... yes, that's right Thank you very much indeed Link to comment https://forums.phpfreaks.com/topic/120451-can-not-use-alias-on-php/#findComment-620652 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.