Zoud Posted December 22, 2006 Share Posted December 22, 2006 I'm "kinda" new to PHP and would like to know what coding is used to create diffrent content when the URL is extended with ".php?".It would help me out alot, thanks! Link to comment https://forums.phpfreaks.com/topic/31557-pages-like-indexphpinformation-here/ Share on other sites More sharing options...
trq Posted December 22, 2006 Share Posted December 22, 2006 Usually you store your data in a database, then look up a specific record via an id. So... if you have a link to index.php?uid=4 this could would display data related to uid 4.[code]<?php // connect to db if (isset($_GET['uid'])) { // $_GET['uid'] holds the data passed through the url. $sql = "SELECT uname FROM tbl WHERE uid = '{$_GET['uid']}'"; // really should validate $_GET['uid'] before trying to use it, but.... if ($result = mysql_query($sql)) { if (mysql_num_rows($result) > 0) { $row = mysql_fetch_assoc($result); echo $row['uname']."<br />"; } else { echo "No results found matching {$_GET['uid']}"; } } else { mysql_error(); } }?>[/code] Link to comment https://forums.phpfreaks.com/topic/31557-pages-like-indexphpinformation-here/#findComment-146217 Share on other sites More sharing options...
Zoud Posted December 22, 2006 Author Share Posted December 22, 2006 That's basicly what I thought, but now there's just one more problem. I don't know as much stuff about MySQL as I do with PHP and other stuff. So, how would I be able to customize the content in the table to the content on the page?I think it's using the $_GET and/or $_POST tag's, right? Link to comment https://forums.phpfreaks.com/topic/31557-pages-like-indexphpinformation-here/#findComment-146221 Share on other sites More sharing options...
trq Posted December 22, 2006 Share Posted December 22, 2006 Sorry, but that makes little sense. Link to comment https://forums.phpfreaks.com/topic/31557-pages-like-indexphpinformation-here/#findComment-146257 Share on other sites More sharing options...
Submerged Posted December 22, 2006 Share Posted December 22, 2006 Zoud, I was like you a while ago with no clue how to use MYSQL. Now i at least have some ideas :) I would suggest going to http://www.freewebmasterhelp.com/tutorials/phpmysql and learning to set up a basic address book. It taught me a lot anyways. Link to comment https://forums.phpfreaks.com/topic/31557-pages-like-indexphpinformation-here/#findComment-146267 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.