Thread: New in PHP

Results 1 to 7 of 7
  1. #1
    DoomedBlocks's Avatar
    Join Date
    Aug 2013
    Gender
    male
    Posts
    226
    Reputation
    10
    Thanks
    14

    New in PHP

    I'm new to PHP and I need to fix the php files hat were given to me,I keep getting errors on this one saying line 12 has an error.Hope you can teach me guys

    For example:

    <?php
    if($_SERVER['REQUEST_METHOD'] == 'GET')
    {
    if(isset($_GET['email']) && isset($_GET['password']) && ($_GET['password'])!='' && $_GET['email']!='')
    {
    require_once 'connect.php';
    $em = $_GET['email'];
    $pw = $_GET['password'];
    $sql = "SELECT * FROM user_accounts a, user_info ui WHERE email='$em' and password='$pw' and a.userid=ui.userid";
    $result = mysqli_query($conn, $sql);

    if(mysqli_num_rows($result) != 0){
    $row = mysqli_fetch_row($result);
    session_start();
    echo 'Authorized';
    $_SESSION['Authorized'] = 'Granted';
    $_SESSION['fullname'] = $row[7]. " " . $row[6];
    } else{
    echo "Invalid email or password.";
    }
    mysqli_close ($conn);
    }else{
    echo "Please fill all fields.";
    }
    } else{
    echo "Access not authorized, access denied.";
    }
    ?>

    /PS im also new in posting threads sry

  2. #2
    Silent's Avatar
    Join Date
    Jan 2015
    Gender
    male
    Location
    Melbourne, Australia
    Posts
    5,072
    Reputation
    2172
    Thanks
    8,475
    My Mood
    Bitchy
    Quote Originally Posted by DoomedBlocks View Post
    if(mysqli_num_rows($result) != 0){
    should be
    Code:
    if($result->num_rows != 0){ ...
    I believe.
    Click Here to visit the official MPGH wiki! Keep up with the latest news and information on games and MPGH! To check out pages dedicated to games, see the links below!











    dd/mm/yyyy
    Member - 31/01/2015
    Premium - 12/09/2016
    Call of Duty minion - 05/11/2016 - 05/11/2019
    BattleOn minion - 28/02/2017 - 05/11/2019
    Battlefield minion - 30/05/2017 - 05/11/2019
    Other Semi-Popular First Person Shooter Hacks minion - 21/09/2017 - 17/09/2019
    Publicist - 07/11/2017 - 02/08/2018
    Cock Sucker - 01/12/2017 - Unknown
    Minion+ - 06/03/2018 - 05/11/2019
    Fortnite minion - 08/05/2018 - 05/11/2019
    Head Publicist - 08/10/2018 - 10/01/2020
    Developer Team - 26/10/2019 - 10/01/2020
    Former Staff - 10/01/2020



  3. #3
    daymbot's Avatar
    Join Date
    Dec 2016
    Gender
    male
    Posts
    21
    Reputation
    10
    Thanks
    1
    Well, what's the error message?

    You should try to check the return of your mysqli_query function (returns false in case of error)
    You can also try to print your result with this code snippet for example, to see if the result is what you expect

    echo '<pre>';
    print_r($result);
    echo '</pre>';

  4. #4
    DoomedBlocks's Avatar
    Join Date
    Aug 2013
    Gender
    male
    Posts
    226
    Reputation
    10
    Thanks
    14
    The error is Fatal error:Can't Use function return value in write context in (directory).

    I would try both of your suggestions


    /PS can u guys help me in my project? cuz i need a LOT of help. ty ty
    Last edited by DoomedBlocks; 02-24-2017 at 07:04 PM.

  5. #5
    ende124's Avatar
    Join Date
    Jan 2013
    Gender
    male
    Posts
    65
    Reputation
    10
    Thanks
    28
    My Mood
    Buzzed
    Not an answer to your problem, but I'd suggest you asking on Stack Overflow or similar. There's a shitton of users willing to help.
    Also, put your code in code blocks, make it look nicer. And please say what error you get, or else it can be hard helping you.

  6. #6
    Smirnoffq's Avatar
    Join Date
    Nov 2016
    Gender
    male
    Posts
    231
    Reputation
    10
    Thanks
    53
    My Mood
    Fine
    Quote Originally Posted by DoomedBlocks View Post
    The error is Fatal error:Can't Use function return value in write context in (directory).

    I would try both of your suggestions


    /PS can u guys help me in my project? cuz i need a LOT of help. ty ty
    I can try helping, add me on skype: Smirnoffq (or click in skype logo in my signature)

  7. #7
    Hackinet's Avatar
    Join Date
    Jun 2014
    Gender
    male
    Posts
    525
    Reputation
    260
    Thanks
    1,024
    @DoomedBlocks
    Your code:
    Code:
    if(mysqli_num_rows($result) != 0)
    Spit the line into two sub-lines, it should somewhat look like this:
    Code:
    $resultvalue = mysqli_num_rows($result);
    if($resultvalue != 0);
    thats a common error in php versions prior to PHP 5.5
    Last edited by Hackinet; 04-17-2017 at 03:51 AM.

  8. The Following 3 Users Say Thank You to Hackinet For This Useful Post:

    prohacku (06-15-2017),thxtesting (06-15-2017),thxtesting2 (06-15-2017)

Similar Threads

  1. [News] Welcome to our new AvA minion.
    By Prepix in forum Alliance of Valiant Arms (AVA) Discussions
    Replies: 51
    Last Post: 02-09-2013, 12:34 PM
  2. [News] ~~~~~NEW MAP NEW WEAPON~~~~~~~~
    By devilaim in forum Blackshot Hacks & Cheats
    Replies: 10
    Last Post: 01-29-2013, 07:50 AM
  3. [News] New AQ Game: Oversoul [ALPHA TEST LIVE AS OF 9/13]
    By Phailsauce in forum BattleOn Games Hacks, Cheats & Trainers
    Replies: 4
    Last Post: 11-13-2012, 04:40 AM
  4. [News] New Rule About Hack Packs
    By Lehsyrus in forum Alliance of Valiant Arms (AVA) Hacks & Cheats
    Replies: 16
    Last Post: 10-05-2012, 07:29 AM
  5. [News] Be careful, new version! [1.9.446]
    By urbanlucky in forum Call of Duty Modern Warfare 3 Discussions
    Replies: 24
    Last Post: 09-14-2012, 03:29 AM