I have a database of information and the code to get that data out of the database based on the url, it will be some like www.website.com/thekooks and then will display the information in the database for them.

The bit I am struggling with is where do I put the code? I do not want to create a page for every entry and I think there is a way to do it but I don't even know what to search for in google.

Can any tell me how to do this, or at least what I am looking for?


Hey =)

I'm going to suggest a way (I think the way you want to do it, it is possible but with some .htaccess)

Basically, your URL would be something like:
- www.thesite.com/artists.php?name=thekooks
- www.thesite.com/artists.php?id=1

and then you'd have a script that looks something like this:

	$name = $_GET['name'];
	echo $name; // This will output what's after the "=" in this case, thekooks

BUT if you want to fetch data from a database, you could do something like this:

	$name = $_GET['name'];
	// connection information
	$query = "SELECT name ... FROM artists WHERE artist='$name'";
	$result = mysql_query($query);
	if(mysql_affected_rows() >= 1)
		// display the results
		echo 'No such band!';

Thanks, so do I then create a artist.php page, and then edit hta access so that the script on that page is executed anytime it appears in the url?

Sorry, that was my fault ;)

You'd create your artist.php and insert your code into it.

ONLY edit .htaccess if you want to have such a url like www.site.com/artists/thekooks/ (I believe this is how you get urls like this, but i'm not too sure) =)

So basically, every time the artists.php is ran, it will execute that code!

Ok brilliant, I'll give it a go. Thanks a lot

Just make sure you do checks on it, if your using $_GET, for sql injections etc =)