dotti Posted May 28, 2007 Share Posted May 28, 2007 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 More sharing options...
Barand Posted May 28, 2007 Share Posted May 28, 2007 Don't bother. Learn to live with the gaps. Link to comment https://forums.phpfreaks.com/topic/53321-mysql-php-update-collums-etc/#findComment-263522 Share on other sites More sharing options...
dotti Posted May 28, 2007 Author Share Posted May 28, 2007 but what if i want to re-arrange the order my items are displayed in.. Becuase on my navigation.php all the items are shown as links in an array ordered by "id" And I may want to re-arange the order. Link to comment https://forums.phpfreaks.com/topic/53321-mysql-php-update-collums-etc/#findComment-263524 Share on other sites More sharing options...
Barand Posted May 28, 2007 Share Posted May 28, 2007 If sequence matters, and you can't use the name column, add a sequence column to control it. See http://www.phpfreaks.com/forums/index.php/topic,140306.msg596840.html#msg596840 Link to comment https://forums.phpfreaks.com/topic/53321-mysql-php-update-collums-etc/#findComment-263527 Share on other sites More sharing options...
dotti Posted May 28, 2007 Author Share Posted May 28, 2007 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> Link to comment https://forums.phpfreaks.com/topic/53321-mysql-php-update-collums-etc/#findComment-263529 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.