รายละเอียดของการตอบ ::
... มันเกีด Error Query [SELECT * FROM shortcode WHERE 1 ('- Select -' ) ] คะ ช่วยตรวดไห้หน่อยพี่ 2วันแล้วทำยังไม่ได้เลีย
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form name="frmSearch" method="post" action="<?=$_SERVER['SCRIPT_NAME'];?>">
<table width="599" border="1">
<tr>
<th>Select
<select name="ddlSelect" id="ddlSelect">
<option>- Select -</option>
<option value="Shortcode" <?if($_POST["ddlSelect"]=="Shorcode"){echo"selected";}?>>short</option>
<option value="CRBT" <?if($_POST["ddlSelect"]=="Name"){echo"selected";}?>>CR</option>
<option value="Email" <?if($_POST["ddlSelect"]=="Email"){echo"selected";}?>>US</option>
</select>
</th>
</tr>
</table>
</form>
<?
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("mydatabase");
// Search By Name or Email
$strSQL = "SELECT * FROM shortcode WHERE 1 ";
if($_POST["ddlSelect"] != "" )
{
$strSQL .= " ('".$_POST["ddlSelect"]."' ) ";
}
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<table width="932" border="2">
<p> </p>
<tr> <B>
<th width="100" bgcolor="#FFFFFF" bordercolor="#006666"><font size="4"color="#0000FF"><div align="center">Shortcode_id</div></font></th>
<th width="100" bgcolor="#FFFFFF" bordercolor="#006666"><font size="4"color="#0000FF"> <div align="center">Company_name</div></font></th>
<th width="100" bgcolor="#FFFFFF" bordercolor="#006666"><font size="4"color="#0000FF"> <div align="center">Effect-time</div></font></th>
<th width="100" bgcolor="#FFFFFF" bordercolor="#006666"><font size="4"color="#0000FF"> <div align="center">Expire-time</div></font></th>
<th width="100" bgcolor="#FFFFFF" bordercolor="#006666"><font size="4"color="#0000FF"> <div align="center">tel</div></font></th>
<th width="100" bgcolor="#FFFFFF" bordercolor="#006666"><font size="4"color="#0000FF"> <div align="center">Delete</div></font></th>
<th width="100" bgcolor="#FFFFFF" bordercolor="#006666"><font size="4"color="#0000FF"> <div align="center">Edit</div></font></th>
</B></tr>
<?
while($objResult = mysql_fetch_array($objQuery))
{
?>
<tr>
<td><div align="center"><?=$objResult["ShortcodeName"];?></div></td>
<td><div align="center"><?=$objResult["Company"];?></div></td>
<td><div align="center"><?=$objResult["Effect_time"];?></div></td>
<td><div align="center"><?=$objResult["Expire_time"];?></div></td>
<td align="center"><?=$objResult["Tel"];?></td>
<td align="center"><a href="JavaScript:if(confirm('Confirm Delete?')==true){window.location='phpMySQLDeleteRecord.php?ShortID=<?=$objResult["ShortcodeName"];?>';}">Delete</a></td>
<td align="center" ><a href="phpMySQLEditRecordForm.php?ShortID=<?=$objResult["ShortcodeName"];?>">Edit</a></td>
</tr>
<?
}
?>
</table>
<?
mysql_close($objConnect);
?>
</body>
</html>