Jump to content

Please help - should be a simple fix.. driving me nuts


JTapp

Recommended Posts

Everything seemed to be working fine.  I have a table, it alphabetically lists a bunch of cities and relivant city data.

 

However, I found out that the city is showing up only one time when I have can have more than one rows with that City name..  I.e. - I should have 15 rows that are all "Jacksonville" but I am only seeing one.  I guess my code is eliminating what it thinks are duplicates?

 

Here is my code (I renamed field names for communication purposes)

 

 

 

$dbhandle = mysql_connect($hostname, $username, $password)

or die("Unable to connect to MySQL");

 

$selected = mysql_select_db("companies",$dbhandle)

or die("Could not select companies");

 

$query = mysql_query("SELECT* FROM companies GROUP BY City");

while ($row = @mysql_fetch_array($query))

 

 

{

 

$variable1=$row["Email"];

$variable2=$row["WEB"];

 

 

 

echo "<tr bgcolor=\"#dddddd\"><td><center>";

echo $row["City"];

echo ($variable2 != '') ? "<a href=\"$variable2\"></br> Website</a>" : '';

echo ($variable1 != '') ? "<a href=\"mailto:$variable1\">Email</a>" : '';

echo ltrim($row[""], '0');

}?>

         

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.