beav33 Posted July 30, 2006 Share Posted July 30, 2006 I created a db and added content to it. Now I want to get it out. I created a recordset for a simple search for houses buy state.It works fine in the test, but when I add the dynamic table I get this on the pageWarning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\www\offers4house\results.php on line 12I have followed every help page and still cant figure it out. Line 12 is the next to last line of this code for the dynamic table<table border="1" cellpadding="1" cellspacing="1"><tr><td>state</td></tr><?php do { ?><tr><td><?php echo $row_Recordset1['state']; ?></td></tr><?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?></table>I can include the rest of the dreamweaver php for the recordset and query if needed.Please Please Please! Helpbeav33 Quote Link to comment https://forums.phpfreaks.com/topic/16056-mysql_fetch_assoc/ Share on other sites More sharing options...
wildteen88 Posted July 31, 2006 Share Posted July 31, 2006 When you get an supplied argument is not a valid MySQL result resource style error message, it usually means there is a problem with your SQL query. Could youy post the SQL query you are using here. Quote Link to comment https://forums.phpfreaks.com/topic/16056-mysql_fetch_assoc/#findComment-66262 Share on other sites More sharing options...
beav33 Posted July 31, 2006 Author Share Posted July 31, 2006 Thank you I worked it out, but when I run a search with 2 or more varibles is there some way to run a wildcat. Meaning if someone doesnt type in a varible in say "city" for the search, then my search doesnt work. I figured out the "=" for exact and "LIKE" for something close. If its blank the search shows nothing, even if there is something for the other varible, for instance "state". Can you do something with "OR" to solve this problem or do I have to make multiple search forms to get around this.Hope this makes senseThank youbeav33$query_Recordset1 = sprintf("SELECT propertytype, squarefootage, askingprice, `city`, `state`, zip FROM houselisting WHERE`state` = %s AND `city` LIKE CONCAT('%%', %s, '%%')" Quote Link to comment https://forums.phpfreaks.com/topic/16056-mysql_fetch_assoc/#findComment-66644 Share on other sites More sharing options...
beav33 Posted August 2, 2006 Author Share Posted August 2, 2006 Try new example for some helpI have a search page for housesUsing city, state OR zipAlso property type and price range.Now if somebody leaves property type OPTION openAnd price range OPTION openhow do I run a wildcat search with the city, state OR zip selected, and these open, for that locationWith the city, state I using a query of = for state and LIKE for city. For the zip I use the =When I ad OR for property type it works but for all locations, not the state or zip selected.ex: Select * FROM houselistingWHERE (`state` = colstate OR `city` LIKE %colcity%) OR `zip` = colzip OR `propertytype` = colproperty Quote Link to comment https://forums.phpfreaks.com/topic/16056-mysql_fetch_assoc/#findComment-67599 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.