Hello. I have been going through the Sitepoint tutorial on using PHP and MySql. I am trying to change the sample scripts around for my own edification and potential use on my web site. What I want to do is create a database of URLs that can be listed by category. I have created one table (called "links") for the URLs and another one (called "categories") for the categories. There is a CID (category ID) field in the "links" table. So far so good. But now I am trying to write code to handle all this. My first project was to create a web page that would list all the URLs in a specific category, and have a drop-down menu to change to a new category. This has proved much harder than I thought. Right now I am still sticking with the tutorial's format of having the selector be in a seperate view on the same page, rather than combined with the list. I also am getting all kinds of errors about my code. Although I understand the basics of PHP, it seems that moving from a tutorial to one's own code is not so easy. If someone has the time I would appreciate some comments on my messy code. (Be nice!). Thank you!
PS: the ****** marks the name of my server which I didn't want to share, as well as the password.
Old Script removed - see new script in my most recent post below.
I think the problem is that u paste to much and should type code more...
I'm afraid I can't help u with the code alas (i'm sure somebody will) but I think that u should first find out where the problem lies, and then try to solve it (wether it is you to solve it, or with help from sitepoint)
I'm afraid that my first sentence states the real problem... Perhaps work through the tutorial again except instead of a jokes database, you're own site..
I finally got it working just the way I wanted. Although I would appreciate help with two things: (1) How to go back to the initial page that appears after the value has already been set? It seems like this (ifset=xxxx) type structure doesn't allow that, but I'm sure there is a way. (2) General suggestions for cleaning up the code would be appreciated as well.
// If the user selects a category
$result = mysql_query(
"SELECT category FROM categories WHERE ID=$selectcat");