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


Posted on 16th Feb 2014 07:03 pm by admin

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');
}?>

No comments posted yet

Your Answer:

Login to answer
145 Like 26 Dislike
Previous forums Next forums
Other forums

Date help - fetch dates for Mondays between xxx and yyy?
Does anyone know the best way to do this? I have two dates, say:

2010-01-26 and 2010-05-30

if else problem, help please
i have this script that i made only i try to also put in a if else for for some reason the script is

Remove letter from numeric textbox
I have a textbox that will search the employee database by entering in the employee ID and it will r

Basic Forum Tutorial
Hi, I'm new to PHP. I want to build a basic forum for my site using PHP and MySQL. I've searched t

getting Vars to pass to next page.
Hello all,
I have a confusing situation on my hands, i am a member of a gaming community and we

image upload script not working with png
The basic process of this php code is to take the submitted file, convert it to a small JPG thumbnai

function to return url
Hi,

Can you guys help me giving a function that takes all the contents in a particular field

Date/Time and Checkbox
Hi Everyone,

I am trying to figure out how to insert the current date and tim

Xacute search within SQL results
I have a query that is pulling data, and I want to return a specific value from the results of that

form variables from database help.
Hi all,

I would like to have a form that gives you options based on the results of an mysql q

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash