User
Pass
2FA
 
 

Functie PHP

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Freakz Forum Index -> Trash Bin -> Trash -> Programming / Scripting / Database
Author Message1182
LolzyTM

[Mentally Stable]



Status: Offline
(since 08-11-2012 15:22)
Joined: 24 Feb 2011
Posts: 31, Topics: 19
Location: Romania

Reputation: 86.2
Votes: 2

Post Posted: 13-02-2012, 15:14:09 | Translate post to: ... (Click for more languages)

Salut, am urmatorul cod :

Code:
<?
       
        $sql = "SELECT * FROM news ORDER BY id DESC";
      $res = mysql_query($sql) or die("$sql");
        while ($row = mysql_fetch_array($res))
      {
         $titlu = $row["titlu"];
                  $id = $row["id"];
         $data = $row["data"];
         
         
            echo '<a href="index.php?news='.$id.'">' . $titlu . '&nbsp;' . '&nbsp;' . $data . '<br>';
      }

?>


Acest cod arata ce ai inserat in baza de date doar titlul si data anuntului si cand dai click pe el te duce pe pagina lui si iti arata toate detaliile.
Ce vreau eu. Cand inserezi un nou "news" cel nou intra deasupra celor precedente,cum fac ca,cand inserez un nou "news" sa imi apara deasupra dar ultimul sa dispara si sa fie doar un anumit numar de news-uri tot timpul ,cum as putea face - ? Ms mult astept un raspuns!

0 0
  
Back to top
View user's profile Send private message
nr913
[Banned user]


Banned


Status: Offline
(since 24-10-2013 10:06)
Joined: 24 Apr 2009
Posts: 4224, Topics: 223
Location: România

Reputation: 60.3
Votes: 156

 
Post Posted: 13-02-2012, 15:56:37 | Translate post to: ... (Click for more languages)

Code:
SELECT * FROM news ORDER BY id DESC LIMIT 0, 10


Attitude - A little thing that makes a BIG difference
0 0
  
Back to top
View user's profile Send private message
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Freakz Forum Index -> Trash Bin -> Trash -> Programming / Scripting / Database  


The time now is 01-12-2024, 22:49:58
Copyright info

Based on phpBB ro/com
B

 
 
 







I forgot my password


This message appears only once, so
like us now until it's too late ! :D
x