jonoc33 Posted January 6, 2008 Share Posted January 6, 2008 <?php $req_user_info = $database->getUserInfo($req_user); $authorsname = $req_user_info['username']; $results = mysql_query("SELECT picture FROM ".TBL_USERS." WHERE username='{".$authorsname."}'"); while($values = mysql_fetch_array($results)){ if(!$values['picture'] == 0){ echo "<center><img src='$values[picture]' /></center>"; } else{ echo "<center>No Profile Picture</center>"; } } ?> What is wrong with this code? It is meant to display an image through a link from a record in a database, but doesnt. Mysql_error doesn't show anything wrong. Quote Link to comment Share on other sites More sharing options...
Barand Posted January 6, 2008 Share Posted January 6, 2008 try if($values['picture'] != 0){ Quote Link to comment Share on other sites More sharing options...
jonoc33 Posted January 6, 2008 Author Share Posted January 6, 2008 Didnt work Quote Link to comment Share on other sites More sharing options...
Barand Posted January 6, 2008 Share Posted January 6, 2008 Didnt work Define the above statement Quote Link to comment Share on other sites More sharing options...
psychowolvesbane Posted January 6, 2008 Share Posted January 6, 2008 Try: $results = mysql_query("SELECT picture FROM TBL_USERS WHERE username='$authorsname'"); Quote Link to comment Share on other sites More sharing options...
jonoc33 Posted January 6, 2008 Author Share Posted January 6, 2008 Didnt work Define the above statement It basically did the exact same thing as last time is what I mean.. Try: $results = mysql_query("SELECT picture FROM TBL_USERS WHERE username='$authorsname'"); Still did the same thing. Quote Link to comment Share on other sites More sharing options...
Barand Posted January 6, 2008 Share Posted January 6, 2008 For the benefit of those non-telepaths out here, what was that? Quote Link to comment Share on other sites More sharing options...
jonoc33 Posted January 6, 2008 Author Share Posted January 6, 2008 Pretty sure you won't find them on a PHP forum, but it does not display the image. Quote Link to comment Share on other sites More sharing options...
Barand Posted January 6, 2008 Share Posted January 6, 2008 What does it display? Where are you checking mysql_error()? If you cannot give a better description of the problem I can't help. Quote Link to comment Share on other sites More sharing options...
jonoc33 Posted January 6, 2008 Author Share Posted January 6, 2008 I've tried putting in mysql_error in both situations, but decided to remove it because I wasn't getting any results. Quote Link to comment Share on other sites More sharing options...
Barand Posted January 6, 2008 Share Posted January 6, 2008 Goodbye Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted January 6, 2008 Share Posted January 6, 2008 @jonoc33 are you getting a blank page when you run the above code? If you do see if you can enable a setting called display_errors within the php.ini (if accessable to you) or within a .htaccess file like so: php_value display_errors On php_value error_reporting E_ALL Make sure you place the .htaccess file within your sites root folder (where you upload your sites files to), also you don't provide a filename for the .htaccess file. The file you create is just called .htaccess 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.