473,465 Members | 1,444 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Column Value Blues

Howdy,

I am really struggling with the basics here.

PHP/MySQL

I have a database with three columns:

ID, Name, Phone

I want to return all the unique items in Name.

My Query is

$result = mysql_query ( "SELECT Name FROM database")

Let's say there are 20 entries. I want to return all twenty entries with
a <br /> between them.

I have tried to use foreach and while with mysql_fetch_row & _array, but
I can't get it to work. Can anyone help?

Jul 17 '05 #1
1 1471

"Heath" <he*********@belgacom.net> wrote in message
news:40**********************@news.skynet.be...
Howdy,

I am really struggling with the basics here.

PHP/MySQL

I have a database with three columns:

ID, Name, Phone

I want to return all the unique items in Name.

My Query is

$result = mysql_query ( "SELECT Name FROM database")

Let's say there are 20 entries. I want to return all twenty entries with
a <br /> between them.

I have tried to use foreach and while with mysql_fetch_row & _array, but
I can't get it to work. Can anyone help?


Unique items:
$result=mysql_query("SELECT DISTINCT Name FROM table");

Separate data retrieval from presentation - add your <br /> during the
output stage. With apologies to the help for mysql_fetch_array():

while ($row = mysql_fetch_array($result)) {
printf ("Name: %s<br />", $row[0]);
}

Garp
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Frank | last post by:
Hi, we are using oracle clients (Release 9.0.1.0.1 - Production) on an NT4 (Service Pack6) computers. the server is a W2K, (Oracle9i Enterprise Edition Release 9.0.1.1.1 - Production With the...
5
by: Ken1 | last post by:
I am going to drop a primary key from one column and create a new column to be used as primary key in an existing database. The old column was a date column which someone earlier though was a good...
7
by: A Hess | last post by:
I'm working on a little something for my dad and have a question. I have a background graphic which repeats-y down the left side of the page. I want to get the exact same thing down the right side...
2
by: Marc Champagne | last post by:
Hi folks! I have built a VB project in VS.NET 7 which also includes a deployment project. Everything builds ok. When I install the setup package, it installs without a glitch.
4
by: Brian Brane | last post by:
I have properties that wrap DataRow columns as in: public int aNumber { get{ return m_DataRow; } set{ m_DataRow = value; } } If the column happens to contain DBNull, I get a cast exception...
2
by: | last post by:
Hello All, I am having a lot of difficulty trying to bind a templated column, that is programmatically created for a datagrid, to a datasource column. I have a datasource containing 2 columns,...
3
by: Bob Day | last post by:
VS 2003, sql How do you determine the data type of a column if its value is DBNull? 1)Table: Column1 STRING non-nullable 2) Fill to a DataSet via DataAdapter 3) dim Data_Type_Is...
2
by: sp | last post by:
hai i am new to this XSTL and i am trying to write xslt that will filter out the xml value based on Attribute Value. my xml looks like this <catalog> <cd> <title year="1990">Empire...
4
by: Peter Gibbs | last post by:
I need some help with this problem. I'm using Access 2002 with XP. My problem is with a 2-column listbox. My VBA code puts text data into the listbox. The problem is that the text data...
0
VbaNewbee
by: VbaNewbee | last post by:
I have a form with a few filters. Once the user clicks "search button", the code first evaluates my filters, then shows the query results in a List Box" titled backschedule. I have a few text...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.