Jump to content


New Members
  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Cheops

  • Rank
  1. Its badly written but I managed to get it working so I didnt check on how to reduce the number of queries to one though I understood what you were implying and it actually looked simpler and less lines of code
  2. Where exactly do I place this code
  3. I would like to link my HTML form and PHP script such that when a user passes values via the form they are processed by the PHP script and a relevant response given. My PHP script is as follows; <?php //create server and database connection constants define ("DB_SERVER", "localhost"); define ("DB_USER","root"); define ("DB_PASSWORD",""); define ("DB_NAME", "project"); global $con; $con = new mysqli (DB_SERVER,DB_USER,DB_PASSWORD, DB_NAME); //Check server connection if ($con->connect_error){ die ("Connection failed:". $con->connect_error); }else { echo "Connected succes
  4. Here is the code in a more presentable manner, hopefully it looks better function predictor ($home_team, $away_team){ global $con; $result=[0,0]; // For the home team $home_team_strength=get_query_value($con,"SELECT SUM(HTgoals)/Count(*)FROM `results` WHERE Home_team = '$home_team' "); $league_strength=get_query_value($con,"SELECT SUM(HTgoals)/Count(*)FROM `results`"); $home_team_attack_strength=$home_team_strength/$league_strength; $away_team_strength = get_query_value($con, "SELECT SUM(HTgoals)/Count(*)FROM `results` WHERE Away_team='$away_team'"); $away_team_defence_strength=$a
  5. I have a PHP function that queries a database and then uses the results of the different queries to give me a result but I am getting a divide by zero warning, however when I run the queries on the database I get the result I need but on calling the PHP function I get the warning. What could be the problem? Here is the function code function predictor ($home_team, $away_ team){ global $con; $result=[0,0]; // For the home team $home_team_strength=get_query_value($ con,"SELECT SUM(HTgoals)/Count(*) FROM `results` WHERE Home_team = '$ home_team' "); $league_strength=get_query_va
  • 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.