sager29 Posted November 25, 2007 Share Posted November 25, 2007 MySQL 5.0 I've got a database search bar on my site, and when I submit a query it shows all of the rows in the table instead of what I'm searching for. Funny thing is, it works the first time I search, but if I back up a page and search again it shows everything? Any thoughts would be greatly appreciated. Here some code: $query="SELECT artist,title,edition,imagesize,medium,price,type,framed From listings Where artist LIKE '%$searchartist%'"; $result = mysql_query($query) or die ("Couldn't execute query."); echo "<h1>Search Results</h1>"; echo "<table width='966'>"; echo "<tr><td colspan='8'><hr /></td></tr>"; echo "<tr> <td width='124'><strong>Artist</strong></td> <td width='124'><strong>Title</strong></td> <td width='95'><strong>Type</strong></td> <td width='97'><strong>Edition</strong></td> <td width='19'><strong>Image Size</strong></td> <td width='92'><strong>Medium</strong></td> <td width='92'><strong>Framed</strong></td> <td width='92'><strong>Price</strong></td> </tr>"; echo "<tr><td colspan='8'><hr /></td></tr>"; while($row = mysql_fetch_assoc($result)) { extract($row); echo "<tr> <td width='124'>$artist</td> <td width='124'>$title</td> <td width='95'>$type</td> <td width='97'>$edition</td> <td width='19'>$imagesize</td> <td width='92'>$medium</td> <td width='92'>$framed</td> <td width='92'>$price</td> </tr>"; } echo "</table>\n"; ?> </body></html> Quote Link to comment https://forums.phpfreaks.com/topic/78731-solved-mysql-search/ Share on other sites More sharing options...
fenway Posted November 25, 2007 Share Posted November 25, 2007 Sounds like missing POST data. Quote Link to comment https://forums.phpfreaks.com/topic/78731-solved-mysql-search/#findComment-398469 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.