Imtay22 0 Report post Posted June 14, 2008 Okay, I have a php question. After I SELECT from a mysql table, how to I put that data into a new section of a php file, that hasn't been written yet. Like, ?page=3 and 4 gets made when row four gets entered into the table. Please help if you understand. Thanks,Tim Share this post Link to post Share on other sites
Framp 0 Report post Posted June 17, 2008 I'm sorry but I can't understand.A php file is not divided in section like 'page=1 page=2 etc'It's simply a way to create more pages by one.You can put a switch on $_GET['page'] and do something like that: switch($_GET['page']){case 1:echo 'page 1';break;case 2:echo 'page 2';break;case 3:echo 'page 3';//Here you can put your mysql query and retrieve resultsbreak;} Share this post Link to post Share on other sites
demonlord 0 Report post Posted June 17, 2008 i would do it some what like this: <?php//MYSQL Settings$db = mysql_connect("localhost", "username", "password");mysql_select_db("database_name", $db) or die("Could not connect to the database." . mysql_error());$page= $_GET['page'];if(!isset($page)){// You can put a custom error message here, // or you can place some default content that your members will see // if they dont put a page id in the url.}$query = "SELECT * FROM data WHERE id = '$page'";$result = mysql_query($query);echo "<html><head><title>Your Page Title Here</title></head><body><table width='100%'><tr><td>$result</td></tr></table></body></html>";};?> the code will look different depending on your database structre, you will need to add the right info for your database login and the database name, and you will need to change the table data in the mysql query to match you table. and you can change the layout of the page by editing the html code in the post, you will just have to make sure that $result is in there some where so that it will display what is pulled from the database. If you need any help just let me know Share this post Link to post Share on other sites