<?php require_once('Connections/downloands.php'); ?>
<?php
$colname_Search = "-1";
if (isset($_POST['search'])) {
$colname_Search = (get_magic_quotes_gpc()) ? $_POST['search'] : addslashes($_POST['search']);
}
mysql_select_db($database_downloands, $downloands);
$query_Search = sprintf("SELECT * FROM quiz WHERE title LIKE '%s%%' ORDER BY title ASC", $colname_Search);
$Search = mysql_query($query_Search, $downloands) or die(mysql_error());
$row_Search = mysql_fetch_assoc($Search);
$totalRows_Search = mysql_num_rows($Search);
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<title>Search</title>
</head>
<body>
<?php if ($totalRows_Search > 0) { // Show if recordset not empty ?>
<?php do { ?>
<?php echo $row_Search['title']; ?>
<?php } while ($row_Search = mysql_fetch_assoc($Search)); ?>
<?php } // Show if recordset not empty ?></body>
</html>
<?php
mysql_free_result($Search);
?>
Tag : - - - -
Date :
23 พ.ย. 2549 15:53:28
By :
ruti
View :
2101
Reply :
2
No. 1
Guest
ได้แล้วครับขอบคุณที่เข้ามา
Date :
23 พ.ย. 2549 17:47:54
By :
ruti
No. 2
Guest
Code (PHP)
<?
if($_GET["txtKeyword"] != "")
{
$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 customer WHERE (Name LIKE '%".$_GET["txtKeyword"]."%' or Email LIKE '%".$_GET["txtKeyword"]."%' )";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<table width="600" border="1">
<tr>
<th width="91"> <div align="center">CustomerID </div></th>
<th width="98"> <div align="center">Name </div></th>
<th width="198"> <div align="center">Email </div></th>
<th width="97"> <div align="center">CountryCode </div></th>
<th width="59"> <div align="center">Budget </div></th>
<th width="71"> <div align="center">Used </div></th>
</tr>
<?
while($objResult = mysql_fetch_array($objQuery))
{
?>
<tr>
<td><div align="center"><?=$objResult["CustomerID"];?></div></td>
<td><?=$objResult["Name"];?></td>
<td><?=$objResult["Email"];?></td>
<td><div align="center"><?=$objResult["CountryCode"];?></div></td>
<td align="right"><?=$objResult["Budget"];?></td>
<td align="right"><?=$objResult["Used"];?></td>
</tr>
<?
}
?>
</table>
<?
mysql_close($objConnect);
}
?>