Warning: Cannot modify header information - headers already sent

Discussion in 'PHP' started by tua1, May 15, 2008.

  1. #1
    I am a newbie in PHP and sorry about my english.
    I can't find a solution about my problem. I try so many tips but nothing worked.

    This is my error:

    Warning: Cannot modify header information - headers already sent by (output started at C:\WebServ\httpd\Runners\scripts\register.php:52) in C:\WebServ\httpd\Runners\scripts\register.php on line 347.


    And this is my register.php:

    <?php

    $debug = FALSE;

    /************************************************************
    Adjust the headers...
    ************************************************************/
    header("Expires: Thu, 17 May 2001 10:17:17 GMT"); // Date in the past
    header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
    header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
    header ("Pragma: no-cache"); // HTTP/1.0

    /*****************************************************************************
    Check the session details.
    we will store all the post variables in session variables
    this will make it easier to work with the verification routines
    *****************************************************************************/
    session_start();


    if (!isset($_SESSION['SESSION'])) require_once( "../include/session_init.php" );

    $arVal = array();
    require_once("../include/session_funcs1.php");

    reset ($_POST);
    while (list ($key, $val) = each ($_POST)) {
    if ($val == "") $val = "NULL";
    $arVals[$key] = (get_magic_quotes_gpc()) ? $val : addslashes($val);
    if ($val == "NULL")
    $_SESSION[$key] = NULL;
    else
    $_SESSION[$key] = $val;
    //if ($key != "haslo1" && $key !="haslo2") $arVals[$key] = "'".$arVals[$key]."'";
    //
    // if ("haslo1"!="haslo2") $arVals[$key] = "'".$arVals[$key]."'";
    // if ($debug) echo $key . " : " . $arVals[$key] . "<br>";

    }
    ?>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>- Runner's - Internetowy Sklep Sportowy</title>
    <link href="../css/master.css" rel="stylesheet" type="text/css">
    </head>
    <body>
    <div id="divRamka">
    <a name="gora"></a>
    <div id="divNaglowek"> <img id="imgLewyNaglowek"src="../images/lewy_naglowek.png">
    <img id="imgPrawyNaglowek" src="../images/prawy_naglowek.png">
    <!--<div id="divNaglowekG"></div>-->
    <div id="divNaglowekD">
    <div id="divLogo">
    <img id="imgLogo" src="../images/logo.jpg"></div>
    <!--poczatek linkow w naglowku-->
    <ul id="ulLinki">
    <li><a href="">Link</a></li>
    <li><a href="">Link</a></li>
    <li><a href="">Link</a></li>
    <li><a href="">Link</a></li>
    </ul>
    <ul id="ulLinki2">
    <li><a href="">Link</a></li>
    <li><a href="">Link</a></li>
    <li><a href="">Link</a></li>
    <li><a href="">Link</a></li>
    </ul>
    <ul id="ulKontakt">
    <li><strong>Kontakt:</strong></li>
    <li><img src="http://www.gadu-gadu.pl/users/status.asp?id=1473834styl=1" id="img2"></li>
    <li><a href="gg:1473834">1473834</a></li>
    <li><img src="../images/skype.gif" id="img1"></li>
    <li>01716665489</li>
    </ul>
    <!--koniec linkow w naglowku i poczatek panelu loginu-->
    <form id="frmLogin" action="login.php" method="post">
    <ul id="ulLogin">
    <li>Login</li>
    <li><input class="input" type="text" name="login" size="11" maxlength="20"></li>
    <li>Haslo</li>
    <li>
    <input class="input" type="password" name="haslo" size="11" maxlength="40">
    </li>
    <li><input id="submit" type="submit" name="zaloguj" value="Zaloguj" class="submit"></li>

    </ul>
    </form>
    <!--koniec panelu loginu i poczatek poziomego menu-->
    <ul id="ulMenuPoziome">
    <li class="current"><a href="rejestracja.html">Rejestracja</a></li>
    <li><a href="">Regulamin</a></li>
    <li ><a href="">Regulamin</a></li>
    <li><a href="">Regulamin</a></li>
    <li><a href="">Regulamin</a></li>
    <li><a href="">Regulamin</a></li>
    </ul>
    <!--koniec menu poziomego-->
    <ul id="ulKoszyk">
    <li><a href=""><img id="imgKoszyk" src="../images/koszyk.png"></a></li>
    <li>Ilosc:</li>
    <li>Suma:</li>
    </ul>
    </div>
    </div>
    <!--koniec naglowka-->
    <!-- <div id="divSrodek">-->
    <!--poczatek lewej kolumny-->
    <div id="divLewaKolumna"> <img id="imgNaszaOferta" src="../images/NASZ_OFERTA.png">
    <div id="divLewaMenu">
    <!--lewe menu-->
    <div id="divLinki">
    <ul>
    <li class="obecny"><a href="">Link<img id="imgKwadracik" src= "../images/KWADRACIK.png"></a></li>
    <li><a href="">Link<img id="imgKwadracik" src= "../images/KWADRACIK.png"></a></li>
    <li><a href="">Link<img id="imgKwadracik" src= "../images/KWADRACIK.png"></a></li>
    <li><a href="">Link<img id="imgKwadracik" src= "../images/KWADRACIK.png"></a></li>
    <li><a href="">Link<img id="imgKwadracik" src= "../images/KWADRACIK.png"></a></li>
    <li><a href="">Link<img id="imgKwadracik" src= "../images/KWADRACIK.png"></a></li>
    <li><a href="">Link<img id="imgKwadracik" src= "../images/KWADRACIK.png"></a></li>
    <li><a href="">Link<img id="imgKwadracik" src="../images/KWADRACIK.png"></a></li>
    </ul>
    </div>
    </div>
    <!--koniec lewego menu-->
    <img id="imgDolTabeli" src="../images/DOL_MENU.png"> </div>
    <!--koniec lewej kolumny-->
    <!--poczatek panelu wyszukiwarki-->
    <div id="divPrawaKolumna"> <img id="imgNaglowekTbl" src="../images/WYSZUKIWARKA3000.png">
    <div id="divSzukaj">
    <div id="SzukajZawartosc">
    <form action="szukaj.php" method="post">
    <input type="text" size="15" maxlength="100" name="szukaj">
    <input id="inpSzukaj" type="submit" value="Szukaj" class="submit">
    </form>
    </div>
    </div>
    <img id="imgDolTabeli" src="../images/DOL_TABELI2000.png">
    <img id="imgNaglowekTbl" src="../images/TOP_5.png">
    <!--Top5-->
    <div id="divTop5">
    <table id="tblProdukty">
    <tr>
    <th> 1.</th>
    <td><a href="">Produkt</a></td>
    </tr>
    <tr>
    <th>2.</th>
    <td><a href="">Produkt</a></td>
    </tr>
    <tr>
    <th>3.</th>
    <td><a href="">Produkt</a></td>
    </tr>
    <tr>
    <th>4.</th>
    <td><a href="">Produkt</a></td>
    </tr>
    <tr>
    <th>5.</th>
    <td><a href="">Produkt</a></td>
    </tr>
    </table>
    </div>
    <!--koniec Top5-->
    <img id="imgDolTabeli" src="../images/DOL_TABELI2000.png">
    <img id="imgNaglowekTbl" src="../images/NOWOSCI.png">
    <div id="divNowosci">
    <table id="tblProdukty">
    <tr>
    <th> 1.</th>
    <td ><a href="">Produkt</a></td>
    </tr>
    <tr>
    <th>2.</th>
    <td><a href="">Produkt</a></td>
    </tr>
    <tr>
    <th>3.</th>
    <td><a href="">Produkt</a></td>
    </tr>
    <tr>
    <th>4.</th>
    <td><a href="">Produkt</a></td>
    </tr>
    <tr>
    <th>5.</th>
    <td><a href="">Produkt</a></td>
    </tr>
    </table>
    </div>
    <img id="imgDolTabeli" src="../images/DOL_TABELI2000.png">
    <img id="imgNaglowekTbl" src="../images/PROMOCJE.png">
    <div id="divNowosci">
    <table id="tblProdukty">
    <tr>
    <th > 1.</th>
    <td ><a href="">Produkt</a></td>
    </tr>
    <tr>
    <th>2.</th>
    <td><a href="">Produkt</a></td>
    </tr>
    <tr>
    <th>3.</th>
    <td><a href="">Produkt</a></td>
    </tr>
    <tr>
    <th>4.</th>
    <td><a href="">Produkt</a></td>
    </tr>
    <tr>
    <th>5.</th>
    <td><a href="">Produkt</a></td>
    </tr>
    </table>
    </div>
    <img id="imgDolTabeli" src="../images/DOL_TABELI2000.png"> </div>
    <div id="php"><?php
    /**********************************************************************************************
    Make sure session variables have been set and then check for required fields
    otherwise return to the registration form to fix the errors.
    **********************************************************************************************/

    // check to see if these variables have been set...
    if ((!isset($_SESSION["login"])) || (!isset($_SESSION["haslo1"])) || (!isset($_SESSION["haslo2"])) || (!isset($_SESSION["email"])) || (!isset($_SESSION["imie"])) || (!isset($_SESSION["nazwisko"])) || (!isset($_SESSION["adres"])) || (!isset($_SESSION["kod_pocztowy"])) || (!isset($_SESSION["miasto"])) || (!isset($_SESSION["wojewodztwo"])) ) {
    resendToForm("?flg=red");
    }
    // form variables must have something in them...
    if ($_SESSION['login'] == "" || $_SESSION['haslo1'] == "" || $_SESSION['haslo2'] == "" || $_SESSION['email'] == "" || $_SESSION['imie'] == ""
    || $_SESSION['nazwisko'] == "" || $_SESSION['adres'] == "" || $_SESSION['kod_pocztowy'] == ""|| $_SESSION['miasto'] == "" || $_SESSION['wojewodztwo'] == "") {
    resendToForm("?flg=red");
    }

    if ($_SESSION['wojewodztwo'] == 0) {
    resendToForm("?flg=orange");
    }


    // if (strcmp($_SESSION['haslol'],$_SESSION['haslo2']) != 0)
    // {
    // resendToForm("?flg=pink");
    // }



    //if (strlen($_SESSION['haslol']) <6) {
    // resendToForm("?flg=purple");
    // }

    // make sure fields are within the proper range...
    if (strlen($_SESSION['login']) > 20 || strlen($_SESSION['haslo1']) > 40 || strlen($_SESSION['haslo2']) > 40
    || strlen($_SESSION['email']) > 50 || strlen($_SESSION['imie']) > 25
    || strlen($_SESSION['nazwisko']) > 25 || strlen($_SESSION['adres']) > 100 || strlen($_SESSION['miasto']) > 30 ) {
    resendToForm("?flg=white");
    }

    // // make sure fields are within the proper range... cut off any extra...
    // if (strlen($_SESSION['q1']) > 60) $_SESSION['q1'] = substr($_SESSION['q1'],0,60);
    // if (strlen($_SESSION['q2']) > 60) $_SESSION['q2'] = substr($_SESSION['q2'],0,60);
    // if (strlen($_SESSION['q3']) > 60) $_SESSION['q3'] = substr($_SESSION['q3'],0,60);


    /**********************************************************************************************
    Check the DB for records...
    **********************************************************************************************/

    // check for the email already in the database...
    $query = "SELECT COUNT(email) FROM klienci_id where email = '".$_SESSION['email']."'";
    if ($debug) echo "<br>SQL STATEMENT:<br>".$query."<br><br>";

    mysql_pconnect($_SESSION['MYSQL_SERVER1'],$_SESSION['MYSQL_LOGIN1'],$_SESSION['MYSQL_PASS1'])
    or die("Unable to connect to SQL server");
    mysql_select_db($_SESSION['MYSQL_DB1']) or die("Unable to select database");

    $result = mysql_query($query) or die("Invalid query (login): " . mysql_error());
    $row = mysql_fetch_row($result);

    if ($row[0] > 0) { // an email aleady exists in the database, because the row count > 0...
    resendToForm("?flg=yellow");
    }

    /* WHEN YOU INSERT USE MD5 for Passwords!!!! */
    $password = $arVals['haslo1'];
    $arVals['haslo1'] = "'".sha1($arVals['haslo1'])."'";

    /**********************************************************************************************
    Insert into the database...
    **********************************************************************************************/
    // mysql_query (...);
    //$id = mysql_insert_id();
    //mysql_query (...);
    $query1= "INSERT INTO klienci_id (ID_kli,login, haslo, email)"
    ."VALUES (NULL,'".$arVals['login']."', ".$arVals['haslo1'].",'".$arVals['email']."')";


    //echo $query;

    $result = mysql_query($query1) or die("Invalid query: " . mysql_error() . "<br><br>". $query1);
    $id = mysql_insert_id();

    $query2="INSERT INTO klienci_adres (ID_kli,imie, nazwisko, adres, kod_pocztowy, miasto, ID_woj) VALUES (".$id.",'".$arVals['imie']."', '".$arVals['nazwisko']."', '".$arVals['adres']."', '".$arVals['kod_pocztowy']."', '".$arVals['miasto']."', ".$arVals['wojewodztwo'].")";

    $result = mysql_query($query2) or die("Invalid query: " . mysql_error() . "<br><br>". $query2);
    SendMail($id, $password);


    function SendMail($id, $password) {
    // Construct the message....
    $mail = "Witaj ".$_SESSION['imie'].",\n\nDziekujemy za rejestracje.\nZyczymy przyjemnych zakupów\n\n";
    $mail .= "Twój login to: ".$_SESSION['login']."\n";
    $mail .= "Twoje haslo to: ".$_SESSION['haslo1']."\n";
    $mail .= "Imie i Nazwisko: ".$_SESSION['imie']." ".$_SESSION['nazwisko']."\n";
    $mail .= "Adres: ".$_SESSION['adres']."\n";
    $mail .= $_SESSION['kod_pocztowy']."\n";
    $mail .= $_SESSION['miasto']."\n";
    $mail .= $_SESSION['wojewodztwo']."\n";
    $mail .= "Email adres: ".$_SESSION['email']."\n";

    $mail .= "Pozdrawiamy,\nSklep Sportowy Runner's\n\n";

    // If any lines are larger than 70 characters, we will use wordwrap()
    $message = wordwrap($mail, 70);

    // Send the email...
    mail($_SESSION['email'], 'Witaj w naszym sklepiku', $message, "Nadawca: local@".$SESSION['APP_SERVER']."\r\n");

    $mail = str_replace("\n", "<br>", $mail);
    echo "<b>Nastepujacy email zostal wyslany:</b><br>".$mail;

    }

    /*** This following function will update session variables and resend to the form so the user can fix errors ***/

    function resendToForm($flags) {
    reset ($_POST);
    // store variables in session...
    while (list ($key, $val) = each ($_POST)) {
    $_SESSION[$key] = $val;
    }
    // go back to the form...
    //echo $flags;
    header("Location: ../user_registration.php".$flags);
    exit;
    }
    ?>
    <!--SUCCESS!<br>The data was entered in the database!<br>
    You probably want to redirect to a thank you page or send an email to the user for confirmation.-->

    <?php
    reset ($arVals);
    while (list ($key, $val) = each ($arVals)) {
    //echo $key . " : " . $arVals[$key] . "<br>";
    }
    echo "<br><br>Zapytanie SQL<br>";
    echo $query."<br><br><br><br>";




    ?></div>
    <!--koniec prawej kolumny-->
    <div id="divText">
    <!--poczatek panelu pokaz-->
    <form id="frmPokaz" action="pokaz.php" method="post" >
    <fieldset id="Pokaz"><legend>Wybierz swoja kategorie</legend><table id="tblPokaz" >
    <tr>
    <td class="underline">Dyscyplina:</td>
    <td>
    <select name="dyscyplina" id="select">
    <option selected value="0">&nbsp;</option>
    <option value="1">Koszykówka</option>
    <option value="2">Pilka Nozna</option>
    <option value="3">Sztuki walki</option>
    <option value="4">Lekkoatletyka</option>
    <option value="5">Terefere</option>
    <option value="6">fdgd</option>
    <option value="7">fdgdfg</option>
    </select> </td>
    <td class="underline">
    Kategoria: </td>
    <td>Odziez </td>
    <td>
    <input name="odziez" type="checkbox" class="checkbox" value="1" > </td>
    <td>Sprzet</td>
    <td><input name="sprzet" type="checkbox" class="checkbox" value="2"> </td>
    <td>Inne</td>
    <td><input name="inne" type="checkbox" class="checkbox" value="3" > </td>
    <td><input type="submit" class="submit" name="submit" id="pokaz" value="Pokaz"></td>
    </tr>
    </table></fieldset>
    </form>
    <!-- koniec panelu pokaz -->


    </div>
    <!-- </div>-->
    <!--poczatek stopki-->


    <div id="divStopka"> <img id="imgLewyStopka" src="../images/LEWA_STOPKA.png"> <img id="imgPrawyStopka" src="../images/PRAWA_STOPKA.png">
    <div id="divStopka_stopka"> <img id="imgStrzalka" src="../images/strzalka-65.png"> <a id="aDogory" href="#gora">Do góry</a>
    <ul id="ulLinkiStopka">
    <li><a href="rejestracja.html">Rejestracja</a></li>
    <li>:</li>
    <li><a href="">Link</a></li>
    <li>:</li>
    <li><a href="">Link</a></li>
    <li>:</li>
    <li><a href="">Link</a></li>
    <li>:</li>
    <li><a href="">Link</a></li>
    <li>:</li>
    <li><a href="">Link</a></li>
    </ul>
    <a id="aCopyright">Copyright 2008</a> </div>
    </div>
    <!--koniec stopki-->
    </div>
    <!--koniec ramki-->
    </body>
    </html>


    Could anybody help me??
     
    tua1, May 15, 2008 IP
  2. nabz245

    nabz245 Well-Known Member

    Messages:
    677
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    110
    #2
    That error is usually caused bt having an output before the header();
    So... if you have an echo or any other html before the header(); it will trigger the error.

    Try moving that one piece of code right to the top.

    Regards.
     
    nabz245, May 15, 2008 IP
    tua1 likes this.
  3. NatalicWolf

    NatalicWolf Peon

    Messages:
    262
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #3
    header("Location: ../user_registration.php".$flags);

    Find that line.
    Ok, what is happening is, u have a bunch of text being sent first...That engages the server to send the buffers, meaning the browser can no longer change its header data. Try using this, and I know this will fix it.

    at the beginning of the file put
    
    <?PHP
    ob_start();
    
    
    PHP:
    at the beginning of the file, then before the ?> at the end

    
    ob_flush();
    
    PHP:
    Hit me up on aim if u need any help.
     
    NatalicWolf, May 15, 2008 IP
  4. tua1

    tua1 Guest

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks for yours responding.

    As you said the ob_start() at the beginning and ob_flush() at the end solved the problem. That's great! Thanks.

    By the way.

    I have a book to learning php and I have a problem with login script from that book

    Here is first a script:


    function_db.php:

    <?php
    
      require_once('function_correct_data.php'); 
      require_once('function_base.php');
      .
      .
    ?>
    Code (markup):
    function_base.php:
    <?php
    
    function connect_db()
    {
       $result = mysqli('localhost', 'user', 'pass', 'db'); 
       if (!$result)
          throw new Exception('Database connection error!');
       else
          return $result;
    }
    
    ?>
    Code (markup):


    login.php:

    <?php
     require_once('function_db.php');
     create_header_html('');
    
     show_site_informatin(); 
     show_form_log();
    
     create_footer_html();
    ?>
    Code (markup):
    And if I try to login I have a error:

    Fatal error: Call to undefined function mysqli() in C:\WebServ\httpd\Runners2\PHP i MySQL.Tworzenie stron WWW - przyklady\rozdzial_26\function_base.php on line 5

    I check phpinfo().

    Configuration File (php.ini) Path C:\WINDOWS
    Loaded Configuration File C:\WINDOWS\php.ini

    which is correct.

    extension_dir C:\WebServ\php\ext C:\WebServ\php\ext

    which is correct.


    mysqli
    MysqlI Support enabled
    Client API library version 5.0.45
    Client API header version 5.0.45 (the same as mysql version)
    MYSQLI_SOCKET /tmp/mysql.sock

    So I don't know what is wrong:(


    Anybody know how to solve this problem??
     
    tua1, May 16, 2008 IP
  5. roshanbh

    roshanbh Peon

    Messages:
    52
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    use mysqli_connect() instead of mysqli() to connect to the database........
     
    roshanbh, May 16, 2008 IP
    tua1 likes this.
  6. tua1

    tua1 Guest

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6

    so easy..........:D

    That solved the problem in 100%. Thank you.

    I have one more problem with my scripp, I try to check that user didn't input too short pass

    
    	if (strlen($_SESSION['haslol']) <6) {
    	resendToForm("?flg=purple");
    	}
    
    Code (markup):
    but I have always error, the pass is too short, even when I input longer pass than 6, What's the problem?
     
    tua1, May 16, 2008 IP
  7. NatalicWolf

    NatalicWolf Peon

    Messages:
    262
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Glad I was able to help!
     
    NatalicWolf, May 16, 2008 IP
    tua1 likes this.
  8. allaboutgeo

    allaboutgeo Peon

    Messages:
    85
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Use input is always in $_POST, $_GET or $_REQUEST instead of $_SESSION.
     
    allaboutgeo, May 16, 2008 IP
  9. tua1

    tua1 Guest

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Thank you, thats solved the problem.


    What is wrong with my query?


    $query3= "GRANT SELECT, INSERT, UPDATE, DELETE "
    	."ON klienci_id, klienci_adres, zamowienia, zamowienia_pozycje, opinie "
    	."TO ".$arVals['login']." IDENTIFIED BY '".$arVals['pass1']."';"
    Code (markup):
    I can't figured out what is the problem:

    Parse error: syntax error, unexpected T_VARIABLE in C:\WebServ\httpd\Runners2\scripts\register.php on line 330

    Could anyone help?

    Greetings
     
    tua1, May 17, 2008 IP
  10. szalinski

    szalinski Peon

    Messages:
    341
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #10
    you have an extra " at the end of the query?? or maybe you have to rewrite it so the ; is actually at the end, not a " :)
     
    szalinski, May 17, 2008 IP
    tua1 likes this.
  11. allaboutgeo

    allaboutgeo Peon

    Messages:
    85
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Use of proper coding tags will help :)
    $query3= "GRANT SELECT, INSERT, UPDATE, DELETE "
    	."ON klienci_id, klienci_adres, zamowienia, zamowienia_pozycje, opinie "
    	."TO ".$arVals['login']." IDENTIFIED BY '".$arVals['pass1']."';"
    Code (php):
    Do you want this?
    $query3= "GRANT SELECT, INSERT, UPDATE, DELETE "
    	."ON klienci_id, klienci_adres, zamowienia, zamowienia_pozycje, opinie "
    	."TO ".$arVals['login']." IDENTIFIED BY '".$arVals['pass1']."'";
    Code (php):
     
    allaboutgeo, May 18, 2008 IP
    tua1 likes this.
  12. Altari

    Altari Peon

    Messages:
    188
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Yar. You need a semicolon at the end. You also don't really "need" those "." at line breaks. I always surround table/column names with a `, just so I can easily read what's going on (again, not necessary).

    $query3= "GRANT SELECT, INSERT, UPDATE, DELETE 
        ON `klienci_id`, `klienci_adres`, `zamowienia`, `zamowienia_pozycje`, `opinie`
        TO ".$arVals['login']." IDENTIFIED BY '".$arVals['pass1']."';";
    PHP:
     
    Altari, May 18, 2008 IP
    tua1 likes this.
  13. tua1

    tua1 Guest

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    little semicolon:p


    thanks!


    greetings
     
    tua1, May 18, 2008 IP
  14. tua1

    tua1 Guest

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    But if I try this:

    	$query3= "GRANT SELECT, INSERT, UPDATE, DELETE "
        ."ON table1, table2, table3, table4, table5 "
        ."TO ".$arVals['login']." IDENTIFIED BY ".$arVals['haslo1']."";  
    Code (markup):
    I have a syntax error: Invalid query: Something is wrong in your syntax obok ' table2, table3, table4 , opinie TO user1 IDENTIFIED BY 'pass1' w line 1

    However if I try this:
    
    $query3= "GRANT SELECT, INSERT, UPDATE, DELETE "
        ."ON table1"
        ."TO ".$arVals['login']." IDENTIFIED BY ".$arVals['haslo1'].""; 
    Code (markup):
    This is works, so I don't know why the first statement doesn't work.

    Any advices?

    Regards
     
    tua1, May 20, 2008 IP
  15. allaboutgeo

    allaboutgeo Peon

    Messages:
    85
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #15
    For each table you have to run the statement separately.
     
    allaboutgeo, May 24, 2008 IP