Ok. So I tried the options above but the linked page opens with this error:
"Query: SELECT `join_date`, `name`, `location`, `link` FROM `members` WHERE `name` =
Error: 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 '' at line 1"
Here is my code for the first and second pages, maybe someone can tell me where I'm going wrong?:
-----------------------------------
(results.php - this page works just fine)
<?php
include("dbinfo.php");
$conn = mysql_connect($host,$username,$password);
if(!$conn) die("Failed to connect to database!");
$status = mysql_select_db($db, $conn);
if(!$status) die("Failed to select database!");
$getMembers = mysql_query('SELECT name FROM members ORDER BY id') or die(mysql_error());
$numMembers = mysql_num_rows($getMembers);
echo '<ul>
';
for($count = 1; $count <= $numMembers; $count++)
{
$row = mysql_fetch_array($getMembers);
echo '<li><a href="member_details.php?name=' . $row['name'] . '">' . $row['name'] . '</a></li>
';
}
echo '</ul>
';
mysql_close();
?>
-----------------------------------
(member_details.php)
<?php
include("dbinfo.php");
$conn = mysql_connect($host,$username,$password);
if(!$conn) die("Failed to connect to database!");
$status = mysql_select_db($db, $conn);
if(!$status) die("Failed to select database!");
if( isset($_GET['name']) && ctype_digit($_GET['name']) ) {
$name = (int) $_GET['name'];
}
$query = ("SELECT `join_date`, `name`, `location`, `link` FROM `members` WHERE `name` = $name");
if( $result = mysql_query($query) ) {
$array = mysql_fetch_assoc($result);
} else {
echo "Query: $query<br>Error: " . mysql_error();
}
?>
Hope my code is not a mess!! As I said I'm just starting out with this...
FF