Damien wrote:
> I did that because...
> I haven't yet found out how, in php, include a page wich number is in a
> database.
I'm not sure wha you store in your database, but assume you have an ID number
(auto incremented) and another column with text.
"SELECT text_column FROM table_name WHERE id_number = {$num}"
This query will give you the text, if there is a such id number in the table,
if it's deleted you won't get any rows at all.
If you don't get any rows, display an error message that the page ain't
anymore, otherwise display the data as you wanted it to be displayed.
> I call the page from the number of the page, and so far, I
> have a case of which calls an include('page_num'). so I have so far a
> code with case of num=1.. until 20.. (I assume I don't want to add more
> than 20 fields).
$file_name=str_replace('..','',$_REQUEST['num']).'.php';
if(file_exsits($file_anme)) {
include($file_name);
} else {
echo "no such page"
}
This will accept any kind of file name, numeric or just characters or any mix,
addind the .php and include if it's located in the same directory as the file
which the code is in, if no file found then an error message is displayed.
> It all right so far as num is a number, but isn't working when num is a
> $num value...
If you are thinkign about the auto incremented column in the database, no you
can only have numbers in it.
> I guess this might be the problem here, solving the include problem and
> simply use an autoincrement column in the base for each added record.
Why not just store the data in the database? eval() should fix problems with
php in the stored data.
--
//Aho
>> Stay informed about: sql and increment