Jump to content

Recommended Posts

Hello guys,

 

I created one form called Events in that 9 fields there like Id, Title, Eventdesc, video1,video2,video3,video4,video5,video6.

 

This is storing in database and while fetching data from database to frontend. i need to display all the videos video1,video2,video3,video4,video5,video6 for the particular event.

 

For that i need to fetch all the columns for particular row can any suggest me

 

 

Regards,

 

Sumanth

To answer the question explicitly, you should have a primary key column, most people call this the id, and make it an integer auto-incremented. I'm not sure that is what your id is set up as. Then you can call any row by "WHERE id=".

 

For pointers, your posted structure is going to limit you for future expansion (scaling). I would suggest that you normalize your database, which would include making 2 tables. 1 for events, and 1 for video's. In this way, you could have many more than 6 video's for every event, and could easily add pics, comments, or any other thing you might think of.

 

Example:

tables


CREATE TABLE IF NOT EXISTS `events` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(25) NOT NULL,
`description` text NOT NULL,
`event_date` datetime NOT NULL,
PRIMARY KEY (`id`)
);


CREATE TABLE IF NOT EXISTS `videos` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`event` int(11) NOT NULL,
`title` varchar(20) NOT NULL,
`url` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
);

 

Now you can access all your video's for any event, 100's if you wish. To add pictures, music, comments, etc, just add the relevant table, and join it to the events with the event to event.id column.

"SELECT e.title, e.description, v.title AS vidTitle, v.url FROM events AS e JOIN videos AS v ON e.id = v.event WHERE e.id = 1";

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.