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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.