View Full Version : SQL Query Read
TheInsaneManiac
09-02-2008, 09:12 PM
Hello. I am trying to make this script work, but for some reason it is not. I am trying to read from the DB to find a users customprofilepic filename. So far it's not working to well. Ideas?
$db->query_read("SELECT filename FROM " . TABLE_PREFIX . "customprofilepic WHERE userid='".$row[0]."'");
Eikinskjaldi
09-03-2008, 02:36 AM
Well firstly you dont need to quote numeric variables.
Secondly you dont tell us about the nature of the not working.
Thirdly, and I will take a completely blind stab, are you using fetch_rows after the read_query?
TheInsaneManiac
09-06-2008, 06:04 PM
Well firstly you dont need to quote numeric variables.
Secondly you dont tell us about the nature of the not working.
Thirdly, and I will take a completely blind stab, are you using fetch_rows after the read_query?
Basically it is going to fetch the filename of a profile picture for a specific user. This filename is going to be displayed inside of an img source tag.
sockwater
09-06-2008, 07:50 PM
What is the exact error it gives you?
Are you certain $row[0] contains a valid userid? Use die($row[0]); to check.
Don't quote the integer value.
Are you sure $db is in scope?
What hook are you doing this on?
$userid = (int) $row[0];
die($userid); // use this for a sanity check...
$db->query_read("
SELECT filename
FROM " . TABLE_PREFIX . "customprofilepic
WHERE userid = $userid
");
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.