RE: [PHP] ID problem





-----Message d'origine-----
De : Delta Storm [mailto:delta.storm@xxxxxxxxxxx]
Envoyé : mercredi 28 février 2007 10:24
À : php-general@xxxxxxxxxxxxx
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

.



Relevant Pages

  • Special Characters
    ... Sorry a newbie question regarding special characters. ... I have created a news page using php, ...
    (php.general)
  • Re: [PHP] Preventing SQL Injection/ Cross Site Scripting
    ... It's a shame that so many PHP installations have them enabled, and a huge disappointment that PHP is actually distributed with this stuff enabled! ... encoding data for output to an HTML document. ... characters into 5, 6, or 7-byte strings, if you already provided the correct character set in the Content-Type HTTP header. ... For anything that gets written to a database or used for a query, I suggest escaping the data using a function specifically designed for that database. ...
    (php.general)
  • Re: [PHP] Preventing SQL Injection/ Cross Site Scripting
    ... It's a shame that so many PHP ... encoding data for output to an HTML document. ... characters into 5, 6, or 7-byte strings, if you already provided the ... anything that gets written to a database or used for a query, ...
    (php.general)
  • Re: Kerry needs a news reader
    ... When composing a plain-text format-flowed message, Mozilla wraps the lines at 76 characters for the composer. ... MIME is an extension that is supposed to be backwards compatible with the oldest mail and news reader. ... Other mailing lists have solved this issue by putting in a MIME stripper program. ...
    (comp.os.vms)
  • Re: Obama hails beginning of new highway work
    ... this was because many people at the time were using text based clients clients that had a screen width of 80 characters and setting the word wrap to less than 80 characters would allow for leading quote markers to take up some of the line length without causing wrapping problems. ... RFC 2646 addressed this to some extent allowing those using news clients that support it to see text wrapped at window width while those who view the same message in news clients that don't support it would see messages wrapped at the established line length. ... For previewing the post, it can, but some news readers don't do the necessary post processing on quoted text when replying to such messages. ...
    (misc.transport.road)