WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Database Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox 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!

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-05-2005, 04:27 PM
richkoi's Avatar
richkoi richkoi is offline
WebProWorld Veteran
 

Join Date: Aug 2003
Location: Columbus, Ohio
Posts: 487
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
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Database Discussion Forum
Tags: mysql, php



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

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



Search Engine Friendly URLs by vBSEO 3.0.0