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

How to write on database when a link is clicked?
Hi, I have a list of products in a gridview. When the link is clicked currently it takes to an ext

gmmktime or mktime
I live in the UK, i am within the GMT (with daylight saving time ie 1 hour difrence between summer a

help with mysql_error()
Hi,

I am trying to insert data into a table, but I am not able to insert it. I wanted to see

switch not getting value
what am i doing wrong?
i want to populate the country list according to the category
i want to

Random Number Generation And Probability
Hello, I am working on a function which has to insert data into a SQL table.

we have to suppl

File upload issues
Hi Guys,

Can anyone see any issues with this code:
Code: $setImage= 'productimages/' . dat

Dealing with code in db query
I am dealing with C code and I need to make sure it is encoded some how to ensure its integrity and

New Search Engine problem
Hey everyone,

I have a ZIP Code Radius search engine already functional. it displays all of t

Working with Global Variables
hi, I'm not really sure why the following code is returning a "Call to a member function getBan

mail() says sent but no email received
My code is quite simple:

Code: <?php
$to = "Ty44ler@yahoo.com";
$subje

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