Page 1 of 1

unable to jump to row WARNING

Posted: Tue Nov 09, 2004 11:49 am
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

Re: unable to jump to row WARNING

Posted: Tue Nov 09, 2004 11:56 am
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.

Always check number of rows.

Posted: Wed Nov 10, 2004 11:04 am
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.