Click here to Skip to main content
15,886,771 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have multiple images of students and those are scrolling in my website.
And i have a students table in database.Now, when i click on a particular student image in my website it will display the details of particular Student from students table.
Posted

1 solution

That is a pretty much database job, to query the data about the Student. What you would do, is to create a table for a Student that will contain all of the information about him, including his picture. The table can be like this,

StudentID | Name | FatherName | Picture | Course [| other columns...]
1         | Ahmad| Abdullah   | Pic.png | .. remaining data 


.. now there are some images in your website, which (as you say) can be viewed (because you said scrolling; I assume you meant that the user can scroll to see all of the images in the website) and the image has a name (or better if it has an ID). You can create a hyperlink for those images, to direct to the profile page for the student. Like this,

HTML
<!-- ASP.NET version of code, change it to your language -->
<a href="~/profile/@Student.StudentID">
   <!-- Show the image... -->
   <img src="~/Images/@Student.Picture" alt="Student Picture" />
</a>


.. now once the user will click, he will be redirected to the Profile page, and there will be the student's ID assosiated at the end of the URL. On that page you can use that StudentID to query the database, and get all of the data assosiated to him.

Tip: Always try to make a single table as much as you can try. Do not duplicate the data inside the tables, but save the data for every object (Student is an object) inside the same table, instead of creating a different table for each of the attribute he is having (Name, FatherName, Picture, Course etc).
 
Share this answer
 
Comments
Member 11052105 20-Dec-14 5:14am    
Hi sir ..i have a little confusion.
<!-- Show the image... -->
<img src="~/Images/@Student.Picture" alt="Student Picture" />

All the student details have to redirected to Profile page only.
if don't mind can you explain briefly
Afzaal Ahmad Zeeshan 20-Dec-14 5:45am    
This is the image of the student, which now has been converted to a hyperlink so that if you click on the image, it will redirect you to the profile page.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900