Jump to content

buds2000

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

buds2000's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. The reason i want to use the same name (srch) is because of the line below. $query = "select * from catalog WHERE w1 LIKE '$srch' || w2 LIKE '$srch' || w3 LIKE '$srch' || w4 LIKE '$srch' || pubtag LIKE '$srch'";
  2. what i want to do is select from a drop down box OR type a search string on the same form. IE; <form action="searchall.php" method="POST"> <select name="srch"> <option value="" selected="selected"></option> <option value="rock">Rock</option> <option value="pop">Pop</option> <option value="country">Country</option> <option value="ballad">Ballad</option> <option value="uptempo">Up Tempo</option> <input type="text" name="srch" value="" size="30"> <input type="Submit"> </form> I have an error check that will check to see if the string is empty: if ($srch) // perform search only if a string was entered. Should i just remove the error check? If i type in the string the action works, but if i choose from the drop down i get the error.
  3. Got this error when i tried. Fatal error: Call to undefined function: stripslahes() in /home/brittonj/public_html/catalog/writers.php on line 3
  4. So i found the error on line 2 and changed ($srch) to ($writer) But still get the error message as if no search string was entered.
  5. What woul cause a search string from my form not to be seen by the php script it calls. The same form and script work fine on one table but not another? Here is the html.... <html> <head><title>Searching</title> </head> <body bgcolor=#ffffff> <form method="post" action="writers.php"> Search the Database for<BR> listings by the writers name.<BR> <table border=1 align=left> <tr><td align=right><B>Search for:</B></td><td><input type=text name='writer' style="background:#9BADCA" size=20 maxlength=255></td></tr> <tr><td></td><td align=right><input type=submit></td></tr> </table> </form> </body> </html> Here is the php... <? include("config.php"); if ($srch) // perform search only if a string was entered. { include("opendb.php"); $query = "select * from writers WHERE name = '$writer'"; $result = mysql_query($query) or die('Error, query failed'); if ($result) { echo "Here are the results:<br><br>"; echo "<table width=90% align=center border=1><tr> <td align=center bgcolor=#00FFFF>Name</td> <td align=center bgcolor=#00FFFF>Publishing</td> </tr>"; while ($r = mysql_fetch_array($result)) { // Begin while $name=$r["name"];// Writers Name $pubtag=$r["pubtag"];// Publisher echo "<tr> <td>$name</td> <td>$pubtag</td></tr>"; } // end while echo "</table>"; } else { echo "problems...."; } } else { echo "Search string is empty. <br> Go back and type a string to search"; } ?> =======================================================================
  6. "And thats why i came to PHP Freaks!" The problem is solved. Thanks for helping me with this.
  7. I have no idea what a loop is nor how to set it on 3 rounds. I tried the code below but still only checks w1... if ($searchdata<>"$w1" or "$w2" or "$w3){
  8. The statement below is the problem. After i have searched 3 fields in my table for a name, I want to execute the code below if no match were found. My problem is with the first line. if ($searchdata<>"$w1") I'm searching 3 fields:w1, w2, w3. This only checks field w1. I need to check all 3 before the else statement. ANY Suggestions? =============================================================================== if ($searchdata<>"$w1"){ echo "<p align=\"left\"> <font size=\"+2\" color=\"#DE3A53\">!</font> <font size=\"+1\">No Results Found Matching:</font><b> <font color=\"#DE3A53\">$searchdata</font></b><img src=\"clear.gif\" width=\"250\" height=\"1\">[<a href=\"index.php\">Go Back</a>] </p>"; } else
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.