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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.