Gain an index of the specified row
Posted: Sun Mar 07, 2010 1:46 am
Hi!
I've got the folowing problem. I am putting together a web page where the ovner has the privilege to change the page content within an special interface. For that purpose I had to use a db. And now I want to make the owner the possibility to insert some data just where he wants it. So I want to make it possible to insert some content at any position in the table. But firstly I dont know how to get an index of the place he want's to insert data in, and secondly how do I insert some data to the specified index.
This is my code:
I think it would be great if I could save the information about the position of the data near every output, but don't know how.
I would appreciate any help!! Thank you!!
Oh, and sorry for my not so good english :S
I've got the folowing problem. I am putting together a web page where the ovner has the privilege to change the page content within an special interface. For that purpose I had to use a db. And now I want to make the owner the possibility to insert some data just where he wants it. So I want to make it possible to insert some content at any position in the table. But firstly I dont know how to get an index of the place he want's to insert data in, and secondly how do I insert some data to the specified index.
This is my code:
Code: Select all
$sql="SELECT content FROM $table_name";
$data=mysql_query($sql) or die(mysql_error());
while($row=mysql_fetch_array($data)){ //here I display the data to the page
echo $row['content'];
echo ' <hr size="2px" align="center" width="90%px"/>
<form method="post" action="admin_script.php name="forma1">
//and here are the buttons for deleting, editing or creating a new post/entry to the table
<input type="submit" name="edit" value="Uredi"/>
<input type="submit" name="delete" value="Izbrisi vnos"/>
<input type="submit" name="new" value="Nov vnos"/>
</form>
';
echo '<hr size="5" width="98%" noshade/><br>';
}
I would appreciate any help!! Thank you!!
Oh, and sorry for my not so good english :S