0

Hi
I'm working on a function and it was working good until I had an error that tells me I should swich from mysql to mysqli so I did swich but I'm having a lot of errors ! (the function is working fine but I have a lot of errors!).
This is my code :

<?php
require_once('inc/config.php');
function login(){
if(isset($_SESSION['user']) and isset($_SESSION['password'])){
    $username = $_SESSION['user'];
$sql = "SELECT * FROM users WHERE username='$username'";
$query = mysqli_query($con,$sql);
while($user = mysql_fetch_object($query)){
    $id = $user->id;
}
echo "Welcome $username ".$user
." <a href='myaccount.php?id=$id'>My Account</a>"
." | <a href='myoffers.php?id=$id'>My offers</a>"

." | "."<a href='add_offer.php?id=$id'>Add an Offer</a>"
." | "."<a href='logout.php'>Logout</a>";
}else {
echo "<table><form action='check_login.php' method='POST'>
<tr>
<td><input type='text' name='username' placeholder='Username' /></td>
<td><input type='password' name='password' placeholder='Password' /></td>
<td><input type='submit' value='Login' /></td>
</tr>
</form></table>";
}
}

?>

This is a screenshot of the errors :
Click Here

2
Contributors
1
Reply
18
Views
3 Years
Discussion Span
Last Post by pardeepkk
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.