Jump to content

table help


MDanz

Recommended Posts

i have 2 mysql query.

 

$construct = "SELECT * FROM `Stacks` WHERE $construct AND positive=1 ORDER by posted DESC" or die (mysql_error());

and

$construct = "SELECT * FROM `Stacks` WHERE $construct AND positive=0 ORDER by posted DESC" or die (mysql_error());

 

i'd like to display the first query results in one cell and the second query results in one cell.

 

without copying the whole code twice and running into problems. How do i get round this?

 

 

In short the full code works but when i duplicate it and change the query where clause, both queries don't work.  But if i delete the duplicate it works again.

 

 

Link to comment
https://forums.phpfreaks.com/topic/197661-table-help/
Share on other sites

thx for help, but not the problem.  i'll try to explain it clearly..

 

i have the code it works.  but when i duplicate the code in a different area of the page and change the where clause because i want different results on different areas of the page.  i get the Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource. if i delete the duplicate, it works again.

 

do you know what this error means? common mistakes? 

Link to comment
https://forums.phpfreaks.com/topic/197661-table-help/#findComment-1037358
Share on other sites

Yes, the error means that mysql_query returned FALSE rather than a mysql resource object. It's what happens when you use an invalid syntax, which is what makes me think the error is as I described previously. echo mysql_error() directly after calling mysql_query to find out what exactly the error is. If you echo out $construct and the error then I'm sure the problem will be evident.

Link to comment
https://forums.phpfreaks.com/topic/197661-table-help/#findComment-1037359
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.