Renlok Posted October 21, 2006 Share Posted October 21, 2006 If you have a page set out like the followingName ¦ Rating Tey ¦ 7Lay ¦ 3Hey ¦ 8Each item in the Name collom would be a link to another page showing more information about that item such as description comments etc.how would you do this without individually creating each page. Quote Link to comment Share on other sites More sharing options...
hostfreak Posted October 21, 2006 Share Posted October 21, 2006 Well, if you could do something like:[code]$query = "SELECT name FROM table ORDER BY name";$result = mysql_query($query) OR die(mysql_error());while ($row = mysql_fetch_array($result)){ $name = $row['name']; echo "<a href=page.php?page=$name>$name</a>"; //url parameters would be page.php?page=Page}[/code]Then make your page.php. On page.php you would use the $_GET global to get the page name and return your results based on the page.[code]$page = $_GET['page'];$query = "SELECT * FROM table WHERE page = '$page'"; //etc[/code]Of course, that is just an example. Quote Link to comment Share on other sites More sharing options...
Renlok Posted October 22, 2006 Author Share Posted October 22, 2006 Thanks for that i added it to my pagePage Title (shows at top of page:[code] <?php $page = $_GET['page']; $query = "SELECT * FROM link WHERE siteName = '$page'"; echo $page; ?>[/code]Main code:[code] <?php $result = $db->query($query); $row = $result->fetch_assoc(); echo '<font size=6><b><u>'.stripslashes($row['siteName']).'</b></u></font>'; echo '<p>'; echo 'Added to Our Database at:<br>'; echo stripslashes($row['timeEdited']).'<p>'; echo '<a href="'.stripslashes($row['url']).'">'.stripslashes($row['url']).'</a>'; echo '<p>'; echo '<u>Sites Description:</u>'; echo stripslashes($row['discription']).'<br>'; echo '<u>Keywords Entered For Site:</u>'; echo stripslashes($row['keywords']).'<br>'; echo 'Current Rating: '; $URL = ($row['url']); $rate_query = "SELECT AVG(ratingValue) FROM rating WHERE URL = '$URL'"; $rate_result = $db->query($rate_query); $row = $rate_result->fetch_row(); $avg = $row[0]; echo $avg; echo 'Rate Site:<br>'; echo '<form name="'.$URL.'" form action="rate.php" method="post" target="_blank" form>'. '<select name="rate">'. '<option value="1">1</option>'. '<option value="2">2</option>'. '<option value="3">3</option>'. '<option value="4">4</option>'. '<option value="5">5</option>'. '<option value="6">6</option>'. '<option value="7">7</option>'. '<option value="8">8</option>'. '<option value="9">9</option>'. '<option value="10">10</option>'. '</select>'. '<input name="url" type="hidden" value="'.$URL.'" size="13" maxlength="125">'. '<input type="submit" value="Submit">'. '</form>'; mysqli_free_result($result); $db->close(); ?>[/code]I have that but it just shows a blank page with the html code on it not sure why. Quote Link to comment Share on other sites More sharing options...
hostfreak Posted October 22, 2006 Share Posted October 22, 2006 Can you post the code you have for the other page, the one that generates the links to go to the main page. Quote Link to comment Share on other sites More sharing options...
Renlok Posted October 22, 2006 Author Share Posted October 22, 2006 Ok there it is[code] <tr> <td nowrap class="datacelltwo"> <?php echo stripcslashes($row['siteName']); ?> </td> <td class="datacellone"> <?php $name = $row['siteName']; echo "<a href=page.php?page=$name>$name</a>"; ?> </td>[/code] Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted October 22, 2006 Share Posted October 22, 2006 it would be something to do with the getting the results. check to see if your actually getting information from the table. 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.