Jump to content

Recommended Posts

Okay, i know this works perectly well when just trying to select clb_id, but when adding asa_id and nat_id.

 

If you know what's wrong can you show how to fix, and WHY it needs to be that way, so i can learn from my mistakes? Thanks!

<?php

$query = "SELECT clb_id,asa_id,nat_id FROM flashchat_rooms WHERE id=".$rec['id'];
$result = mysql_query($query);
$result = @mysql_result($result,0);

IF( $result["clb_id"] == "0" && $result["asa_id"] == "0" && $result["nat_id"] == "0"){
	  $stmt = new Statement("SELECT * FROM {$GLOBALS['fc_config']['db']['pref']}rooms WHERE ispublic IS NOT NULL AND ispermanent IS NOT NULL ORDER BY ispermanent");
			if($rs = $stmt->process()) {
				while($rec = $rs->next()) {
					$this->addRoom($rec, $rooms, $room_pass);
				}
  				}
                 }
       elseif( $result["clb_id"] > "0" && $result["asa_id"] == "0" && $result["nat_id"] == "0") {
       $stmt = new Statement("SELECT * FROM {$GLOBALS['fc_config']['db']['pref']}rooms WHERE ispublic IS NULL AND ispermanent IS NOT NULL AND clb_id=". $result["clb_id"] ." ORDER BY created");
			if($rs = $stmt->process())
		  	{
				while($rec = $rs->next())
			  		{
						$this->addRoom($rec, $rooms, $room_pass);
				  	}
				}

                   }
       elseif( $result["clb_id"] == "0" && $result["asa_id"] > "0" && $result["nat_id"] == "0") {

       $stmt = new Statement("SELECT * FROM {$GLOBALS['fc_config']['db']['pref']}rooms WHERE ispublic IS NULL AND ispermanent IS NOT NULL AND asa_id=". $result["asa_id"] ." ORDER BY created");
			if($rs = $stmt->process())
		  	{
					while($rec = $rs->next())
			  		{
						$this->addRoom($rec, $rooms, $room_pass);
				  	}
				}

                   }
        elseif( $result["clb_id"] == "0" && $result["asa_id"] == "0" && $result["nat_id"] > "0") {
               $stmt = new Statement("SELECT * FROM {$GLOBALS['fc_config']['db']['pref']}rooms WHERE ispublic IS NULL AND ispermanent IS NOT NULL AND nat_id=". $result["nat_id"] ." ORDER BY created");
			if($rs = $stmt->process())
		  	{
					while($rec = $rs->next())
			  		{
						$this->addRoom($rec, $rooms, $room_pass);
				  	}
				}

                   } ?>

Link to comment
https://forums.phpfreaks.com/topic/54869-mysql_query-help-please/
Share on other sites

$result = @mysql_result($result,0);

 

$result = @mysql_result($result,*0*); Is selecting the first column which is clb_id (0)

 

You need to beable to select ($result,1,2); I dont code or havent used your style of retrieving info so im not to sure how to solve your problem..

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.