bkthomas18 Posted September 15, 2006 Share Posted September 15, 2006 I am a newbie to PHP/ MySQL and I have written this script to grab rows from a database table and display them on a web page. I need the links to link to the id number rather than the row number. Can someone please take a look at the code below and let me know what I need to do to change it. I'm sure it is something fairly simple that I don't know how to do . Thanks.[code]<?php// Database Connectionmysql_connect('localhost','user','pass');mysql_select_db('db');// If current page number, use it// if not, set one!if(!isset($_GET['page'])){ $page = 1;} else { $page = $_GET['page'];}// Define the number of results per page$max_results = 25;// Figure out the limit for the query based// on the current page number.$from = (($page * $max_results) - $max_results); // Perform MySQL query on only the current page number's results$sql = mysql_query("SELECT id, name FROM gentleman ORDER BY name");while($row = mysql_fetch_array($sql)){ // Build your formatted results here. echo ('<a href="1.php?page=' . $row['id'] . ' ">' . $row['name'] . ' </a><br />');}// Figure out the total number of results in DB:$total_results = mysql_result(mysql_query("SELECT COUNT(id) as Num FROM gentleman"),0);// Figure out the total number of pages. Always round up using ceil()$total_pages = ceil($total_results / $max_results);// Build Page Number Hyperlinksecho "<center>Select a Page<br />";// Build Previous Linkif($page > 1){ $prev = ($page - 1); echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$prev\"><<Previous</a> ";}for($i = 1; $i <= $total_pages; $i++){ if(($page) == $i){ echo "$i "; } else { echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\">$i</a> "; }}// Build Next Linkif($page < $total_pages){ $next = ($page + 1); echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$next\">Next>></a>";}echo "</center>";?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/20888-display-id-rather-than-row/ Share on other sites More sharing options...
wildteen88 Posted September 15, 2006 Share Posted September 15, 2006 If I'm not overlooking anything, by id number you mean page number?. Then prehaps you want to use this:[code=php:0]echo ('<a href="1.php?page=' . $page . ' ">' . $row['name'] . ' </a><br />');[/code]Rather than[code=php:0]echo ('<a href="1.php?page=' . $row['id'] . ' ">' . $row['name'] . ' </a><br />');[/code] Quote Link to comment https://forums.phpfreaks.com/topic/20888-display-id-rather-than-row/#findComment-92533 Share on other sites More sharing options...
craygo Posted September 15, 2006 Share Posted September 15, 2006 I imagine this line is your link[code]echo ('<a href="1.php?page=' . $row['id'] . ' ">' . $row['name'] . ' </a><br />');[/code]it actually looks fine. all you have to do is call on it on the 1.php page[code]<?php$id = $_GET['id'];$sql = "SELECT * FROM gentleman WHERE id = '$id'";?>[/code]Ray Quote Link to comment https://forums.phpfreaks.com/topic/20888-display-id-rather-than-row/#findComment-92534 Share on other sites More sharing options...
bkthomas18 Posted September 15, 2006 Author Share Posted September 15, 2006 [quote author=wildteen88 link=topic=108199.msg435016#msg435016 date=1158340275]If I'm not overlooking anything, by id number you mean page number?. Then prehaps you want to use this:[code=php:0]echo ('<a href="1.php?page=' . $page . ' ">' . $row['name'] . ' </a><br />');[/code]Rather than[code=php:0]echo ('<a href="1.php?page=' . $row['id'] . ' ">' . $row['name'] . ' </a><br />');[/code][/quote]By ID number i mean the id number of the actual row, not the row number. Once a row is deleted the next one is moved up but the id number stays the same so i need to actually get to the row based on the id number. Quote Link to comment https://forums.phpfreaks.com/topic/20888-display-id-rather-than-row/#findComment-92548 Share on other sites More sharing options...
wildteen88 Posted September 15, 2006 Share Posted September 15, 2006 [quote]By ID number i mean the id number of the actual row, not the row number.[/quote]Then your original code should be fine:[code=php:0]echo ('<a href="1.php?page=' . $row['id'] . ' ">' . $row['name'] . ' </a><br />');[/code]$row['id'] holds the id number of the row in the database, thats is asociated with the name ($row['name']).I'm a little confused at what you are trying to do. Quote Link to comment https://forums.phpfreaks.com/topic/20888-display-id-rather-than-row/#findComment-92551 Share on other sites More sharing options...
bkthomas18 Posted September 15, 2006 Author Share Posted September 15, 2006 [quote author=wildteen88 link=topic=108199.msg435035#msg435035 date=1158342076][quote]By ID number i mean the id number of the actual row, not the row number.[/quote]Then your original code should be fine:[code=php:0]echo ('<a href="1.php?page=' . $row['id'] . ' ">' . $row['name'] . ' </a><br />');[/code]$row['id'] holds the id number of the row in the database, thats is asociated with the name ($row['name']).I'm a little confused at what you are trying to do.[/quote]Thats what i thought but its not working. Here is an example:1.php?page=6 shows ID 10. Do you see what I mean? Quote Link to comment https://forums.phpfreaks.com/topic/20888-display-id-rather-than-row/#findComment-92556 Share on other sites More sharing options...
wildteen88 Posted September 15, 2006 Share Posted September 15, 2006 Could you explain what this code is supposed to and what your aim is. As looking at your code you have implemented pagination to pagenate your results. However you use $page ($_GET['page']) to do something else. Which is where I'm getting confused.Do you want to use $_GET['page'] to fetch more information based on the Name you click? Quote Link to comment https://forums.phpfreaks.com/topic/20888-display-id-rather-than-row/#findComment-92559 Share on other sites More sharing options...
bkthomas18 Posted September 15, 2006 Author Share Posted September 15, 2006 [quote author=wildteen88 link=topic=108199.msg435043#msg435043 date=1158342614]Could you example what this code is supposed to and what your aim is. As looking at your code you ahve implemented pagination to pagenate your results. However you are use page ($_GET['page'] to do something else. Which where I'm getting confused.Do you want to use $_GET['page'] to fetch more information based on the Name you click?[/quote]Yes I want to use $_GET['page'] to fetch information from the id specified and display it in 1.php. Here is the code for 1.php:[code]<?php// Database Connectionmysql_connect('localhost','user','pass');mysql_select_db('db');// If current page number, use it// if not, set one!if(!isset($_GET['page'])){ $page = 1;} else { $page = $_GET['page'];}// Define the number of results per page$max_results = 1;// Figure out the limit for the query based// on the current page number.$from = (($page * $max_results) - $max_results); // Perform MySQL query on only the current page number's results$sql = mysql_query("SELECT id, name, city, state, phone, age, height, weight, hairc, eyec, occupation, income, networth, benefactor, benyn, other, datingsit, common, companion, traveler, perfectwoman, heighta, heightb, weighta, weightb, agea, ageb, haircolor, race, bodytype, specific, hour34, investa, investb FROM gentleman LIMIT $from, $max_results");while($row = mysql_fetch_array($sql)){ // Build your formatted results here. echo ('<table border="1" cellspacing="1" style="border-collapse: collapse" bordercolor="#000066" width="650" cellpadding="5"> <tr><td colspan="3" bgcolor="#D6DFEF" height="16" bordercolor="#FFFFFF"> </td></tr> <tr> <td height="30" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" bgcolor="#EFF3F7" bordercolor="#FFFFFF">ID</td> <td height="30" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['id'] . ' </td> </tr> <tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Full Name </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['name'] . '</td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"></td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">City</font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><p>' . $row['city'] . ' </p> </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"></td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">State</font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['state'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"></td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Phone</font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['phone'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Age</font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['age'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Height</font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['height'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Weight</font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['weight'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Hair Color </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['hairc'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Eye Color </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['eyec'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Occupation/ Business </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['occupation'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Income</font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">$ ' . $row['income'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Net Worth </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">$ ' . $row['networth'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Benefactor Situation? </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['benyn'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> Type of date match preferred<font face="Verdana" size="2"> </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['benefactor'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font size="2" face="Verdana">If other, specified </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['other'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Dating Situation </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['datingsit'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF">favorite activities/ hobbies and those you would like your date to have in common</td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['common'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td><td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF">When, how often, and where would you plan or expect to spend quality time with your companion?</td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['companion'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td><td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF">Would you like your dating match to be available for travel or do you prefer to meet new girls to date in each city?</td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['traveler'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td><td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF">Describe your idea of the perfect woman for you. Include hobbies, interests, etc.</td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['perfectwoman'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Height Range </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['heighta'] . ' To ' . $row['heightb'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Weight Range </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['weighta'] . ' To ' . $row['weightb'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Age Range </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['agea'] . ' To ' . $row['ageb'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Hair color preference </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['haircolor'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Race</font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['race'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font size="2" face="Verdana">Body Type </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['bodytype'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Bra Size </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['brasize'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td><td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">bodytype</font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font size="2" face="Verdana">Specific Preferences </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['specific'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Commit to 3 or 4 hour lunch/ dinner date </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['hour34'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Monthly amount to invest on date, if benefactor. </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">$ ' . $row['investa'] . ' To $ ' . $row['investb'] . ' </td></tr></table>');}// Figure out the total number of results in DB:$total_results = mysql_result(mysql_query("SELECT COUNT(id) as Num FROM gentleman"),0);// Figure out the total number of pages. Always round up using ceil()$total_pages = ceil($total_results / $max_results);// Build Page Number Hyperlinksecho "<center>Select a Page<br />";// Build Previous Linkif($page > 1){ $prev = ($page - 1); echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$prev\"><<Previous</a> ";}for($i = 1; $i <= $total_pages; $i++){ if(($page) == $i){ echo "$i "; } else { echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\">$i</a> "; }}// Build Next Linkif($page < $total_pages){ $next = ($page + 1); echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$next\">Next>></a>";}echo "</center>";?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/20888-display-id-rather-than-row/#findComment-92564 Share on other sites More sharing options...
craygo Posted September 15, 2006 Share Posted September 15, 2006 well you can't use page because your pagination is using it and why would you use pagination when you are only calling information on 1 row. It is also not going to work because you are not telling the page to look for the id as being set.[code]<?php// Database Connectionmysql_connect('localhost','user','pass');mysql_select_db('db');if(isset($_GET['id'])){// put query here to pull the record$id = $_GET['id'];$sql = "SELECT * FROM gentleman WHERE id = '$id'";} else {// If current page number, use it// if not, set one!if(!isset($_GET['page'])){ $page = 1;} else { $page = $_GET['page'];}// Define the number of results per page$max_results = 1;// Figure out the limit for the query based// on the current page number.$from = (($page * $max_results) - $max_results); // Perform MySQL query on only the current page number's results$sql = mysql_query("SELECT id, name, city, state, phone, age, height, weight, hairc, eyec, occupation, income, networth, benefactor, benyn, other, datingsit, common, companion, traveler, perfectwoman, heighta, heightb, weighta, weightb, agea, ageb, haircolor, race, bodytype, specific, hour34, investa, investb FROM gentleman LIMIT $from, $max_results");while($row = mysql_fetch_array($sql)){ // Build your formatted results here. echo ('<table border="1" cellspacing="1" style="border-collapse: collapse" bordercolor="#000066" width="650" cellpadding="5"> <tr><td colspan="3" bgcolor="#D6DFEF" height="16" bordercolor="#FFFFFF"> </td></tr> <tr> <td height="30" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" bgcolor="#EFF3F7" bordercolor="#FFFFFF">ID</td> <td height="30" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><a href="'.$_SERVER['PHP_SELF'].'?id='.$row['id'].'">'.$row['id'].'</td> </tr> <tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Full Name </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['name'] . '</td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"></td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">City</font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><p>' . $row['city'] . ' </p> </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"></td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">State</font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['state'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"></td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Phone</font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['phone'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Age</font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['age'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Height</font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['height'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Weight</font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['weight'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Hair Color </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['hairc'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Eye Color </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['eyec'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Occupation/ Business </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['occupation'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Income</font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">$ ' . $row['income'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Net Worth </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">$ ' . $row['networth'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Benefactor Situation? </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['benyn'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> Type of date match preferred<font face="Verdana" size="2"> </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['benefactor'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font size="2" face="Verdana">If other, specified </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['other'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Dating Situation </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['datingsit'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF">favorite activities/ hobbies and those you would like your date to have in common</td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['common'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td><td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF">When, how often, and where would you plan or expect to spend quality time with your companion?</td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['companion'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td><td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF">Would you like your dating match to be available for travel or do you prefer to meet new girls to date in each city?</td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['traveler'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td><td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF">Describe your idea of the perfect woman for you. Include hobbies, interests, etc.</td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['perfectwoman'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Height Range </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['heighta'] . ' To ' . $row['heightb'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Weight Range </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['weighta'] . ' To ' . $row['weightb'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Age Range </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['agea'] . ' To ' . $row['ageb'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Hair color preference </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['haircolor'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Race</font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['race'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font size="2" face="Verdana">Body Type </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['bodytype'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Bra Size </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['brasize'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td><td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">bodytype</font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font size="2" face="Verdana">Specific Preferences </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['specific'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Commit to 3 or 4 hour lunch/ dinner date </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">' . $row['hour34'] . ' </td></tr><tr><td height="30" width="4" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> </td> <td height="30" width="295" bgcolor="#EFF3F7" bordercolor="#FFFFFF"><font face="Verdana" size="2">Monthly amount to invest on date, if benefactor. </font></td><td height="30" width="812" bgcolor="#EFF3F7" bordercolor="#FFFFFF">$ ' . $row['investa'] . ' To $ ' . $row['investb'] . ' </td></tr></table>');}// Figure out the total number of results in DB:$total_results = mysql_result(mysql_query("SELECT COUNT(id) as Num FROM gentleman"),0);// Figure out the total number of pages. Always round up using ceil()$total_pages = ceil($total_results / $max_results);// Build Page Number Hyperlinksecho "<center>Select a Page<br />";// Build Previous Linkif($page > 1){ $prev = ($page - 1); echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$prev\"><<Previous</a> ";}for($i = 1; $i <= $total_pages; $i++){ if(($page) == $i){ echo "$i "; } else { echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\">$i</a> "; }}// Build Next Linkif($page < $total_pages){ $next = ($page + 1); echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$next\">Next>></a>";}echo "</center>";}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/20888-display-id-rather-than-row/#findComment-92575 Share on other sites More sharing options...
bkthomas18 Posted September 15, 2006 Author Share Posted September 15, 2006 [quote author=craygo link=topic=108199.msg435059#msg435059 date=1158343996]well you can't use page because your pagination is using it and why would you use pagination when you are only calling information on 1 row. It is also not going to work because you are not telling the page to look for the id as being set.[/quote]What would be the correct way to call the rows by id? I'm new to this and very confused. All help is greatly appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/20888-display-id-rather-than-row/#findComment-92578 Share on other sites More sharing options...
craygo Posted September 15, 2006 Share Posted September 15, 2006 I changed your code and put it above, just copy and paste it. I did not finish the sql and output of the data for the specific row. Insert that after.[code]// put query here to pull the record$id = $_GET['id'];$sql = "SELECT * FROM gentleman WHERE id = '$id'";[/code]Ray Quote Link to comment https://forums.phpfreaks.com/topic/20888-display-id-rather-than-row/#findComment-92589 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.