Jump to content

trying to access an OOP function twice...


dottedquad

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.
Link to comment
Share on other sites

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.