# Old Newbie Problem - Select mysql record using url +php - Should be soooo simple!

**URL:** <https://forum.kirupa.com/t/old-newbie-problem-select-mysql-record-using-url-php-should-be-soooo-simple/315573>\
**Category:** programming\
**Created:** [October 29, 2010, 9:32am UTC](https://forum.kirupa.com/t/old-newbie-problem-select-mysql-record-using-url-php-should-be-soooo-simple/315573 "2010-10-29T09:32:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![phatmambo](https://avatars.discourse-cdn.com/v4/letter/p/13edae/32.png) [@phatmambo](https://forum.kirupa.com/u/phatmambo)\
**Post date:** [October 29, 2010, 9:32am UTC](https://forum.kirupa.com/t/old-newbie-problem-select-mysql-record-using-url-php-should-be-soooo-simple/315573/1 "2010-10-29T09:32:30Z")

</div>

I am learning PHP/MySQL and am modifying a tutorial to make a contact database.

All I want is to be able to make a web page for each contact(record) and display one record on each webpage. I want to use the URL feature:

“[http://www.mysite.com/script.php?=item1](http://www.mysite.com/script.php?=item1)” type of thing

Can any help me as I can’t get it to work. I get no errors - it just doesnt display the info. I’m sure I cant be far off as I’ve only modified a working script ever so slightly.

```auto
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
?>

<?
$query="SELECT * FROM contacts WHERE id='$id'";
$result=mysql_query($query);

$num=mysql_numrows($result); 

mysql_close();

echo "<b><center>Database Output</center></b><br><br>";

?>
<table border="0" cellspacing="2" cellpadding="2">
<tr> 
<th><font face="Arial, Helvetica, sans-serif">Name</font></th>
<th><font face="Arial, Helvetica, sans-serif">Phone</font></th>
<th><font face="Arial, Helvetica, sans-serif">Mobile</font></th>
<th><font face="Arial, Helvetica, sans-serif">Fax</font></th>
<th><font face="Arial, Helvetica, sans-serif">E-mail</font></th>
<th><font face="Arial, Helvetica, sans-serif">Website</font></th>
</tr>

<?
$i=0;
while ($i < $num) {
$first=mysql_result($result,$i,"first");
$last=mysql_result($result,$i,"last");
$phone=mysql_result($result,$i,"phone");
$mobile=mysql_result($result,$i,"mobile");
$fax=mysql_result($result,$i,"fax");
$email=mysql_result($result,$i,"email");
$web=mysql_result($result,$i,"web"); 
?>

<tr> 
<td><font face="Arial, Helvetica, sans-serif"><? echo "$first $last"; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo "$phone"; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo "$mobile"; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo "$fax"; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><a href="mailto:<? echo "$email"; ?>">E-mail</a></font></td>
<td><font face="Arial, Helvetica, sans-serif"><a href="<? echo "$web"; ?>">Website</a></font></td>
</tr>
<?
++$i;
} 
echo "</table>";

?>

```
