Jump to content



  • Please log in to reply
3 replies to this topic

#1 beav33

  • Members
  • PipPip
  • Member
  • 25 posts

Posted 30 July 2006 - 11:24 PM

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 page

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\www\offers4house\results.php on line 12

I 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">
<?php do { ?>
<td><?php echo $row_Recordset1['state']; ?></td>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>

I can include the rest of the dreamweaver php for the recordset and query if needed.
Please Please Please! Help

#2 wildteen88

  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 31 July 2006 - 08:50 AM

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.

#3 beav33

  • Members
  • PipPip
  • Member
  • 25 posts

Posted 31 July 2006 - 09:19 PM

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 sense
Thank you

$query_Recordset1 = sprintf("SELECT propertytype, squarefootage, askingprice, `city`, `state`, zip FROM houselisting WHERE
`state` = %s AND `city` LIKE CONCAT('%%', %s, '%%')"

#4 beav33

  • Members
  • PipPip
  • Member
  • 25 posts

Posted 02 August 2006 - 06:16 AM

Try new example for some help
I have a search page for houses
city, state OR zip
Also property type and price range.
Now if somebody leaves property type OPTION open
And price range OPTION open
how do I run a wildcat search with the city, state OR zip selected, and these open, for that location
With 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.
Select *
FROM houselisting
WHERE (`state` = colstate OR `city` LIKE %colcity%) OR `zip` = colzip OR `propertytype` = colproperty

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users