No data return
Posted: Tue Aug 05, 2003 1:11 am
Hi, I tried this many times and I don't know what is wrong with it. No error message is coming up but the dropdown menu to choose the contact is empty.
I do get an parse error on the show_contact.php in the first select statement:
Maybe you need the whole code:
I hope somebody can tell me what the hack is going on or wrong here! THANKS
Code: Select all
<?
include 'db.php';
$sql = "SELECT userid, first_name, last_name FROM $table_name ORDER BY last_name";
$result = mysql_query($sql,$connection) or die(mysql_error());
$num = mysql_num_rows($result);
if ($num < 1) {
$display_block = "<br><b><center>Sorry! No results found.";
} else {
while($row = mysql_fetch_array($result)){
$userid = $rowї'userid'];
$first_name = $rowї'first_name'];
$last_name = $rowї'last_name'];
$option_block .= "option value="$userid">$last_name, $first_name</option>";
}
$display_block = "<form method="POST" action="show_contact.php">
<p><b>Contacts:
<select name="userid">
$option_block
</select>
<input type="submit" name="submit" value="Select this Contact"<p>
</form>";
}
?>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
Modify Contact
<? echo "$display_block"; ?>
<br><p><a href="tools_admin.php">Return to Main Menu</a></p>
</body>
</html>Code: Select all
sql = "SELECT first_name, last_name, email_address, telephone_number, company_name, address,
city, state, zip_code, username, password, user_level FROM $table_name WHERE userid = '$_POSTїuserid]'";Code: Select all
<?
if (!$_POSTїuserid]) {
header ("location: selectcontact.php");
exit;
include 'db.php'
sql = "SELECT first_name, last_name, email_address, telephone_number, company_name, address,
city, state, zip_code, username, password, user_level FROM $table_name WHERE userid = '$_POSTїuserid]'";
$result = mysql_query($sql, $connection) or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
$first_name = $rowї'first_name'];
$last_name = $rowї'last_name'];
$email_address = $rowї'email_address'];
$telephone_number = $rowї'telephone_number'];
$company_name = $rowї'company_name'];
$address = $rowї'address'];
$city = $rowї'city'];
$state = $rowї'state'];
$zip_code = $rowї'zip_code'];
$username = $rowї'username'];
$password = $rowї'password'];
$user_level = $rowї'user_level'];
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body link="#000000" vlink="#000000" alink="#000000" leftmargin="0" topmargin="0">
<table width="771" height="392" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="6"><div align="center"><img src="../gifs/spaceflat.jpg" width="50" height="20"></div></td>
</tr>
<tr>
<td width="51" rowspan="3"><div align="center"><img src="../gifs/spacer51.gif" width="51" height="20"></div></td>
<td colspan="4"><div align="left">
<p><font size="4" face="Georgia"><u>Admin Tool:</u> </font></p>
<p><font size="4" face="Georgia">Add a Client or Member</font></p>
</div></td>
<td width="50" rowspan="3"><div align="center"><img src="../gifs/spacer50.gif" width="50" height="20"></div></td>
</tr>
<tr>
<td colspan="4"><div align="center"><img src="../gifs/spaceflat.jpg" width="50" height="20"></div></td>
</tr>
<tr>
<form name="form1" method="post" action="register_admin.php">
<td height="291" colspan="4"> <table width="650" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="146" height="30" align="center"> <div align="left"><font color="#990000" face="Webdings">4</font><font face="Georgia">First
Name</font></div></td>
<td width="172" height="30" align="center"> <div align="left"><font face="Georgia">
<input name="first_name" type="text" id="first_name5" value="<? echo "$first_name"; ?>" size="20" maxlength="25">
</font></div></td>
<td width="167" height="30" align="center"> <div align="left"><font face="Georgia"><font color="#990000" face="Webdings">4</font>Last
Name</font></div></td>
<td width="165" height="30" align="center"> <div align="left"><font face="Georgia">
<input name="last_name" type="text" id="last_name" value="<? echo "$last_name"; ?>" size="20" maxlength="25">
</font></div></td>
</tr>
<tr>
<td height="30" align="center"> <div align="left"><font color="#990000" face="Webdings">4</font><font face="Georgia">E-Mail
Address</font></div></td>
<td height="30" align="center"> <div align="left"><font face="Georgia">
<input name="email_address" type="text" id="email_address" value="<? echo "$email_address"; ?>" size="20" maxlength="40">
</font></div></td>
<td height="30" align="center"> <div align="left"><font color="#990000" face="Webdings">4</font><font face="Georgia">Telephone
Number</font></div></td>
<td height="30" align="center"> <div align="left"><font face="Georgia">
<input name="telephone_number" type="text" id="telephone_number" value="<? echo "$telephone_number"; ?>" size="20" maxlength="10">
</font></div></td>
</tr>
<tr>
<td height="30" align="center"> <div align="left"><font color="#FFFFFF" face="Webdings">4</font><font face="Georgia">Company
Name</font></div></td>
<td height="30" align="center"> <div align="left"><font face="Georgia">
<input name="company_name" type="text" id="company_name" value="<? echo "$company_name"; ?>" size="20" maxlength="25">
</font></div></td>
<td height="30" align="center"> <div align="left"><font color="#990000" face="Webdings">4</font><font face="Georgia">Address</font></div></td>
<td height="30" align="center"> <div align="left"><font face="Georgia">
<input name="address" type="text" id="address" value="<? echo "$address"; ?>" size="20" maxlength="25">
</font></div></td>
</tr>
<tr>
<td height="30" align="center"> <div align="left"><font color="#990000" face="Webdings">4</font><font face="Georgia">City</font></div></td>
<td height="30" align="center"> <div align="left"><font face="Georgia">
<input name="city" type="text" id="city" value="<? echo "$city"; ?>" size="20" maxlength="10">
</font></div></td>
<td height="30" align="center"> <div align="left"><font color="#FFFFFF" face="Webdings">4</font><font face="Georgia">State</font></div></td>
<td height="30" align="center"> <div align="left"><font face="Georgia">
<input name="address2" type="text" id="address2" value="<? echo "$state"; ?>" size="20" maxlength="25">
</font></div></td>
</tr>
<tr>
<td height="30" align="center"> <div align="left"><font color="#990000" face="Webdings">4</font><font face="Georgia">Zip
Code</font></div></td>
<td height="30" align="center"> <div align="left"><font face="Georgia">
<input name="zip_code" type="text" id="zip_code" value="<? echo "$zip_code"; ?>" size="20" maxlength="5">
</font></div></td>
<td height="30" align="center"> <div align="left"><font color="#990000" face="Webdings">4</font><font face="Georgia">Username</font></div></td>
<td height="30" align="center"> <div align="left"><font face="Georgia">
<input name="username" type="text" id="username" value="<? echo "$username"; ?>" size="20" maxlength="8">
</font></div></td>
</tr>
<tr>
<td height="5"> <div align="left"></div></td>
<td height="5"> <div align="left"><font color="#990000" size="-1" face="Webdings">4</font><font color="#000000" size="-1" face="Georgia">
<em>Required fields!</em></font></div></td>
<td height="5"> <div align="left"></div></td>
<td height="5"> <div align="left"><font size="-1" face="Georgia"><var>max.
8 characters</var></font></div></td>
</tr>
<tr>
<td height="30" align="center"> <div align="left"><font color="#990000" face="Webdings">4</font><font face="Georgia">Password</font></div></td>
<td height="30" align="center"> <div align="left"><font face="Georgia">
<input name="password" type="text" id="password" value="<? echo "$password"; ?>" size="20" maxlength="10">
</font></div></td>
<td height="30" align="center"> <div align="left"><font color="#990000" face="Webdings">4</font><font face="Georgia">User
Level </font></div></td>
<td height="30" align="center"> <div align="left"><font face="Georgia">
<select name="user_level" id="user_level">
<option value="1">Member</option>
<option value="2">Client</option>
<option value="3">Client/Mentor</option>
<option value="9">Admin</option>
</select>
</font></div></td>
</tr>
<tr>
<td height="5" colspan="2" align="center"><div align="left"></div></td>
<td height="5" colspan="2" align="center"><div align="left"></div></td>
</tr>
<tr>
<td height="5" align="center"> <div align="left"></div></td>
<td height="5" align="center"> <div align="left"></div></td>
<td height="5" align="center"> <div align="left"></div></td>
<td height="5" align="center"> <div align="left"></div></td>
</tr>
<tr>
<td height="20" colspan="4"> <div align="left"> <font color="#FFFFFF">f</font>User
Level Details:</div></td>
</tr>
<tr>
<td colspan="4"><table width="645" border="1" align="center" cellpadding="2" cellspacing="0">
<tr>
<td width="101"><div align="left">Member</div></td>
<td width="530"><div align="left">Access to Property Preview</div></td>
</tr>
<tr>
<td><div align="left">Client</div></td>
<td><div align="left">Access to Daily Sales, Property Preview,
Forum, Seminars</div></td>
</tr>
<tr>
<td><div align="left">Client/Mentor</div></td>
<td><div align="left">Access to Daily Sales, Mentor Program,
Property Preview, Forum, Seminars</div></td>
</tr>
<tr>
<td><div align="left">Admin </div></td>
<td><div align="left">Access to All and Admin Tools (Very Dangerous
Level!!!) </div></td>
</tr>
<tr>
<td><div align="left"></div></td>
<td><div align="left"></div></td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2"> <div align="right">
<input type="submit" name="Submit" value="Update Contact">
</div></td>
<td colspan="2"> <div align="left">
<a href="tools_admin.php">Return to Main Menu</a>
</div></td>
</tr>
</table>
</form><td width="20"></td>
</tr>
</table>
</body>
</html>