> -----Message d'origine-----
> De : Delta Storm [mailto:[EMAIL PROTECTED] 
> Envoyé : mercredi 28 février 2007 10:24
> À : php-general@lists.php.net
> Objet : [PHP] ID problem
> 
> Hi,
> 
> I'm building an CMS system (for practice and experience :)).
> 
> And of course like many times before I have encountered a problem.
> 
> The problem is:
> 
> I have a index.php that takes the news from the database and 
> publishes them. And by the end of every news on index.php I 
> have a link ('<a href="showfullnews.php?id=$id">Show full news</a>')
> 
> That leads to a page that has the full news.
> 
> At the beginning of showfullnews i have a variable ( $id = 
> $_GET['id']; )
> 
> And in index.php I have the following code:
> 
> while ($row = mysql_fetch_array($result)) {
>       $id= $row['id'];
> etc...
> }
> 
> In the database I have two tables one for a short version of 
I'd suggest just using one table, and when you display the short version
just display a certain number of characters from the full version say 50
first chars as a preview this is what i use:

        function debut_texte($texte, $nb_cars) {
                $nb_cars = intval($nb_cars);
                if (!$nb_cars || !$texte) return($texte);
                if (strlen ($texte) <= $nb_cars) return($texte);
                $nouveau_texte = substr($texte, 0, $nb_cars-3);
                $nouveau_texte .= '...';
                return ($nouveau_texte);
        }

Sorry its in french, essentialy you pass it your text ($texte) and the
number of characters ($nb_cars) of that text you want to and it returns the
$nb_cars first characters and appends "..." to the end of the text.. This
will save you some confusion by using two tables for the same data...

> news for index.php and another for fullNews.
> 
> In full news the query is: "select title,newsFull from 
> fullnews where id='$id'";
> 
> In the database i'm 100% sure there is a id = 1 in both rows.
> 
> I really dont know what is the problem.

Erm me neither.. Need more code to see problem.

> Thank you very much!
> 
> --
> PHP General Mailing List (http://www.php.net/) To 
> unsubscribe, visit: http://www.php.net/unsub.php
> 

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

Reply via email to