DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   PHP (http://www.daniweb.com/forums/forum17.html)
-   -   dosent like query (http://www.daniweb.com/forums/thread81186.html)

alex905 Jun 17th, 2007 8:49 am
dosent like query
 
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.

w_3rabi Jun 17th, 2007 10:41 am
Re: dosent like query
 
man echo the sql syntax to have a clearer view

coolkartik Jun 17th, 2007 11:28 am
Re: dosent like query
 
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.

alex905 Jun 17th, 2007 4:08 pm
Re: dosent like query
 
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.

coolkartik Jun 18th, 2007 4:58 am
Re: dosent like query
 
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.???


All times are GMT -4. The time now is 11:44 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC