lordphate Posted June 9, 2007 Share Posted June 9, 2007 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); } } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/54869-mysql_query-help-please/ Share on other sites More sharing options...
MemphiS Posted June 9, 2007 Share Posted June 9, 2007 Try using this line.. $query = "SELECT `clb_id` , `asa_id` , `nat_id` FROM `flashchat_rooms` WHERE `id` = '".$rec['id'].'""; Quote Link to comment https://forums.phpfreaks.com/topic/54869-mysql_query-help-please/#findComment-271351 Share on other sites More sharing options...
lordphate Posted June 9, 2007 Author Share Posted June 9, 2007 That doesn't work. i believe the error is within the $result = @mysql_result($result,0); but i'm not sure of how else to go about it Quote Link to comment https://forums.phpfreaks.com/topic/54869-mysql_query-help-please/#findComment-271357 Share on other sites More sharing options...
MemphiS Posted June 9, 2007 Share Posted June 9, 2007 $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.. Quote Link to comment https://forums.phpfreaks.com/topic/54869-mysql_query-help-please/#findComment-271359 Share on other sites More sharing options...
lordphate Posted June 9, 2007 Author Share Posted June 9, 2007 Maybe mysql_query is the wrong thing to use? mysql_run_rows or something? Quote Link to comment https://forums.phpfreaks.com/topic/54869-mysql_query-help-please/#findComment-271379 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.