hi there I am having a problem sorting out having a page for each row of my database, I have used the below query and it parse ok, but now how do I find out the url of other variables, It is my assumption example.com/index.php?id=2 or index.php?page=2 would show a different set of variables? this isnt happening how do I find the url ?!? In this example I was hoping it would change the news story so I can refrence them from the main page. Am I going about this in thr wrong way? I have never seen a tutorial on doing this, any help would be fantastic. <?php // Connects to your Database mysql_connect("localhost", "login", "password") or die(mysql_error()); mysql_select_db("news") or die(mysql_error()); // Query $id = $_GET['id']; $data = mysql_query("SELECT * FROM `news` WHERE `id`='.$id'") or die(mysql_error()); // Results while($info = mysql_fetch_array( $data )) { Print "<center><b>".$info['title'] . " </b> - headline<br><br>"; Print "<b>".$info['story'] . " <br>"; } Print "</table>"; ?>
I think you are missing the dot at the following line $data = mysql_query("SELECT * FROM `news` WHERE `id`='.$id.'") or
It does parse correctly as it is, I will try it however, how do I find what the url is for the variable I want to input data into my database and it create a new web page automaticly using id variables so I dont have to do hundeads of web pages with different content which look exactly the same. I am quite new to php and this seems a simple skill which I have not been able to master which is frustrating me.