Forum Moderators: coopster

Message Too Old, No Replies

Accessing the next title

         

kkonline

8:09 am on Sep 14, 2007 (gmt 0)

10+ Year Member



I access the current page title as $row['title']; which is within a while loop.

Now how do i access the title of the next row in database? something like $row['title'+1]; gives me an output as 1

dreamcatcher

8:23 am on Sep 14, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just use the same: $row['title']

You are accessing an array indice each time you loop. The indice has the same name for each iteration of the loop.

dc

kkonline

8:38 am on Sep 14, 2007 (gmt 0)

10+ Year Member



No i mean

$countviews = mysql_query("UPDATE wow SET views=views+1 WHERE id=$page");

$sql = mysql_query("SELECT * FROM wow WHERE `trusted` = 0 ORDER BY `id` ASC LIMIT $from, $max_results");

while($row = mysql_fetch_array($sql)){
echo "<!--start-->";
echo "<font size=3><b>";
echo $row['title']."</b><br /></font>";
echo "<font size=2>";
echo "Contributed By ";
echo $row['contributed_by'];
echo " on ";
echo date("jS F Y H:i:s", $row['date'])."<p>";
echo $row['content']."</p><br />";
echo "<!--end-->";
echo $safeurl->make_safe_url($row['title']+1);
}

//should give me the next title but prints 1

Yes sir, i understand what it does completely... i am using a mod rewrite structure as example.com/abc/1/2/3/content-title-of- page-1 and when the user clicks on the next button it should point to example.com/abc/1/2/3/content-title-of- page-2 that means content-title-of- page-2 etc. is the title of the next page

example the page looks like


within the while loop{

TITLE of current page

CONTRIBUTED BY abc

on some DATE

CONTENT
}

<< Previous Page Link------ Next Page Link>>


now in the above example the next page link (url will have the title of the next page according to the mod rewrite i have used ) so how to display the link for next and previous?