worsethenu;10971857 wrote:If there's a better way please lemme know what it is cause i would love to learn more.
Well if you're going to be pulling more than one row at a later date, then by all means - leave the while loop in there. If you're ever in a situation where you only expect a single row, however, there's no need for a loop (since loops are meant to be run multiple times until some stop condition is met) - just call the appropriate fetch function (e.g. whatever is in the body of the while loop) a single time and use the data.
Result of var_dump are as expected:
string(24) "pics/image02.jpg"
worsethenu;10971857 wrote:if not SELECT then what should i use? Most of the tuts i've seen use SELECT.
I wasn't suggesting that you use a different query altogether - SELECT is what you're wanting. I was instead suggesting that the '*' is what should be changed; you should instead list the columns that you need data from, e.g. "SELECT col1, col2, ... FROM myTable" .
As for your problem, try adding this code before the if() statement to get some additional information:
error_reporting(E_ALL);
ini_set('display_errors', 'On');
var_dump( is_readable("pics/") );
var_dump( is_readable($photo) );
Let us know what output that produces (including any PHP error messages, if applicable).