[thelist] mysql help

Mark Mckee lists at soddengecko.com
Mon Oct 2 00:21:40 CDT 2006


i have added a unique field tot he database that is set to auto_increment.

so far i have managed to call the category titles from the categories 
table and listed them as links like so


<?

if(!isset($cmd))
{

$sql = 'SELECT * FROM catagories ORDER BY catagory;';
$result = mysql_query($sql) or die('There are currently no links in the 
database.');
echo "<div class='edit'>\n<h1>Edit Categories</h1><ul>\n";
while ($row = mysql_fetch_assoc($result)){

$catagory = $row["catagory"];
$id = $row["id"];

echo "<li><a href='$PHP_SELF?cmd=edit&id=$id'>$catagory - Edit</a></li>\n";

$sql2 = 'SELECT * FROM catagories WHERE catagory="'.$row['id'].'" ORDER 
BY catagory;';
$result2 = mysql_query($sql2);

}
echo "</ul></div>";
}
?>

this has made each category title a clickable link which takes you to a 
page with an input box. i am unable to get that category name into that 
input box and not sure how to set up the command to send it to the db 
with the new name. also this command will have to edit the info table 
and find all the links with the category i modified and change the 
category to the new name.

i read something on being able to modify two tables at the same time, 
but no luck in getting it working.


i really appreciate all your help, some resources would be brilliant if 
you have them as i would like to learn while im doing this.

kind regards

mark m...


der wert wrote:
> first I would recommend you adding an index field and make it uniq and 
> have it auto_increment
> now say you have an entry in the table that looks like this
>
> index = 1
> category= misc
> url = http://example.com
> title = example
> target = _blank
>
>
> if you wanted to change title to example2 you would do the below query
>
> UPDATE `info` SET `title` = 'example2' WHERE `index` = 1 LIMIT 1 ;
>
> _________________________________________________________________
> The next generation of Search—say hello! 
> http://imagine-windowslive.com/minisites/searchlaunch/?locale=en-us&FORM=WLMTAG 
>
>




More information about the thelist mailing list