Jump to content

Recommended Posts

Hokie Dokie ..

I made a navigation script about a week ago, database driven.

 

Tablename : Navigation

Collums : Id | Name | link

 

And i then made a script that inserted data into the sql database via a form ... Which worked perfectly...

Untill i said to my self "If I where to delete an entry from the table, I would have gaps in my Id collum"

 

e.g.

 

Id | Name | link

----------------

0  |test1  |blah

2  |test3  |blah

5  |test6  |blah

6  |test7  |blah

7  |test8  |blah

 

So i need a script that does the following ....

 

Displays all the "name"'s of items in the table and there "id" Then the user can change the id by typing it into a text box in a form and clicking submit ... I have had terrible problems trying to do it myself ...

 

 

Thanks in advance.

Dotti.

 

Link to comment
https://forums.phpfreaks.com/topic/53321-mysql-php-update-collums-etc/
Share on other sites

I simply want a form  that allows me to update the collum "id" .... look at my code

<table border="0" width="15%" cellspacing="0" cellpadding="0">
<br>
<?php 
include ("config.php");
database_connect();
$query = "SELECT * from navigation
          WHERE status = 1
          ORDER by id;";
$error = mysql_error();
if (!$result = mysql_query($query)) {
    print "error";
exit;
}

while($itm = mysql_fetch_object($result)){
  $name = $itm->name;
  $link = $itm->link;
  $targ = $itm->target;
  if ($link=="---"){
  print("<tr>
         <td bgcolor=0066ff>
	 <img src=images/bullet1.bmp><strong> <u>$name</u></strong>
	 </td>
	 </tr>
        ");
        }else{

  print("<tr>
         <td bgcolor=00ccff>
	 <img src=images/bullet2.bmp> <a href=".$link." target=".$target."><strong>$name</strong></a>
	 </td>
	 </tr>
        ");
}
}
?>
</table>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.