iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Database Discussion Forum This is the place to find help resolving those nagging questions you have about implementing and using all kinds of databases. Need help writing a query? Need an opinion on Oracle? Post here!

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-05-2005, 05:27 PM
richkoi's Avatar
WebProWorld Veteran
 
Join Date: Aug 2003
Location: Atlanta, GA
Posts: 451
richkoi RepRank 0
Default NEW TO PHP mySQL

I am new to PHP and mySQL and am trying to generate a simple website that is a resource directory that lists resources by City.

Here is the query I have so far:

Quote:
<? $query = "SELECT * from resourcedirectory where appr=1 GROUP BY city ORDER BY last";
$result=mysql_query($query);
$num=mysql_numrows($result);?>
What code would I use from here to display this data?

This is what I have now, but it is not giving me the results I want and I don't think I am coding it as well as I should:

Quote:
<?
$i=0;
while ($i < $num) {
$LAST=mysql_result($result,$i,"last");
$FIRST=mysql_result($result,$i,"first"); $COMPANY=mysql_result($result,$i,"company"); $CITY=mysql_result($result,$i,"city"); $TELE=mysql_result($result,$i,"tele"); $WEBSITE=mysql_result($result,$i,"website");
?>

<? echo $COMPANY; ?>

<? echo $FIRST; ?> <? echo $LAST; ?>



City: <? echo $CITY; ?>

Telephone: <? echo $TELE; ?>

E-mail:<? echo $EMAIL;?>


Website: <? echo $WEBSITE; ?></p>

<?
$i++;
}
;
?>
Any help would be greatly appreciated.

Thanks,

Rich
__________________
Me
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Database Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 08:45 AM.



Search Engine Optimization by vBSEO 3.3.0