Page 1 of 1

ouput NULL results when using "do while" loop

Posted: Mon Oct 18, 2004 4:02 pm
by kendall
Hello,

the following is a query that list all the items (24) in a database usin a LIMIT offset , max

Code: Select all

SELECT prdct.ProductID, prdct.ProductName, prdct.UnitPrice, prdct.Availability, prdct.Category, category.CategoryName FROM products as prdct RIGHT JOIN categories as category ON CategoryID = prdct.Category LIMIT %d, %d
on using variables

Code: Select all

$max = 20, $page = 2
on a do, while loop

i am getting empty results being outputted yet on checking the raw database i can pick up no null entries.

if the balance of the result is
< the LIMIT $limit, $max
would there be NULL values outputted?

e.g. url http://www.handmadebodyessentials.com/a ... e=2&max=20

Kendall

Posted: Mon Oct 18, 2004 4:36 pm
by feyd
since you are using a right/left join, yes it's quite possible it'll return null records.

Posted: Mon Oct 18, 2004 5:30 pm
by kendall
Ok,

soo youre saying i shud have used a "JOIN" in stead?

Kendall

Posted: Mon Oct 18, 2004 5:42 pm
by feyd
if you only want fully matched stuff, INNER JOIN is the better choice.