unemployment Posted February 9, 2011 Share Posted February 9, 2011 I have a function with a query and then a while loop and then an if file_exists with an image path. I am getting the image path displayed as text. Would this be because I am running the query through json encoding? Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted February 9, 2011 Share Posted February 9, 2011 Hmmm ... my crystal ball has gone dark & I can't see your code. :-) Please post it between tags so we can see what you're talking about. Ken Quote Link to comment Share on other sites More sharing options...
unemployment Posted February 9, 2011 Author Share Posted February 9, 2011 Hmmm ... my crystal ball has gone dark & I can't see your code. :-) Please post it between tags so we can see what you're talking about. Ken Does this help? while (($row = mysql_fetch_assoc($query)) !== false) { $display_name = ucwords("${row['firstname']} ${row['lastname']}"); if (file_exists("/assets/img/avatars/users/${row['username']}.png")) { $avi = "<img src=\"/assets/img/avatars/users/${row['username']}.png\" title=\"${display_name}\" alt=\"${display_name}'s profile image\" />"; } else { $avi = "<img style=\"float:left;\" src=\"/assets/img/avatars/companies/defaultcomp.jpg\" title=\"${display_name}\" alt=\"${display_name}'s profile image\" />"; } $account_type = ($row['accounttype'] == '1')? 'Entreprenuer' : 'Investor'; $total = partner_fetch_total($uid); $partners[] = "${avi} ${display_name } ${account_type} ${total}"; } Quote Link to comment Share on other sites More sharing options...
PaulRyan Posted February 9, 2011 Share Posted February 9, 2011 When you view the source of the page after is has excuted, what do you see? Paste it here. My feeling is that this part ${row['username']} should infact be this {$row['username']}...same goes for the rest of the variables that are typed the way...but what do I know? Regards, PaulRyan. Quote Link to comment Share on other sites More sharing options...
unemployment Posted February 9, 2011 Author Share Posted February 9, 2011 When you view the source of the page after is has excuted, what do you see? Paste it here. My feeling is that this part ${row['username']} should infact be this {$row['username']}...same goes for the rest of the variables that are typed the way...but what do I know? Regards, PaulRyan. This is my output and moving the $ in the {} didn't help. <img style="float:left;" src="/assets/img/avatars/companies/defaultcomp.jpg" title="blah" alt="blahs's profile image" /> Blah Blah Investor 1 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.