If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > output info from database to layout

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-05-11, 05:32
gwolf2u gwolf2u is offline
Registered User
 
Join Date: Jun 2011
Posts: 1
output info from database to layout

first of all hi guys
this is my first post here
as you might think, I'm new to mysql
well now related to my question
I have a database created and I want that for each row to output some data in my php page
in short
my table is named info
and has two columns, name and image
now I want for each name to output something like this

Code:
<a href="page/{name}"><img src="images/{image}.jpg" onMouseOver="this.src='images/over.png';" onMouseOut="this.src='images/{image}.jpg';"></a>
my mysql database looks like this


Code:
CREATE TABLE IF NOT EXISTS `info` (
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'game name',
  `image` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'image name',
  PRIMARY KEY (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


INSERT INTO `info` (`name`, `image`) VALUES
('Name 1', 'image1'),
('Name 2', 'image2'),
('Name 3', 'image3');
now any ideas how can I do this
again I'm new to this so no genius here
Reply With Quote
  #2 (permalink)  
Old 06-05-11, 06:54
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
this isn't a mysql question, because the query that you want is dead simple...
Code:
SELECT name
     , image
  FROM info
how to take that information and prepare your html from it, that's a php question
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On