|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Voting using PHP/MySQL
Hello,
I recently read an article by Mitch Harper discussing how to setup a voting system on my website using PHP/MySQL, and in regards to the article I would just like to say it was great... the system is working fine. However I would like to take it one step further and I am at a loss on how to do it. At present Mitch's propsed poll system only allows for votng on the current poll. I would like to how if it is possible to actually make it so if a user comes into the site, he or she can vote on not only the current poll but all of the polls that previously existed. Thanks in advance. Brian |
|
#2
|
|||
|
|||
|
php poll question
When I download the support file for the 'Creating a Voting Poll With PHP And MySQL' article it is all machine coded, so I cannot use it. I use linux. Is the file corrupt or am I missing something? The articles here by the way are great. So thanks for that bit. please help. I cannot get any further without it
|
|
#3
|
|||
|
|||
|
I don't really know what you mean by "machine coded" however the support file is not corrupt. I have used it before without any problems.
Just a small question: Do you have PHP & MySQL installed with the database & tables all setup?
__________________
![]() ![]() "Only Linux users see the end of crashes." - Pl4t0 |
|
#4
|
|||
|
|||
|
poll question
Yeah I had set it up from the article but the supportfile.php does not download correctly. I have tried it on two computers -part of the code reads "0fÀ1%*ÆðVCªd" that is not php. In fact the whole file looks like this. I would still like to try this pollout because the article was so well written, but for the moment I am using a poll that I downloaded from sourceforge.
i just want to get my hands dirty and learn. I've changed the ectention to txt - here is the file I downloaded. can anyone help sort this |
|
#5
|
|||
|
|||
|
That's probably the compressed file or something?
Use winzip or winrar for uncompressing it
__________________
Best Regards, Håvard Lindset |
|
#6
|
|||
|
|||
|
That shouldnt be to tough to do. You will jsut have to do some recoding to do the following.
Make a vote list page that shows all the polls, with links to them each havaing there own unqiue id. so like vote.php?pid=1 So in the vote page you would check for pid if it doesnt exist then just use the most recent or active poll. you would need to add code to carry the pid from just showing the poll to actually voting. Perhaps putting a hidden field in the form with the pid in it. |
|
#7
|
|||
|
|||
|
Lindset, thanks man renamed it .zip and did an unzip and yo mother! must remember this trick its cool.
|
|
#8
|
|||
|
|||
|
Re: Hey Lindset -you are right
Quote:
All our support files are zip files, it should say so when you download it, unless your browser has some funny option turned on, then you would get download.zip, anyway for everyone out there, whenever you download a support file, it is a zip file! |
|
#9
|
|||
|
|||
|
man, i downloaded the supportfile for this article, but when I want to add a poll, even I completed all the fields it get me the errors "You didn't complete the title" and "You must complete at least 2 answer options" or something like that.
All I did was to change database credentials to suit my username and password. Any ideas? |
|
#10
|
|||
|
|||
|
seems like your're the secnod person who has reported that. asp_man seems to have that problem too. i'm not sure whats wrong because the support file worked for me.
|
|
#11
|
|||
|
|||
|
look, I'm a newbie with PHP and MySQL but as far as I learned until now, everything seems OK, and I can't figure out why it doesn't work, and that piss me off.
I wonder if it is a PHP configuration problem? PS. I have other tables in the same database and everytime I want to add records it works, but not for the poll. That's why I can't understand. |
|
#12
|
|||
|
|||
|
The code from the support file seems to have been written for PHP configurations with "register_globals" set to on. Most likely, you're running with register_globals set to off.
Do make sure, setup a php file with: PHP Code:
And run it in your browser to check for regiter_globals. If your register_globals is set to off, you will need to modify the code to use the PHP superglobals ($_POST[], $_GET[], etc...). If you need help, let us know.
__________________
____________________________________________ Developer Shed Weekly Writer | DevArticles Forum Moderator Build Your Own KlipFolio Klip With PHP FrankManno.com - Under Construction Design Interactive Group - Under Construction |
|
#13
|
|||
|
|||
|
oh yeah, register_globals was off, i set it on, let's hope it will work now...thx mate for the tip!
|
|
#14
|
|||
|
|||
|
Not a problem... When in doubt check your globals!
But I would stress that you're better off modifying the code to work with globals OFF rather than turning them back on. For security reasons it's better to modify. |
|
#15
|
|||
|
|||
|
Hi guys,
Just a quick note. Those articles were written about 6-8 months ago when the superglobal arrays (i.e. $_GET, $_POST etc) weren't in existance. If you want to use the code now, you'll need register_globals on, or you'll need to replace $HTTP_GET_VARS with $_GET and $HTTP_POST_VARS with $_POST, etc... ![]() |
|
#16
|
|||
|
|||
|
Quote:
Stay away from turning RG 'on' - thats what we refer to in the PHP world as an open invitation to hackers. The below might solve your problem -> PHP Code:
__________________
~ Joe Penn We work for free to help make this a valuable resource on the internet. Do you appreciate the help - did we provide help that will help you prosper and help that has contributed to sharpening your current skill set? Show your appreciation and purchase something from our Amazon Wishlist's - it's simple and a great way to say thank you. Last edited by jpenn : November 8th, 2002 at 09:27 PM. |
|
#17
|
||
|