[PHP-DB] Warning: Unable to jump to row...

2003-03-31 Thread Benjamin Trépanier
Hi, 

I'm trying to using a  news script and improve somes with a query.


$req = MYSQL_QUERY(SELECT * FROM $TBL_NEWS);
$res = MYSQL_NUM_ROWS($req);

?
table border=0 width=400 cellspacing=0 cellpadding=0
tr
td
img src=img/titre_calendrier.gif alt= width=404 height=51
border=0

?

$i!=$id_news_
$id= mysql_result($req,$i,id);
$titre = mysql_result($req,$i,titre);
$date   = mysql_result($req,$i,date);
$heure  = mysql_result($req,$i,heure);
$heure  = str_replace(:,h,$heure);
$news   = stripslashes(trim(mysql_result($req,$i,news)));


?

I want that my script show the content of the rows corresponding to my
Variable called: Id_News_

So the variable is moving well but when the scirpt is running and go to
display the row  this code happend:

Warning: Unable to jump to row number X

Or

Currently he is always showing row #5...

I put my id_news_  in a echo and the variable is ok.. I really dont
understand

Thanks for your help!

BEn




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Warning: Unable to jump to row...

2003-03-31 Thread Ronan Chilvers
Hi Ben

Comments inline 

On 31 Mar,2003 at 13:46 Benjamin Trépanier wrote:

snip
 border=0
 
 ?
 
 $i!=$id_news_
 $id= mysql_result($req,$i,id);
 $titre = mysql_result($req,$i,titre);
 $date   = mysql_result($req,$i,date);
 $heure  = mysql_result($req,$i,heure);
 $heure  = str_replace(:,h,$heure);
 $news   = stripslashes(trim(mysql_result($req,$i,news)));
 
 
/snip

You should try using one of mysql_fetch_array() / mysql_fetch_row() to step through 
the recordset.  Something along the lines of

?php

while ($data = mysql_fetch_array($req)) {
// handling code for each row here using references like this

$id = $data[id];
$titre = $data[titre];

echo trtd$id/tdtd$titre/td/tr\n;  
// \n above to keep the html source reasonably tidy
}

?


snip
 ?
 
 I want that my script show the content of the rows corresponding to my
 Variable called: Id_News_
 
 So the variable is moving well but when the scirpt is running and go to
 display the row  this code happend:
 
 Warning: Unable to jump to row number X
 
/snip

Hope this helps.

-- 
Ronan
e: [EMAIL PROTECTED]
t: 01903 739 997
w: www.thelittledot.com

The Little Dot is a partnership of
Ronan Chilvers and Giles Webberley

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php