Jump to content

Need help with PHP script


TOMMURRAY

Recommended Posts

I am attempting to create a php script for a golf website, the problem is that I am new to PHP and I have become stuck as I can't see were the error lies in the below code. The script calculates based on the variables but I thought I would have a number returned at the end of the script but nothing is displayed can anyone see any errors?

 

if you want to know what the script is supposed to add up like let me know an I will do my best to explain or look up stableford points in golf.

 

Thank you in advance.

 

Tom

 

<?php

 

$count = 0;

$score = 4;

$si = 4;

$handicap = 4;

$par = 4;

 

if ($handicap >= 0) {

if ($score > 0) {

$sp = 0;

if ($handicap = 0) {

$sp = $score;

} else if ($handicap <= 18){

For ($count = 1; $count = $handicap; $count++){

if ($si = $count) {

$sp = $score - 1;

} else {

$sp = $score;

}

}

} else if ($handicap >= 19 && $handicap <= 36){

$handicap = $handicap - 18;

For ($count = 1; $count = $handicap; $count++){

if ($si = $count) {

$sp = $score - 2;

} else {

$sp = $score -1;

}

}

}

if ($sp - 1 = $par){

$stablefordpoints = 1;

echo "$stablefordpoints";

 

} else if ($sp - 2 = $par){

$stablefordpoints = 2;

echo "$stablefordpoints";

 

} else if ($sp - 3 = $par){

$stablefordpoints = 3;

echo "$stablefordpoints";

 

} else if ($sp - 4 = $par){

$stablefordpoints = 4;

echo "$stablefordpoints";

 

} else if ($sp - 5 = $par){

$stablefordpoints = 5;

echo "$stablefordpoints";

}

}

}

 

?>

Link to comment
https://forums.phpfreaks.com/topic/48359-need-help-with-php-script/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.