Jump to content

dottedquad

Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Posts posted by dottedquad

  1. [quote author=web designer link=topic=102700.msg408968#msg408968 date=1154621544]
    [color=brown]
    Oh :( I think what I have written above is wrong  :-\

    please can any one help ?  :-[

    I don't know why is the session not working !! [/color]
    [/quote]

    try reading the sessions in the FAQ: http://www.phpfreaks.com/forums/index.php/topic,31047.0.html
  2. [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.
  3. [quote author=kenrbnsn link=topic=99918.msg393801#msg393801 date=1152408061]
    You either have to return them back to the calling scope or declare them global inside your routine. I prefer to return them in an array:
    [code]<?php
    list ($fname, $lname, $dob) = chk_member();

      function chk_member()
      {
       
    $location = "localhost";
        $username = "root";
        $password = "2dollarbill";
        $database = "gold";

    $conn = mysql_connect($location, $username, $password);
        if (!$conn) { die ("Could not connect to MySQL"); }
    mysql_select_db($database,$conn) or die ("Could not open database");

    $sql = mysql_query("SELECT `memid`, `fname`, `lname` FROM `membership` WHERE `memid` = 1234567891");
    $row = mysql_fetch_row($sql);
            return (array($row[0], $row[1], $row[3]));
    }
    ?>[/code]

    Ken
    [/quote]

    sweet that works, is there any way I can break up the those variables to echo them out seperatly?
  4. function code:
    [code]  function chk_member()
      {
       
    $location = "localhost";
        $username = "root";
        $password = "2dollarbill";
        $database = "gold";

    $conn = mysql_connect($location, $username, $password);
        if (!$conn) { die ("Could not connect to MySQL"); }
    mysql_select_db($database,$conn) or die ("Could not open database");

    $sql = mysql_query("SELECT `memid`, `fname`, `lname` FROM `membership` WHERE `memid` = 1234567891");
    $row = mysql_fetch_row($sql);

    $fname = $row[0];
    $lname = $row[1];
    $dob = $row[3];

    }[/code]

    How do I access $fname, $lname, and $dob outside of the chk_member function so I echo out the values of those variables?
  5. [!--quoteo(post=388837:date=Jun 28 2006, 10:23 AM:name=Destramic)--][div class=\'quotetop\']QUOTE(Destramic @ Jun 28 2006, 10:23 AM) [snapback]388837[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    that should work

    [code]
    <input name="username" type="text" id="username" value="<?PHP echo $_POST['username']; ?>">
    [/code]
    [/quote]

    Thanks! That worked :-)
  6. Setup: Windows XP Pro, PHP5, and MySQL5.0

    My php directory is located in my c:\ which is my root. I didn't feel the need to add the libmysql.dll file and the php.ini to the system directory since I added C:\php to the [i]PATH[/i]

    doc_root = "c:\inetpub\wwwroot"

    extension_dir = "c:\php\ext"

    extension=php_mysql.dll

    I added ;C:\php to the [i]PATH[/i]

    I restarted windows XP pro and I still get Fatal error: Call to undefined function mysql_connect() in c:\Inetpub\wwwroot\fitness\dbtest.php on line 15

    Am I missing a step here? I have no clue what to do from here.

    -Thanks
×
×
  • 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.