For some reason i cant get the echo string to work but here is my php code i would appreciate if you or anybody else here could get something out of it.
the error message says
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
My php code for the detail page Where the error should be located at line 1
or am i way off?
1<?php require_once('Connections/site1.php'); ?> is the problem on this line ?
<?php
$colname_Recordset_2 = "id";
if (isset($GET['goto'])) {
$colname_Recordset_2 = (get_magic_quotes_gpc()) ? $GET['goto'] : addslashes($_GET['goto']);
}
mysql_select_db($database_site1, $site1);
$query_Recordset_2 = sprintf("SELECT * FROM web_members WHERE id = %s", $colname_Recordset_2);
$Recordset_2 = mysql_query($query_Recordset_2, $site1) or die(mysql_error());
$row_Recordset_2 = mysql_fetch_assoc($Recordset_2);
$totalRows_Recordset_2 = mysql_num_rows($Recordset_2);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #000000;
}
body {
background-color: #FFFFFF;
}
a:link {
color: #000000;
}
a:visited {
color: #000000;
}
a:hover {
color: #000000;
}
a:active {
color: #000000;
}
-->
</style></head>
<body>
<p><?php echo $row_Recordset2['id']; ?>
</p>
<p><?php echo $row_Recordset2['name']; ?></p>
<p><?php echo $row_Recordset2['lastname']; ?></p>
<p><?php echo $row_Recordset2['email']; ?></p>
</body>
</html>
<?php
mysql_free_result($Recordset_2);
?>
the master page code
<?php require_once('Connections/site1.php'); ?>
<?php
$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
mysql_select_db($database_site1, $site1);
$query_Recordset1 = "SELECT name, lastname, email FROM web_members";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $site1) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (isset($GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<table border="1">
<tr>
<td>name</td>
<td>lastname</td>
<td>email</td>
</tr>
<?php do { ?>
<tr>
<td><a href="detail.php?goto=<?php echo$row_Recordset_2['id']; ?>"><?php echo $row_Recordset1['name']; ?></a></td>
<td><?php echo $row_Recordset1['lastname']; ?></td>
<td><?php echo $row_Recordset1['email']; ?></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>