I know I need to use the MySQL fetch to prevent getting a resource ID in my variable but I wondered if you could help me out how to do that. I see from several tutorials they use a loop but I just want to select the one string into a variable. Here is the code I have:
$img = mysql_query('SELECT pname FROM photos WHERE pphotoid=21');
echo $img;
I basically want $img
to contain the string in the database not Resource id #3
it is currently showing. Also is what I wrote prone to an SQL injection?
Learning MySQL so any help would be great!