Hidoshi Posted May 9, 2008 Share Posted May 9, 2008 I'm currently trying to wrap my head around PHP and MySQL, and while the process hasn't been entirely unsuccessful, I'm hitting a pretty big wall. I have a list of members and their info in a MySQL database. I then have a PHP page which retrieves said info correctly and prints off the first name, last name, their region, etc, ordered by last name. That's all fine and dandy. However, I want to be able to generate a dynamic page from their first and last name which will then include an "about" section. I know it can be done, I'm just lacking in how to get there. For instance, I've seen where search terms can be parsed as hxxp://www.yoursite.com/members.php?First+Last and it outputs info that way. That's great, exactly what I'm looking for. I don't want to have permanent member pages, just retrieval of info and such. Does anyone know any tutorials I could use? Or just basic tips for coding and such? Thanks very much for your consideration. Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted May 9, 2008 Share Posted May 9, 2008 this is what i use , this should help you <?php } if (mysql_num_rows($result) < 1) { echo 'This ID does not exist in the database<br>'; echo "<a href=\"index.php\">Return to Image Page</a>"; exit(); } exit(); } else { echo "Unknown Image ID! <br />"; echo "<a href=\"index.php\">Return to Image Page</a>"; exit(); } } //No ID passed to page, display user list: $query = "SELECT image_id, image_name, image_link, image_caption FROM `hayleyimages`"; $result = mysql_query($query) or die("Error:" . mysql_error()); if (mysql_num_rows($result) > 0) { ?> <table class="welcome_port"><tr><td>Welcome this is my portfolio.</td></tr></table> <table id="portfolio"> <?php $loop = 3; $loop1 = 3; while($row=mysql_fetch_array($result)){ // Start looping table row if ($loop == 3) { echo "<tr>"; } $toecho1 .= '<td><a href="?image_id='.$row['image_id'].'">Details</a></td><td> </td>'; $toecho .= '<td><a href="'.$row['image_link'].'" rel="lightbox [main]" title="'.$row['image_caption']. '" ><img src="'.$row['image_link'].'"width="150px" /></a></td><td> </td>'; if ($loop == 3) { echo "</tr>"; $loop=0; } } if (substr($toecho, -5) != "</tr>") { $toecho .= "</tr>"; } echo $toecho; echo $toecho1; } ?> </table> <?php if (mysql_num_rows($result) < 1) { echo "No Images To Display"; } mysql_close(); ?> Quote Link to comment Share on other sites More sharing options...
Barand Posted May 10, 2008 Share Posted May 10, 2008 There's a good set of tutorials by Kevin Yank http://www.sitepoint.com/article/publishing-mysql-data-web Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted May 10, 2008 Share Posted May 10, 2008 sorry, the script i posted is missing stuff and to complex try this one if ($_SESSION['logged_in'] == true) { if (isset($_GET['edit'])) { if ((int) $_GET['edit'] > 0) { $userid = $_GET['edit']; $sql = "SELECT * FROM hayleyedit WHERE `page_name`='{$page_id}' LIMIT 0,1;"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); $welcome = $row['content']; ?> <p>Editing <?php echo "$page_id"; ?></p> <form action="<?php $_SERVER['PHP_SELF'] ?>" method="post"><textarea name="content" cols="60" rows="20" title="Edit Site Content"><?php echo "$welcome"; ?></textarea><br /><input type="submit" value="Change" title="Save Changes"/></form> <?php if (mysql_num_rows($result) < 1) { echo 'This ID does not exist in the database<br>'; echo "<a href=\"live_edit.php\">Return to Members Page</a>"; exit(); } exit(); } else { echo "Unknown User ID! <br />"; echo "<a href=\"live_edit.php\">Return to Members Page</a>"; exit(); } } //No ID passed to page, display user list: $query = "SELECT page_name, content FROM hayleyedit"; $result = mysql_query($query) or die("Error:" . mysql_error()); if (mysql_num_rows($result) > 0) { echo "User List:<br />"; while ($row = mysql_fetch_assoc($result)) { echo '<table border="1"><tr><td><a href="?id=' . $row['page_name'] . '">' . $row['content'] . '</a></td></tr></table>'; } } } else { header("Location:http://".$_SERVER[HTTP_HOST]); } Quote Link to comment Share on other sites More sharing options...
DarkWater Posted May 10, 2008 Share Posted May 10, 2008 Just put your own info into that script. Don't use his tables and his links, etc. Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted May 10, 2008 Share Posted May 10, 2008 yep, forgot to mention that , you need to change some of it for yourself. Quote Link to comment Share on other sites More sharing options...
Hidoshi Posted May 10, 2008 Author Share Posted May 10, 2008 Thanks very much, I'll try this out and get back to ya. ^^ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.