Hello ppl,
What i wanna ask is how can I make a query like this :
$res = mysql_query ("SELECT * FROM stiri WHERE timestamp = '$current_date' and id not ='$id'");
Why I need something like that? probably U ask... so ..I made a news sistem for my site , In my index file is displaied a title, date, and sumary of news, and there are 6 news every day.
I have after the sumary a link called [... details] when I press this link an id of news is sent to stiri.php. Stiri.php is the file where are displaied whole news , I want to display the news with id which was sent, on the firs <tr>, after this news I want to see all the news from that day.
I've done something like that but after the news with the id which was sent is displaied, all the news from that day are displaied bellow including the firs news.
<?
require ("database.inc.php");
$first = mysql_query ("SELECT * FROM stiri WHERE id = '$id'");//here is displaied the news with a specific id
$year=substr($data["timestamp"],0,4);
$month=substr($data["timestamp"],4,2);
$day=substr($data["timestamp"],6,2);
$unix_timestamp=mktime($day,$month,$year);
while ($data = mysql_fetch_array ($first))
{
?>
<tr><td><b><? echo $data["subject"]; ?></b></td><td class="buttonright" align="right">[<? echo date("d.m.Y", $unix_timestamp) ?>] </td></tr>
<tr><td colspan="2"><? echo $data["content"]; ?></td></tr>
<?
}
?>
//till here everything is ok
<?
$current_date = date("Ymd");
$res = mysql_query ("SELECT * FROM stiri WHERE timestamp = '$current_date'");//here i need something to exclude the news with the specific id
$year=substr($data["timestamp"],0,4);
$month=substr($data["timestamp"],4,2);
$day=substr($data["timestamp"],6,2);
$unix_timestamp=mktime($day,$month,$year);
while ($dat = mysql_fetch_array ($res))
{
//in this while all my news from that day are displaied, but the news that above was displaied is displaied here to
?>
<tr><td><b><? echo $dat["subject"]; ?></b></td><td align="right">[<? echo date("d.m.Y", $unix_timestamp) ?>] </td></tr>
<tr><td colspan="2"><? echo $dat["content"]; ?></td></tr>
<?
}
?>
I made some comments in the script to understand better what I mean... maibe you have better sugestions for what I wanna do, or maibe is a query which can do something like this :
.... WHERE timestamp = '$current_date' AND &id is first
I don't know how this could be done and I hope you can help me AGAIN and again and again 🙂
10x and seey all