Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating forum

Status
Not open for further replies.

taoufik

Technical User
Feb 14, 2005
4
NL
Hi

i created a forum with php and MySql, but i want to make the most recent updated topic on top with a graphics to indicate that it's kind of urgent or new ... can sombody please help me with that ?

Kind Regards
 
pls, define "most recent": latest posts from the last year? last month? last week? last day? last min? last sec?

cheers.
 

most recent :

- latest time (timestamp) "year / month / day"
- last day
- last week
- last month
- last year

 
hmmm... "most recent" for you are all!

what of them should be marked? I would write the sql statment with ASCend order, so the first row is the latest, and on that one I should mark it with a graphic or something.

What's your doubt?

Cheers.
 
ok i wrote the sql statement ( ORDER BY ID DESC ) so the latest one is at top ... how can i mark it with graphics ?
 
I'm pretty sure you made a "while" loop in order to show all the results, right? (pls post that piece), so for the firs "echo" or "print" add an <img src="new.gif"> bofore to print the post.

comprendez vouz?

Cheers.
 
no i didn't use "while" loop ... i build the application with Dreamweaver MX <i'm new to php Mysql>

here is the code :

************************************************
<?php
$maxRows_status = 10;
$pageNum_status = 0;
if (isset($_GET['pageNum_status'])) {
$pageNum_status = $_GET['pageNum_status'];
}
$startRow_status = $pageNum_status * $maxRows_status;

mysql_select_db($database_cybertrading_support, $cybertrading_support);
$query_status = "SELECT * FROM support WHERE Status != 'completed' ORDER BY ID DESC";
$query_limit_status = sprintf("%s LIMIT %d, %d", $query_status, $startRow_status, $maxRows_status);
$status = mysql_query($query_limit_status, $cybertrading_support) or die(mysql_error());
$row_status = mysql_fetch_assoc($status);

if (isset($_GET['totalRows_status'])) {
$totalRows_status = $_GET['totalRows_status'];
} else {
$all_status = mysql_query($query_status);
$totalRows_status = mysql_num_rows($all_status);
}
$totalPages_status = ceil($totalRows_status/$maxRows_status)-1;

$queryString_status = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_status") == false &&
stristr($param, "totalRows_status") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_status = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_status = sprintf("&totalRows_status=%d%s", $totalRows_status, $queryString_status);
?>
************************************************
 
and where are you displaying the rows? the code above makes the query, consult how many rows and some other thasks, but there is not a "show rows"..

you must put an image in the echo or print command.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top