You are here: Re: [PHP] Viewing a specific item within a php web-page? « PHP « IT news, forums, messages
Re: [PHP] Viewing a specific item within a php web-page?

Posted by Josip Dzolonga on 04/10/05 13:25

Carlos Palomino wrote:

>I have a document entitled: articles.php
>Within this document, I want to store various written articles which are headed by a
>string value - example:
>
>$post_040905 = "text for April 9th 2005";
>print($post_040905);
>$post_041005 = "article for April 10th 2005";
>print($post_041005);
>
That's a _really_ bad idea. It is better to store all of them in a
database (MySQL is a simple one and works perfectly with PHP) ordered by
an id. So the script can take a numerical argument ID which will hold
the ID of the text which shall be shown. The argument can be passed as a
GET variable (script.php?variable=value&second=second_value) and you can
get it with $_GET['variable_name']. Take a better look here
http://www.php.net/manual/en/reserved.variables.php#reserved.variables.get
.. However don't forget to filter than input argument first, to prevent
SQL Injections :

$id = $_GET['id'];
if($id == strval(intval($id))) { /* Okay, do the query */ }
else die('Looser !');

Hope this helps,

--
Josip Dzolonga
http://josip.dotgeek.org

jdzolonga[at]gmail.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация