473,399 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Display Multiple Rows From MYSQL Database with PHP

I know this is probably not too hard to do, but how do I display
multiple rows of a mysql query/recordset. Im having trouble doing
this. I don't just want to display them, but I want to make sure ONE
field in each row gets a variable.

The table name is RecentUploads, the field I want to pull is XML

This is probably something simple that is more experienced, but I've
only been doing this for a couple of months. Any help would be
appreicated.

Thank You

http://www.mytuneslive.com

Jan 10 '06 #1
2 4344
ameshkin wrote:
I know this is probably not too hard to do, but how do I display
multiple rows of a mysql query/recordset. Im having trouble doing
this. I don't just want to display them, but I want to make sure ONE
field in each row gets a variable.

The table name is RecentUploads, the field I want to pull is XML

This is probably something simple that is more experienced, but I've
only been doing this for a couple of months. Any help would be
appreicated.

Thank You

http://www.mytuneslive.com


There are some things the mysql database server can do for you ...

if c = space or c is empty or c p xyz then change it to zero otherwise leave it
as it is (or change it to something else....)

select a, b, case when c is null or c = ' ' or c = 'xyz' then '0' else c end, d,
e, f from table where....

Then simply display the results.

or

$link=mysql_connect($HOST,$USR,$PWD,$DB);
if( $link ) {
mysql_select_db( $DB, $link );
if( $sql ) {
$sql = ereg_replace( ";$", "", $sql );
$sql = ereg_replace( "\\\\", "", $sql );
$result = mysql_query( $sql, $link );
if( $result ) {
echo( "<p>Results: for '$sql;'.</p>\n" );
if( $num = mysql_num_rows( $result ) ) {
echo( "<pre>\n" );
while( $array = mysql_fetch_row( $result ) ) {
while( list($key, $val) = each( $array ) ) {
-->>> here check to see if the val for key = whatever and change it...
echo "$val | ";
} # end while
echo "<br />\n";
} # end while
echo( "</pre>" );
} elseif( $af = mysql_affected_rows( $link ) ) {
echo( "<p>$af rows affected.</p>\n" );
} else {
echo( "<p>Command completed.</p>\n" );
} # end if
} else {
echo( "<p>Bad query: '$sql;'.</p>" );
echo( mysql_errno() . ": " .
mysql_error() . "<br />" );
} # end if
} else {
echo( "<p>Connected to '$DB'.</p>" );
} # end if
} else {
echo( "<p>Bad connection.</p>" );
echo( mysql_errno() . ": " .
mysql_error() . "<br />" );
} # end if
?>
--
Michael Austin.
Jan 10 '06 #2
Michael,
That was a little too complicated. If i were to show you my code, do
you think you could fix it?

Jan 10 '06 #3

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

Similar topics

2
by: scott | last post by:
Hi, I'm having some trouble with something that should be relatively easy. I want to update multiple rows in one of my database tables simultaneously. In my table I have these values: ...
7
by: RotterdamStudents | last post by:
Hello there, i have a strange problem. I can't get php to insert multiple rows at once in a MySQL database. I use the $sql = "INSERT INTO database (a,b,c,d,e) VALUES ('$a', '$b' ,'$c', '$d',...
0
by: LRW | last post by:
I manage our mySQL database through putty (SSH terminal client). And whenever I do a select * from the table that contains ENCODEd passwords, the funky characters do funky things with the display....
2
by: Gnurp Gnarp | last post by:
When the number of columns get large, it becomes increasingly difficult to view the results of a select in a small window (e.g. 80 line xterm) because of line wrapping. Can I have the results of...
1
by: Mark Everett | last post by:
Hi, I am currently running out of space on one of my database servers. Is it possible to move the relevant files for tables onto another drive and instuct MySql to use both folders for it's...
2
by: assgar | last post by:
Hi Developemnt on win2003 server. Final server will be linux Apache,Mysql and PHP is being used. I use 2 scripts(form and process). The form displays multiple dynamic rows with chechboxs,...
10
by: obrienkev | last post by:
Hi all, How do I display multiple database rows in the one textBox? The textBox is bound to the Database table and should display 3 database values. However it displays only one. How do I...
10
by: darkenroyce | last post by:
Hi Guys I am creating a sports database and one of the features involves create drop down dialogue boxes that retrieve data from MySQL tables and provides them as <option> within...
6
by: Al Moodie | last post by:
Hi, I have a MySQL database where I want to updated multiple records. The table has two columns: product_number product_price I have a list with first entry product_price, second entry...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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...

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.