| View previous topic :: View next topic |
| Author |
Message |
CGDesigns
Joined: 19 Jan 2010 Posts: 2 Location: Oklahoma
|
Posted: Tue Jan 19, 2010 9:19 pm Post subject: Need Help with my search code! |
|
|
Hi all,
I really need some help with this search code on my site. Before the company I am working for switched web hosts this code and all was working great. I had a bunch of LEFT JOINs and everything was good. Now, I don't get anything. I've even reduced it down to just trying to pull ONE thing from our database (an account number, super simple). Here's the entire code, do you see where it may not be working??? I'm at a loss. I've run into one problem or another with building this search for the website since they switched webhosts and I feel like I'm getting nowhere. Please help!!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
$dbHost = '********';
$dbUser = '********';
$dbPass = '********';
$dbDatabase = '*******';
$search = $_POST['search'];
if ($search) // perform search only if a string was entered.
{
$con = mysql_connect($dbHost, $dbUser, $dbPass) or die("Failed to connect to MySQL Server. Error: " . mysql_error());
mysql_select_db($dbDatabase) or die("Failed to connect to database {$dbDatabase}. Error: " . mysql_error());
$query = "SELECT asmnt_legal.Account,
WHERE asmnt_legal.Account = '{$search}'
ORDER BY asmnt_legal.Account ASC";
$result = mysql_query($query, $con);
if ($result)
{
echo "Results:<br><br>";
echo "<table width=90% align=center border=1><tr>
<td align=center bgcolor=#4A6B3F>Account</td>
</tr>";
while ($r = mysql_fetch_array($result))
{ // Begin while
$act = $r["Account"];
echo "<tr>
<td>$act</td>
</tr>";
} // end while
echo "</table>";
}
else
{
echo "Sorry, please try your search again.";
}
}
else
{
echo "Start your search";
}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>Searching Another Test</title>
</head>
<body bgcolor="#bba86d">
<div align="center">
</div>
<h1></h1>
<h1></h1>
<h1>Search Records</h1>
<form method="post" action="searchjoin1.php">
<table width=90% align=center>
<tr><td>Search:</td><td><input type=text name='search' size=60 maxlength=255></td></tr>
<td></td>
<td><input type=submit value="Search Records"></td>
</tr>
</table>
</form>
<p></p>
<p></p>
</body>
</html>
Thanks for any and all help!!
Qadoshyah |
|
| Back to top |
|
 |
AnilKumar

Joined: 09 May 2008 Posts: 197
|
Posted: Fri Jan 22, 2010 3:57 am Post subject: |
|
|
Hello Qadoshyah,
With your search queries and functionality i got the solution for it.
I think there is problem with your search query.
There is syntax error in your query.
After this statement there is no need of special symbol ','
SELECT asmnt_legal.Account,
And you miss the statement like
FROM < table name >
If i done like that i got search correctly.
I hope that you got solution. If not just post it what you exactly required.
Thank you,
Anil Kumar Panigrahi  |
|
| Back to top |
|
 |
|
|