Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-14-2006, 12:48 PM
Thanol's Avatar
v7n Mentor
Latest Blog:
None

 
Join Date: 10-13-03
Location: Central Ohio (Dublin)
Posts: 820
iTrader: 0 / 0%
Thanol is a highly respected web proThanol is a highly respected web proThanol is a highly respected web proThanol is a highly respected web proThanol is a highly respected web proThanol is a highly respected web proThanol is a highly respected web proThanol is a highly respected web proThanol is a highly respected web proThanol is a highly respected web proThanol is a highly respected web pro
Send a message via AIM to Thanol Send a message via MSN to Thanol Send a message via Yahoo to Thanol
MySQL Query Question

How do you WHERE 2 things?

Like I want to do:
Code:
$draw_rows = "SELECT * FROM $dbtable WHERE $theme, $color LIMIT $start,$number_pp"; $result = mysql_query($draw_rows); while($row = mysql_fetch_array($result)) //line 51 { echo "stuff"; }
But MySQL keeps saying that: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /../view-backgrounds.php on line 51;
__________________
-Scott
Build a Website : Other site
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #2 (permalink)  
Old 01-14-2006, 02:12 PM
Pulse's Avatar
Junior Member
Latest Blog:
None

 
Join Date: 01-13-06
Posts: 27
iTrader: 0 / 0%
Pulse is a jewel in the roughPulse is a jewel in the roughPulse is a jewel in the roughPulse is a jewel in the roughPulse is a jewel in the roughPulse is a jewel in the roughPulse is a jewel in the rough
Quote:
$draw_rows = "SELECT * FROM $dbtable WHERE $theme, $color LIMIT $start,$number_pp";
$result = mysql_query($draw_rows);
while($row = mysql_fetch_array($result)) //line 51
{
echo "stuff";
}
Do me a fav, execute a print $draw_rows after you've set it so one can see what the end SQL statement looks like that way one can see if a variable has no value or what exactly is wrong, cause we do not know the values of $dbTable, $theme and $color ...

Quote:
print $draw_rows;
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #3 (permalink)  
Old 01-15-2006, 06:58 PM
Thanol's Avatar
v7n Mentor
Latest Blog:
None

 
Join Date: 10-13-03
Location: Central Ohio (Dublin)
Posts: 820
iTrader: 0 / 0%
Thanol is a highly respected web proThanol is a highly respected web proThanol is a highly respected web proThanol is a highly respected web proThanol is a highly respected web proThanol is a highly respected web proThanol is a highly respected web proThanol is a highly respected web proThanol is a highly respected web proThanol is a highly respected web proThanol is a highly respected web pro
Send a message via AIM to Thanol Send a message via MSN to Thanol Send a message via Yahoo to Thanol
Quote:
Originally Posted by Pulse
Do me a fav, execute a print $draw_rows after you've set it so one can see what the end SQL statement looks like that way one can see if a variable has no value or what exactly is wrong, cause we do not know the values of $dbTable, $theme and $color ...
Sure:
$draw_rows = "SELECT * FROM scott WHERE theme='animals', color='blue' LIMIT 0,15";
__________________
-Scott
Build a Website : Other site
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #4 (permalink)  
Old 01-16-2006, 05:51 AM
Junior Member
Latest Blog:
None

 
Join Date: 01-15-06
Posts: 27
iTrader: 0 / 0%
Eran-s is a jewel in the roughEran-s is a jewel in the roughEran-s is a jewel in the roughEran-s is a jewel in the roughEran-s is a jewel in the roughEran-s is a jewel in the rough
Use "AND" instead of ",".
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #5 (permalink)  
Old 01-16-2006, 06:15 AM
Thanol's Avatar
v7n Mentor
Latest Blog:
None

 
Join Date: 10-13-03
Location: Central Ohio (Dublin)
Posts: 820
iTrader: 0 / 0%
Thanol is a highly respected web proThanol is a highly respected web proThanol is a highly respected web proThanol is a highly respected web proThanol is a highly respected web proThanol is a highly respected web proThanol is a highly respected web proThanol is a highly respected web proThanol is a highly respected web proThanol is a highly respected web proThanol is a highly respected web pro
Send a message via AIM to Thanol Send a message via MSN to Thanol Send a message via Yahoo to Thanol
Talking

Quote:
Originally Posted by Eran-s
Use "AND" instead of ",".
Thanks! That's all I needed.
__________________
-Scott
Build a Website : Other site
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #6 (permalink)  
Old 01-16-2006, 06:25 AM
Junior Member
Latest Blog:
None

 
Join Date: 01-15-06
Posts: 27
iTrader: 0 / 0%
Eran-s is a jewel in the roughEran-s is a jewel in the roughEran-s is a jewel in the roughEran-s is a jewel in the roughEran-s is a jewel in the roughEran-s is a jewel in the rough
Quote:
Originally Posted by Thanol
Thanks! That's all I needed.
No problem
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #7 (permalink)  
Old 01-17-2006, 12:06 PM
Pulse's Avatar
Junior Member
Latest Blog:
None

 
Join Date: 01-13-06
Posts: 27
iTrader: 0 / 0%
Pulse is a jewel in the roughPulse is a jewel in the roughPulse is a jewel in the roughPulse is a jewel in the roughPulse is a jewel in the roughPulse is a jewel in the roughPulse is a jewel in the rough
cool fixed
Digg this Post!Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Which one faster mysql query? smith Coding Forum 7 03-29-2007 04:41 AM
mysql query problem (php) songwritingfever Coding Forum 3 05-03-2006 12:39 PM
Mysql Query & HTTP_POST_VARS onlinegamenet Coding Forum 4 03-01-2005 09:19 AM
MYSQL Update Query Limit Coding Forum 1 12-26-2004 09:08 PM
mysql / php search query robpicken Coding Forum 0 07-28-2004 04:26 AM


Sponsor Links
Get exposure! Contextual Links V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 11:38 PM.
© Copyright 2010 V7 Inc
Powered by vBulletin
Copyright © 2000-2010 Jelsoft Enterprises Limited.


Search Engine Optimization by vBSEO 3.3.0 ©2009, Crawlability, Inc.