Show certain things in certain $id

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

id is from the address viewforum.php?fid=WHAT EVER NUMBER
Then as long as you are passing in fid=whatever in the url then there's no reason that query should fail as $_GET['fid'] will be set. Sounds like you arn't passing fid= in the url
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Post by Dale »

Oh woops spelling mistake :\ Anyway thats fixed now i just have this famous little error
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\program files\app serv\www\forum\viewforum.php on line 25
Line 25:

Code: Select all

while($r=mysql_fetch_array($result))
Line 20 - 30:

Code: Select all

// Helped By markl999
$result = "SELECT * FROM df_threads WHERE forumid=".$_GET['fid'].""; 
 echo $result; //for debugging 
 mysql_query($result) or die(mysql_error());

while($r=mysql_fetch_array($result))
{
	$id=$r["id"];
	$title=$r["title"];
	$author=$r["author"];
	$posted=$r["posted"];
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

// Helped By markl999
$result = "SELECT * FROM df_threads WHERE forumid=".$_GET['fid']."";
echo $result; //for debugging
mysql_query($result) or die(mysql_error());

while($r=mysql_fetch_array($result))
{
$id=$r["id"];
$title=$r["title"];
$author=$r["author"];
$posted=$r["posted"];
Change to

Code: Select all

// Helped By markl999 
$query = "SELECT * FROM df_threads WHERE forumid=".$_GET['fid'].""; 
echo $query; //for debugging 
$result = mysql_query($query) or die(mysql_error()); 

while($r=mysql_fetch_array($result)) 
{ 
   $id=$r["id"]; 
   $title=$r["title"]; 
   $author=$r["author"]; 
   $posted=$r["posted"];
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Post by Dale »

OH MY GOD!!!!!! Mark!!!!

Gimme your address i need to give you all the hugs and kisses i can!!!!!!! WOOHOO!!!!!!1

THANK YOU THANK YOU THANK YOU!!!!
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

No problem. Watch out for the movie of this thread staring Brad Pitt as Dale and Sean Connery as MarkL ;)
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Post by Dale »

lol :D

Who gonna gonna be Dr. Evil im-a-nasty-piece-of-mysql-code-that-just-wants-to-bug-dale ???
Post Reply