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

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



Reply via email to