View Full Version : Database/website coding help needed :)
09-21-2007, 04:48 PM
Hey, all, first post here...
I have to do a web design project, and I'm not really sure how to approach it.... i already started to see how it would work.
all these question marks will be pictures of people (>500), i guess arranged in photoshop and sliced (that's what i did in this example). then, when i click any picture of a person, it has to pop up with a page showing a picture, the persons name, and some other info. (if you click any of the top left question marks you will see what i need).
so now my question is how to do this using databases (or anything more appropriate for the task)... because doing it all by hand by creating a new html popup and inputting the data by hand and then linking them all together would be tedious. does anyone have any good ideas on what code to use to make this work?
btw, if i posted this in the wrong forum, then tell me.
any help greatly appreciated
thanks a lot!
09-21-2007, 05:10 PM
Well you could use a mysql database. Here is what I think you will need.
A place to upload the images.
During the upload process you would use a server side script to make thumbnails on the fly of the larger images.
When you upload the image, you will add the location of the larger image and the thumbnail into the database.
After doing this it will be a matter of retrieving the images and creating the html for them on the fly.
You won't need to make a new page for every image because you could do something like this
<a href="display.php?img=images/imagename.jpg" onclick="window.open(this.href,'photo','width=400,height=400');return false"><img src="images/tn_imagename.jpg" width="100" height="100" alt=""></a>
Of course this is all just the basics of what you will need. If you don't know php or mysql then good luck. Looks like you will be on a steep learning curve for a while.
09-21-2007, 05:15 PM
Hi rafal -- and Welcome!
There are two questions that need to be answered before we can help you accomplish this task. They are not necessarily simple, but they are very important ones.
Which Server Side Language (PHP, ASP, .Net, JSP, Ruby, Ruby on Rails) do you plan on using?
What platform are you hosting this on? Linux or Windows (Apache or IIS)?
These questions, above all else in the beginning, is something you really need to consider. Each language has its pros and cons, and each can connect with and works well with MySQL. Each web server again has its pros and cons, and we can discuss those as well.
Again, welcome, and let us know what you have decided.
09-21-2007, 06:48 PM
wow, really fast replies! thanks a lot
my hosting has linux and apache. as to the language, i'm not sure what i want to use - i guess you would recommend PHP for what i need to do, no? or maybe something better...
lots of thanks
i would really appreciate if anyone could help me anymore.
09-21-2007, 08:42 PM
It looks as though you have just one system you can use, and that is LAMP (Linux, Apache, MySQL, and PHP).
That's your starting point. Read up on PHP and how it you can code in it, and that would be where to start.
You really need to read up on it before you start, or you will be making a mountain out of a mole-hill.
09-21-2007, 09:41 PM
haha, a mountain out of a mole hill... :) nice, yeah i don't know a lot about php and mysql
btw, can i create the tables using MS Access and then upload it as mysql table?
i guess what i would need is have each of these pics to have a filename (such as pic1, pic2 etc) and then upon clicking, i would need it to open a template, contact a database, retrieve the name/other personal data/ info and put it into the template. am i thinking in the right direction? does anyone have any example code for the thing i need to do?
thanks a lot!!!
09-22-2007, 08:27 AM
so i got a little bit of it to work. http://bestcheapebooks.com/other/thomasproject/1/
now when you click the very top left question mark it opens a box and has a name, class of, and quote things.
i put this php code into my document:
mysql_connect("localhost", "*********", "*******") or die(mysql_error());
mysql_select_db("******") or die(mysql_error());
$result = mysql_query("SELECT * FROM Table1")
$row = mysql_fetch_array( $result );
echo "Name: ".$row['stdname'].$newline;
echo "Class of: ".$row['stdclassof'].$newline;
echo "Quote: ".$row['stdquote'].$newline;
and this is how the table i made looks in phpmyadmin:
is this the right way to make a table? now my question is, how do i write php code to make it select for example the data from stdid 2, and not stdid1 (like it does always in the example code i put up)
so lets say i went it the idea that each time a user clicked an image, it would go to studentinfo.php?id=###. But now my question is, when i replace the ###, how do i write the code in php so that it it opens up studentinfo.php, and pulls the data from the correct stdid spot, and puts relevant name, class of, and quote texts?
i hope you understand what i mean :)
thanks for any help!
09-24-2007, 02:05 PM
Hi Rafal --
From what you showed us, your table structure looks OK, but as I cannot see the entire thing, I cannot comment on the entire table. As to your stdquote information, I would be really careful on putting student 'quotes' like your first record online. Very, very dangerous ground.
Now, to answer your second question -- how do I pull a specific record, you would use a WHERE statement in your query.
$result = mysql_query("SELECT * FROM Table1 WHERE id = '$REQUEST_[id]'", $db) or die(mysql_error());
Just remember to put in code that:
a) checks to see if you are looking for a specific ID. If not, then run the full table.
b) checks to make sure that you are looking for a numeric ID, so that SQL injection doesn't happen.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.