PDA

View Full Version : Seeking advice for a web project



pstudio
23-09-2007, 06:06 PM
Hey all you out there :)
In the near future I'll have to make a small survey/rating system for a Danish forum I'm a member off. Basically it's a contest where users have to rate a series of pictures each week for a month or so. I'm targeting an Apache Server with mysql and PHP just in case.
The idea is, that the users register them self in a database and then they'll have to rate the images. Each week I'll add some new images to rate, so the user must be able to login and ontinue rating.
My thought is to create a couple of databases. One for the users and one for the series off images with a record for each user who has rated the images. I want the user presentation to look kind off nice and let the user be able to go forward and back quickly without wating for a page to load. Therefore I'm thinking about writing an Applet. (The user shouldn't download anything to vote)
I'm also thinking about making some few PHP scripts to tie it all together because I'm not familiar with accessing databases through Java.

Now I'm requesting thoughts on this solution and possible better ways to do it. I'm not familiar with any way to make this kind of project with pascal, so if there are ways to o it I'm listening.

WILL
23-09-2007, 08:53 PM
It sounds to me like this is going to be your first web application. Which is alright as you have to start somewhere...

I wouldn't recommend Java as it requires the installation of an extra runtime, which for some is not convenient and some just don't like it. You can just as easily get the same quick loading effect using the AJAX technology and a little know how.

Do a quick google for the 'XMLHttpRequest' object. There are some really good tutorials on it's usage and functionality, I think you'll find it completely changes the way a webpage becomes dynamic!

As for your database (singular) The structure of a database works as follows:

Database->Table->Record->Field

You only need 1 database which you will have 1 table for users and 1 table for your images.

To give you an example of how this is like Pascal...

Think of a Table as a Record and each variable within the record with it's own type. (INT, VARCHAR, DATETIME, FLOAT, etc...) A database is really just a series of tables that you can access to retrive the records you want with a query string. (in the form of a SQL command)

Here is the mysql page in the PHP manual: http://ca3.php.net/mysql

You are looking to go through this process:

1) Connect to your DB server (http://ca3.php.net/manual/en/function.mysql-connect.php) (know your server address, username and password)
2) Select your DB (http://ca3.php.net/manual/en/function.mysql-select-db.php)
3) Run your query string! (http://ca3.php.net/manual/en/function.mysql-query.php) (some knowledge of SQL helps; http://dev.mysql.com/doc/refman/5.0/en/sql-syntax.html)
4) Fetch the next record from your results into a record object. (http://ca3.php.net/manual/en/function.mysql-fetch-assoc.php) ()
5) Access the fields using the returned associated array. (Not the only way, but this is a heck of a lot easier!)
6) Repeat 3 if you need more data...
7) Close DB Connection! (http://ca3.php.net/manual/en/function.mysql-close.php)

It's not really all that hard to work with. ;)


The rest depends on how you want the page to flow/function.

pstudio
24-09-2007, 10:31 AM
Thanks for your reply


As for your database (singular) The structure of a database works as follows:

Database->Table->Record->Field

You only need 1 database which you will have 1 table for users and 1 table for your images.

To give you an example of how this is like Pascal...

Think of a Table as a Record and each variable within the record with it's own type. (INT, VARCHAR, DATETIME, FLOAT, etc...) A database is really just a series of tables that you can access to retrive the records you want with a query string. (in the form of a SQL command)

Here is the mysql page in the PHP manual: http://ca3.php.net/mysql

You are looking to go through this process:

1) Connect to your DB server (know your server address, username and password)
2) Select your DB
3) Run your query string! (some knowledge of SQL helps; http://dev.mysql.com/doc/refman/5.0/en/sql-syntax.html)
4) Fetch the next record from your results into a record object. ()
5) Access the fields using the returned associated array. (Not the only way, but this is a heck of a lot easier!)
6) Repeat 3 if you need more data...
7) Close DB Connection!
Actually I allready knew that (I've taken a database course at uni). I just wasn't focused on the database aspect and failed to use right terminology. My bad :oops:


I wouldn't recommend Java as it requires the installation of an extra runtime, which for some is not convenient and some just don't like it. You can just as easily get the same quick loading effect using the AJAX technology and a little know how.

I don't think it would actually be a problem if the users had to use a runtime enviroment like Java. Actually I believe that most user for this app would allready have it installed.


Do a quick google for the 'XMLHttpRequest' object. There are some really good tutorials on it's usage and functionality, I think you'll find it completely changes the way a webpage becomes dynamic!
This seems interesting and I'll look deeper into it. If I can avoid using Java and still get a result that I'm satisfied with using AJAX technology I'll go that way.