mrhappiness login-tutorial problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    PHP Code:
    function connect() 
    {
      echo 
    '$Host: -'.$Host.'-<br />';
      echo 
    '$User: -'.$User.'-<br />';
      echo 
    '$Pass: -'.$Pass.'-<br />';
      
    $db=mysql_connect($Host,$User,$Pass) or die(mysql_error()); 
      
    mysql_select_db('usr_web25_2',$db) or die(mysql_error());

    ausgabe?

    ich trau mich fast zu wetten, dass es so aussieht
    Code:
    $Host: --
    $User: --
    $Pass: --
    die variablen, die du in einer funktion verwendest, musst du in der funktion anlegen oder mit global reinholen
    PHP Code:
    function connect() 
    {
      global 
    $Host$User$Pass;
      
    $db=mysql_connect($Host,$User,$Pass) or die(mysql_error()); 
      
    mysql_select_db('usr_web25_2',$db) or die(mysql_error());

    oder
    PHP Code:
    function connect() 
    {
      
    $db=mysql_connect($GLOBALS['Host'],$GLOBALS['User'],$GLOBALS['Pass']) or die(mysql_error()); 
      
    mysql_select_db('usr_web25_2',$db) or die(mysql_error());

    sollte gehen
    Ich denke, also bin ich. - Einige sind trotzdem...

    Comment

    Working...
    X