I have an error stating:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Resource id #3' at line 1
Im not sure how to deal with this- here is my first set of code:
<?php
$user = "root";
$host = "localhost";
$password = "";
$connection = mysql_connect($host, $root, $password) or die ("Couldn't connect to server.");
$database = "courses";
$db = mysql_select_db($database) or die ("Couldn't select database.");
$sql = "SELECT coursecode FROM trainingtopics";
//echo $sql."<br>";
$result = mysql_query($sql) or die(mysql_error());
echo $result."=result<br>";
while($row=mysql_fetch_array($result))
{ // NOTE this one ABOVE the echo
//echo "result found!";
//echo $row[0];
echo "<a href=\"details.php?course=".$row[0]."\">".$row[0]."</a><br>";
}
?>
and here is my processing page called details.php
<?php
$user = "root";
$host = "localhost";
$password = "";
$connection = mysql_connect($host, $root, $password) or die ("Couldn't connect to server.");
$database = "courses";
$db = mysql_select_db($database) or die ("Couldn't select database.");
if (isset($_GET['course'])) {
$course = mysql_real_escape_string($_GET['course']);
$res = mysql_query("SELECT * FROM trainingtopics WHERE coursename = '$course'");
$result = mysql_query($res) or die(mysql_error());
echo $result."=result<br>";
if ($res && mysql_num_rows($res) != 0) {
// get results from query
// output to browser with echo
} else {
//course name not found
//note: the query may have failed to so maybe check for that.
}
} else {
//no course specified
}
?>
any experienced assistance would be greatly appreciated- I have come on leaps and bounds thx to you guys and im nearly there!!