unable to jump to row WARNING

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

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:

unable to jump to row WARNING

Post by kendall »

Hello, i have the following query that retrieves some info from a table in the database

Code: Select all

$query = sprintf("SELECT products.ProductID, ProductName, Description, Price FROM products, product_prices GROUP BY products.ProductID HAVING ProductID REGEXP '%s'",$ID);
while doing a "do{}while()" loop to output the results i query another table to retrieve realted information

Code: Select all

do{
$query = sprintf("SELECT * FROM product_prices WHERE ProductID = '%s' ORDER BY PriceOption, Price ASC",$product['ProductID']);
		$PRCS = QUERY_DATA($query,$connection);
		$price_option = mysql_result($PRCS,0,'PriceOption') ;
		$price_list = mysql_fetch_row($PRCS);
while($product=mysql_fetch_assoc(%PRDCTS))
However, i get
Unable to jump to row 0 on MySQL result index...
Now while this doesnt work
if i used

Code: Select all

$query = sprintf("SELECT category.CategoryName, cf.ProductID, prdct.ProductName, prdct.Description, cost.Price FROM categories AS category, category_reference AS cf, products AS prdct, product_prices AS cost WHERE cf.ProductID = prdct.ProductID AND cost.ProductID = prdct.ProductID AND category.ID = cf.Category AND cf.Category = %d GROUP BY cf.ProductID ",$category);
and loop tru this i get no errors...what is causing the error warning?

Kendall
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: unable to jump to row WARNING

Post by Weirdan »

kendall wrote: However, i get
Unable to jump to row 0 on MySQL result index...
There's no row 0 in returned result. Your query yields no rows.
User avatar
AnarKy
Forum Contributor
Posts: 119
Joined: Tue Nov 02, 2004 1:49 am
Location: South Africa

Always check number of rows.

Post by AnarKy »

One should always check the number of rows returned,
or affected by a query before trying to do anything
with the returned data set.
Post Reply