ouput NULL results when using "do while" loop

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

ouput NULL results when using "do while" loop

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

since you are using a right/left join, yes it's quite possible it'll return null records.
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Post by kendall »

Ok,

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

Kendall
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

if you only want fully matched stuff, INNER JOIN is the better choice.
Post Reply