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
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
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>';
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.
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.
@DoomedBlocks
Your code:Spit the line into two sub-lines, it should somewhat look like this:Code:if(mysqli_num_rows($result) != 0)
thats a common error in php versions prior to PHP 5.5Code:$resultvalue = mysqli_num_rows($result); if($resultvalue != 0);
Last edited by Hackinet; 04-17-2017 at 03:51 AM.
prohacku (06-15-2017),thxtesting (06-15-2017),thxtesting2 (06-15-2017)