Senior & Expert PHP Developers Discussion Forum by Nyros Technologies

HIRE PHP Expert Developers Programmers Coders From India
PHP .Net Ruby on Rails Developers Community, Nyros Technologies, Kakinada
 
Log in  or IF not a member please REGISTER
Username:
Password:   


Keyword
Log in | Profile 

Need Help with my search code!

 
Post new topic   Reply to topic    Senior & Expert PHP Developers Discussion Forum by Nyros Technologies Index -> Help
View previous topic :: View next topic  
Author Message
CGDesigns



Joined: 19 Jan 2010
Posts: 2
Location: Oklahoma

PostPosted: Tue Jan 19, 2010 9:19 pm    Post subject: Need Help with my search code! Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
AnilKumar



Joined: 09 May 2008
Posts: 197

PostPosted: Fri Jan 22, 2010 3:57 am    Post subject: Reply with quote

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 Razz Razz Razz
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Senior & Expert PHP Developers Discussion Forum by Nyros Technologies Index -> Help
Page 1 of 1

 latest topics 
 Topics   Replies   Author   Views   Last Post 
No new posts About foxycart
0 venkatadapa 5 Fri Jul 30, 2010 10:02 am
venkatadapa View latest post
No new posts How to change the mysql storage engine from MyISAM to innodb
1 aababu 10 Fri Jul 30, 2010 9:57 am
venkatadapa View latest post
No new posts How can we increase the execution time of a php script?
0 samir 6 Fri Jul 30, 2010 4:15 am
samir View latest post
No new posts Get no of days between two dates & current dates using M
0 samir 4 Fri Jul 30, 2010 4:09 am
samir View latest post
No new posts What are the different types of errors in php
0 samir 6 Fri Jul 30, 2010 4:00 am
samir View latest post
No new posts How to remove a value in an array using javascript
0 samir 10 Thu Jul 29, 2010 7:27 am
samir View latest post
No new posts Agile methodology plays vital role in software development
0 venkatadapa 7 Thu Jul 29, 2010 7:20 am
venkatadapa View latest post
No new posts How to get complete information about $_SERVER variable
0 Sanjana 15 Wed Jul 28, 2010 6:58 am
Sanjana View latest post
No new posts DNL Reader for php website
0 Mike 22 Mon Jul 26, 2010 12:33 pm
Mike View latest post
No new posts Use mysql_real_escape_string() function to avoid mysql injec
0 venkatadapa 26 Mon Jul 26, 2010 11:05 am
venkatadapa View latest post





Hire an expert PHP developer / coder / programmer or development team from India now!!

Other Forums : Ruby on Rails   ::   .Net   |   Free unlimited HTML CSS Joomla Wordpress Drupal templates download

Nyros Technologies   |   Developers Blog   |   Kakinada City Portal   |   About PHP Experts   |   More