Now that I have selecting the ID working (thanks sitepoint forums!) I have a new problem.
I want to determine whether the data in a single cell (the 2nd column in the last row) is either 'on' or 'off' - previously successfully set by me.
This is the code I have but the "mysql_result" line produces the following error:
Warning: mysql_result(): Unable to jump to row 20 on MySQL result index 5 in /var/www/vhosts/sawebdev.ca/httpdocs/salsa/test.php on line 30
When I echo $result I get "$result Resource id #5" - which I presume is "index 5" - what is that? The row count is correct (20) and the field I am trying to get the data from ('session') is the 2nd one. I don't understand why it's "unable" to jump to row 20 when there are, in fact 20 rows at this point.
Here's the code:
//get last row of table
$sql = "SELECT COUNT(*) FROM congress";
$rowsresult = mysql_query($sql);
list($numRows) = mysql_fetch_row($rowsresult);
echo '$numRows ' . $numRows . "<br>"; //the number of rows in your table
//select 'session' column data
$query = "SELECT session FROM congress";
$result = mysql_query($query) or die(mysql_error());
echo '$result ' . $result . "<br>";
//put data of last 'session' column into $session
//THIS IS CODE THAT PRODUCES THE ERROR
$session = mysql_result($result,$numRows) or die(mysql_error());