Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 06-07-2004, 12:01 AM   #1
Member (10 bit)
 
GSXdan's Avatar
 
Join Date: Jun 2002
Location: P-burg, Ohio, USA
Posts: 555
Send a message via AIM to GSXdan
php question

OK so i finally got some free time to start learning php, and i get to this example(see code), but it wont work properly. The guess number counter should increment each time a incorrect guess is entered, but it doesnt. Any idea why?


TIA ^dan
Attached Files
File Type: zip listing9.7.zip (608 Bytes, 63 views)
GSXdan is offline   Reply With Quote
Old 06-07-2004, 05:43 AM   #2
Member (5 bit)
 
Join Date: Nov 2001
Location: The Crimson Permanent Assurance
Posts: 23
Instead of:

PHP Code:
$num_tries = (isset($_POST[num_tries])) ? $num_tries 0
It works with:

PHP Code:
if($_POST[num_tries]) {
  
$num_tries $_POST[num_tries];
} else {
  
$num_tries 1;

With this method you'll need to do

PHP Code:
$num_tries++; 
in the number too large and number too small conditions.

Domhal
domhal is offline   Reply With Quote
Old 06-07-2004, 06:02 AM   #3
Member (10 bit)
 
Join Date: Nov 2001
Posts: 610
Send a message via Yahoo to MSIuser
I would do this because I don't think what he said gives a 0 before any guesses. Have a look see what you think but this definitely works.
Attached Files
File Type: zip listing9.7.zip (647 Bytes, 49 views)
MSIuser is offline   Reply With Quote
Old 06-07-2004, 10:00 AM   #4
Member (10 bit)
 
GSXdan's Avatar
 
Join Date: Jun 2002
Location: P-burg, Ohio, USA
Posts: 555
Send a message via AIM to GSXdan
Thanks guys. MSIuser i used your approach and that worked great!
GSXdan is offline   Reply With Quote
Old 06-07-2004, 10:13 AM   #5
Member (10 bit)
 
Join Date: Nov 2001
Posts: 610
Send a message via Yahoo to MSIuser
Glad to be of help. I'm making a website you may be interested in if you looking to learn php. check out http://forums.phpchallenge.com

If this is against forum rules delete link, just thought it would help him out.
MSIuser is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 06:47 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2