Jump to content


Photo

trying to access an OOP function twice...


  • Please log in to reply
No replies to this topic

#1 dottedquad

dottedquad
  • Members
  • Pip
  • Newbie
  • 9 posts

Posted 03 August 2006 - 04:05 PM

<?PHP 
echo '
		<select name="state">';
           if ( $_GET['ManageID'] == 'view' || $_GET['SectionID'] = 'forms' )
           {
	  
			 /*$df2 =& new dbfunctions();*/
	  
                         $df->dbconnect('localhost', '****', '*****', 'gold');
			 $df->dbconnect('localhost', '****', '*****', 'website');
	         
			 $state = mysql_query("SELECT `state` FROM `memberships` WHERE `id` = 20"); /* supposed to grab that persons state from the gold database */

			 $get_state = mysql_fetch_array($state);

			 echo $get_state['state']; /*this isn't echoing out either*/

			 $db_state = mysql_query("SELECT * FROM `states`"); /*supposed to grab the states from the website database*/
			 
			 while ( $row = mysql_fetch_array($db_state) /*this seems to be working correctly!*/
			 {
			   
			   if ( $_GET['ManageID'] == 'view' && $get_state['state'] == $row['state_id'] )
			   {
			     
				 echo '<option value="' . $row['state_id'] . '" selected >' . $row['state_name'];
				 
			   } else
			   {
			     
				 echo '<option value="' . $row['state_id'] . '">' . $row['state_name'];
				 
			   }
				 
			 }
	  
           } 
		echo '</select> ';
?>

The issue I think, has to do with:
$state = mysql_query("SELECT `state` FROM `memberships` WHERE `id` = 20");
. What I don't understand is I ran that query in phpmyadmin and it found a match.  Also
echo $get_state['state'];
is not echoing out the results there for,
if ( $_GET['ManageID'] == 'view' && $get_state['state'] == $row['state_id'] )
conditional is false.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users