dosent like query

Thread Solved
Reply

Join Date: Jan 2006
Posts: 3
Reputation: alex905 is an unknown quantity at this point 
Solved Threads: 0
alex905 alex905 is offline Offline
Newbie Poster

dosent like query

 
0
  #1
Jun 17th, 2007
well here is the part of my script that is malfuctioning.


  1. require "config2.php";
  2. require "config.php";
  3. $result = mysql_query( "SELECT `sum` FROM `subs`" );
  4.  
  5. $sq = mysql_fetch_assoc($result);
  6.  
  7.  
  8. $value = $sq['sum'];
  9.  
  10. $val = preg_replace('/$/', '', $value);
  11. ?>
  12. <br>
  13. <?php
  14. echo $val;
  15.  
  16. $query = mysql_query( "SELECT title, threadid FROM `thread` WHERE forumid = '10' ORDER BY threadid LIMIT '". $val ."' , 10" );
  17.  
  18. while( $row = mysql_fetch_assoc( $query ) ) {
  19.  
  20. ?>





i get thsi error
  1. Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in

and from the code above this is the line it is refering to

  1. while( $row = mysql_fetch_assoc( $query ) ) {


i am compleatly lost. i have no idea what so ever is wrong.
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 160
Reputation: w_3rabi is an unknown quantity at this point 
Solved Threads: 8
w_3rabi's Avatar
w_3rabi w_3rabi is offline Offline
Junior Poster

Re: dosent like query

 
0
  #2
Jun 17th, 2007
man echo the sql syntax to have a clearer view
programming is an art ,only for those who can understand it.
- th3 php wr3nch -
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 3
Reputation: coolkartik is an unknown quantity at this point 
Solved Threads: 1
coolkartik's Avatar
coolkartik coolkartik is offline Offline
Newbie Poster

Re: dosent like query

 
0
  #3
Jun 17th, 2007
Man have u checked the type of parameter to be passed for the function. In php just check the type u have declared for $result and $query. and check wat type mysql_querry is returning.
Reply With Quote Quick reply to this message  
Join Date: Jan 2006
Posts: 3
Reputation: alex905 is an unknown quantity at this point 
Solved Threads: 0
alex905 alex905 is offline Offline
Newbie Poster

Re: dosent like query

 
0
  #4
Jun 17th, 2007
i found the problem. because like all good problems 2 mins after you post it you solve it yourself.

it was the config files. they contain conecxtion deatils for two diffrent dbs and if you look were they are you can see that it will run my secound query of the file config file not the secound like i wanted.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 3
Reputation: coolkartik is an unknown quantity at this point 
Solved Threads: 1
coolkartik's Avatar
coolkartik coolkartik is offline Offline
Newbie Poster

Re: dosent like query

 
0
  #5
Jun 18th, 2007
man i need a small help. i m in vth sem of mca. i need some gud mini project titles. can i suggest some. i want some gud titles and which are small and effective.???
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC