Jump to content

output info from database to layout


gwolf2u

Recommended Posts

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

 

<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

 

 

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 :)

Link to comment
https://forums.phpfreaks.com/topic/238471-output-info-from-database-to-layout/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.