Jump to content

Archived

This topic is now archived and is closed to further replies.

dottedquad

trying to access an OOP function twice...

Recommended Posts

[code]<?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> ';
?>[/code]

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

Share this post


Link to post
Share on other sites

×

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.