User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 401,558 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,562 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 543 | Replies: 4 | Solved
Reply
Join Date: Jan 2006
Posts: 3
Reputation: alex905 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
alex905 alex905 is offline Offline
Newbie Poster

dosent like query

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


require "config2.php";
require "config.php";
$result = mysql_query( "SELECT `sum` FROM `subs`" );

$sq = mysql_fetch_assoc($result);


$value = $sq['sum'];

$val = preg_replace('/$/', '', $value);
?>
<br>
<?php
echo $val;

$query = mysql_query( "SELECT title, threadid FROM `thread` WHERE forumid = '10' ORDER BY threadid LIMIT '". $val ."' , 10" );

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

?>





i get thsi error
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

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


i am compleatly lost. i have no idea what so ever is wrong.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2006
Location: syria
Posts: 157
Reputation: w_3rabi is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 8
w_3rabi's Avatar
w_3rabi w_3rabi is offline Offline
Junior Poster

Re: dosent like query

  #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  
Join Date: Jun 2007
Location: Tuticorin,tamilnadu
Posts: 3
Reputation: coolkartik is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
coolkartik's Avatar
coolkartik coolkartik is offline Offline
Newbie Poster

Re: dosent like query

  #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  
Join Date: Jan 2006
Posts: 3
Reputation: alex905 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
alex905 alex905 is offline Offline
Newbie Poster

Re: dosent like query

  #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  
Join Date: Jun 2007
Location: Tuticorin,tamilnadu
Posts: 3
Reputation: coolkartik is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
coolkartik's Avatar
coolkartik coolkartik is offline Offline
Newbie Poster

Re: dosent like query

  #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  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 3:44 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC