I have this piece of code:
<?php
require_once 'Membership.php';
$membership = New Membership();
$AccountType = $membership->is_Account($currUser);
if ($AccountType == 'S') {
echo '<li>';
echo $AccountType;
echo '</li>';
}
?>
Which calls upon a different document membership.php with a function that does this:
function is_Account($currUser){
//Find out if user is a buyer or a seller
$mysql = New Mysql();
$mysql->get_Account($currUser);
}
Which for organisational reasons - goes to a document (this bit works, as other functions work successfully) that does this:
function get_Account($currUser) {
$mysqli = new mysqli(DB_SERVER, DB_USER, DB_PASSWORD, DB_NAME);
if (!$mysqli) {
die('There was a problem connecting to the database.');
}
$queryAcct = "SELECT Id
FROM Users
WHERE Username = '$currUser'
LIMIT 1";
if ($Result = $mysqli->query($queryAcct)){
if (!$Result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
else {
$row = $Result->fetch_assoc();
return $row["Id"];
}
}
$mysqli->close();
}
So - that last function has an issue. I want to use the Id returned so that for example if it is 1, I display that content pertaining to Id 1 (multiple people will have that Id number as it is a tier system).
Basically - I have no idea why it isnt returning the Id to the original bit of code. I assume i've done something wrong. I just don't know how to fix it.
Echoing $row["Id"] will work so I know that bit is fine and its not an sql issue. But that isnt what I want to do.