I am trying to query the table bets but it seems it is not returning anything, even though there is data in it which matches the criteria
I'm not sure if I'm missing something completely obvious or not
Here is my code,
<?php
//Begin session
session_start();
//Get pool var
if(isset($_GET['pool'])) {
$_SESSION['pool'] = $_GET['pool'];
$pool = $_SESSION['pool'];
}
//Include database connection details
require_once('config.php');
//Array to store validation errors
$errmsg_arr = array();
//Validation error flag
$errflag = false;
//Connect to mysql server
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if(!$link) {
die('Failed to connect to server: ' . mysql_error());
}
//Assign memberid
$memberid = $_SESSION['SESS_MEMBER_ID'];
echo "POOLNAME $pool<br>";
echo "MEMBERID $memberid<br>";
//Select database
$db = mysql_select_db(DB_DATABASE);
if(!$db) {
die("Unable to select database");
}
$result = mysql_query($link,"SELECT * FROM bets WHERE member_id='$memberid'");
echo "RESULT $result";
echo "SQL executed<br>";
echo "Executing loop<br>";
while($row = mysql_fetch_array($result))
{
echo "test<br>";
$matchid = $row['match_id'];
$betAmount = $row['bet_amount'];
$teamname = $row['team_name'];
echo "$betAmount credits placed on team: $teamname for match: $matchid";
}
?>