Log in

View Full Version : Basic vbulletin sql help


kobescoresagain
12-24-2006, 01:13 AM
I know sql but I am having issues figuring out how vbulletin does it. $monthlytraderinfo = $db->query_first("
SELECT dateline
FROM " . TABLE_PREFIX . "itrader AS itrader
WHERE rateduserid = $userinfo[userid]
");

That is what I did. This gives me the first one. But it doesn't give me them all. I am sure that I shouldn't change query_first to something. Not sure what. I changed it to query_read and I got an error. Please help me.

Guest190829
12-24-2006, 01:16 AM
I know sql but I am having issues figuring out how vbulletin does it. $monthlytraderinfo = $db->query_first("
SELECT dateline
FROM " . TABLE_PREFIX . "itrader AS itrader
WHERE rateduserid = $userinfo[userid]
");That is what I did. This gives me the first one. But it doesn't give me them all. I am sure that I shouldn't change query_first to something. Not sure what. I changed it to query_read and I got an error. Please help me.

Query first only returns one row when used, what was the error you received when using query_read?

kobescoresagain
12-24-2006, 01:19 AM
#40 MySql error

"Resource id #40" when I try to print_r($monthlytraderinfo)

I figured out a way to get the information out. I used the following while ($mt = $db->fetch_array($monthlytraderinfo))
{
print_r($mt);
}

and it worked, I guess vb doesn't like print_r in certain circumstances.