473,800 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tables from MySQL query results

Cowbie
5 New Member
Hello again,

I'm using a MySQL database and I want to pull results from the database and put them onto a php page. I've currently got it working using the following code, but it's not exactly what I want:

$query = 'SELECT * FROM loan';
$result = mysql_query($qu ery) or die('No Loans Found: ' . mysql_error());

// Printing results in HTML
echo "<table>";
while ($line = mysql_fetch_arr ay($result, MYSQL_ASSOC)) {
echo "<br>\t<tr> \n";
foreach ($line as $col_value) {
echo "\t\t<td>$col_v alue</td>\n";
}
echo "\t</tr>\n";
}
echo "</table>\n";

Basically, I want the table to have a border and a background, but no matter what I try it just messes the code up so it no longer works.

Can anyone throw me a few pointers?
Thanks.
Nov 20 '07 #1
1 1251
brettl
41 New Member
You can always use CSS and add a class to your query result table to set a background color and a border around the table.
Nov 20 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
3061
by: lkrubner | last post by:
I have a webserver through Rackspace. I create a domain. I create an FTP user. I upload some files. I create a database called testOfSetupScript and then I create a database user named setup. I write some PHP code which should, I think, be able to to auto create the tables. The SQL looks like this:
0
1844
by: Stefan Hinz | last post by:
Jim, >> Does MySQL automatically handle deleted row cleanup, or is it necessary to >> periodically do this manually for tables with a lot of deletions? If it's >> manual, what are the SQL commands to do this? Depends on which storage engine you are using. If you are using InnoDB tables, there's no need to "vacuum" tables that way, as InnoDB will do that automatically. If you use MyISAM tables, however, you might be able to speed up...
0
1791
by: Jaime Teng | last post by:
Hi, I have a table: mysql> describe archivetable; +-----------+----------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+----------+------+-----+---------------------+-------+ | sessionid | char(10) | | PRI | | | | username | char(25) | | MUL | | |
1
2426
by: Robert Oschler | last post by:
I read a while back that MySQL will only use one index per query. (If this is not so, please tell me and point me to a doc that gives a good explanation of MySQL's current index usage policy). I'm using MySQL 4.2.x. Here's my dilemma. 1) --------- I have two tables that have records with a FULLTEXT index text field in each of them. The problem is the relationship between the tables is a
10
2111
by: m.k.ball | last post by:
I have three tables, containing information about three people and the cars that they own. One table lists people, one lists cars, and one uses the id's from the other two to compile a list of which models of car each person owns. Bob owns a Ford, Paul owns a Toyota, and Dave owns both a Ford and a Toyota. Simple. How do I create a query that will tell me 'which people own a Ford and
0
2220
by: taras.di | last post by:
Hi everyone, I've come across an extremely strange problem. The exact same query in both mysql command line client, and mysql query browser gives entirely different results. I was hoping someone out there could shed some light. Ok, the query (I've stripped it bare, the real query is a bit more complex)...
10
7708
by: Jim Devenish | last post by:
I have a split front end/back end system. However I create a number of local tables to carry out certain operations. There is a tendency for the front end to bloat so I have set 'compact on close' I think that I have read in some threads (althoug I cannot find them now) that others place such tables in a local, linked database. I could do this but I am interested to know what would be the advantages. And disadvantages, if any. Any...
0
1375
by: Serman D. | last post by:
Hi, I can't understand why mysql allows me to grant lock tables to all tables in a particular database, while it fails to accept the same command applied to a single table only. I've tested on MySQL versions 4.1.20 and 5.0.33 (both running CentOS 4.4 linux on Intel-32) with exact same results. Whats wrong with grant lock tables on a single table?
3
1911
by: mkjame | last post by:
Hi everyone! I am actually coding a php script and I want to return all the values that doesn't have a relation between two tables. Basically I have two tables, one is called users, the other one is called agents, the structure of the users table is the following: ID (auto_increment) | username (email address) | password the structure of the agents table is the following ID (auto_increment) | EmailAddress | city | state | country
2
3903
by: amit2781 | last post by:
Hi, I have created 4 tables in 'amit' database and then I deleted them. Still I able to get information about the table_schema for the table deleted. After drop table when I fire a query for table_schema from information_schema.tables it will give me result as 'amit'. I didn't understand why it is happnes. See the below steps done. mysql> use amit; mysql> show tables; +----------------+
0
9690
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10275
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7576
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5471
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
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 we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.