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
26
Other forums
how do i display data on a page from mysql
1 - do i use this code at the top of each of my page i wish to only alow access if there as been a s
Table colours fail when extra row added
Hey Gurus,
I got a weird problem with formating the colour of a table made in php. Everything
Storing Values taken from a DB...
Using this code it will generate a short list from my database
<?php
mysql_connect
Multi Dimensional Array Append
Hi Guys
I have a function that returns a multidimentional array eg
$result = functio
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
newbie error
what is wrong with this code ?
<html>
<body>
<?
mysq_num_rows
Hi,
I want to use:
Code: if(mysql_num_rows($ergebnis2)==2)
how can the value 2, be
PHP & Java
Hello,
can PHP code be used inside java code?
Code: <SCRIPT LANGUAGE="Java
PEAR Email Attachment w/ $gpg
I have no issues with this code if I take out the attachement section and include the info in the em
Why doesn't this work? (SSH2)
This is my script:
Code: <?php
$connection = ssh2_connect('213.251.167.109', 22);