Hi All,
Basially a client wants to visit his site click on the admin link and upload some images and some text so his page refreshes with the new stuff showing at the top and the older stuff below it.
I was thinking at first of using include but not sure now as the filename on the stuff uploaded will have to reamain constant for include to work. Is there a way i could achieve this?
i'm still in the learning stages so i'm probably overlooking something very easy...

Thanks for any ideas.

Cheers...

Recommended Answers

All 6 Replies

your post is not clear for me...
please post again with clear...i am not telling totally wrong..

Ok, i will try and make it a bit clearer.

Basically, the client wants to upload 2 pictures and a text file at a time (2 images of vans for sale and a text document with the details about the vans!) However he wants the previous images shown aswell with a delete function so when the vans are sold he can delete them. all i need is some method of uploading them so they can be posted in a table.

Cheers...

Assuming that you are not using database

then i think your problem will be solved by giving a sequence as filenames when uploading.
then you can display them in a table ascending or descending order.

or

It is better using database for indexing posts. Then your need is very simple.

Thanks for youre reply, Could you elaborate on the database method? Possibly with a snippet of code?

Many thanks

$host="localhost"; // Host name
$username="root"; // Mysql username
$password="1234"; // Mysql password
$db_name="main_db"; // Database name
$table_name = "my_table"; // name of the table

// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

//code to insert values into database table.
$sql =  "INSERT INTO $table_name VALUES ('$var1','$var2')"; 
$query=mysql_query($sql);

//code to read from database.
$sql="SELECT * FROM $table_name ";
$result=mysql_query($sql);
while($info = mysql_fetch_array( $result)) {
	echo "Column 1 = " . $info[0] . " - Column 2 = " . $info[1];
}

It is possible to have some small mistakes(syntax errors) in this code you've to correct it as i didn't run it, just typed.

you can create database and table from phpmyadmin or download sqlyog or something like that.

You have to make one field for indexing each post.

I wrote all these assuming you are new to database concept.

Many thanks for your time.

Cheers...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.