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 Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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'] Quote Link to comment 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 Quote Link to comment 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.