Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9017909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:23:20+00:00 2026-06-16T04:23:20+00:00

I have this piece of code: <?php require_once ‘Membership.php’; $membership = New Membership(); $AccountType

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T04:23:21+00:00Added an answer on June 16, 2026 at 4:23 am

    You need to return the value from get_Account() in your is_Account() function:

    return $mysql->get_Account($currUser);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: php loop through associative arrays i have this piece of code which
I currently have this piece of code: NSString *strURL = [NSString stringWithFormat:@http://www.sample.com /phpFile.php?firstname=%@,txtfirstName.text]; NSString
I have this piece of php - mysql code: When a user tagged in
I have this piece of code which check the last customer_id from the db.
I have this piece of code List<Class<? extends SubApplication>> appClasses = new ArrayList<Class<? extends
I have this piece of code: <?php $pattern = /<span\b[^>]*>(.*?)</; $html = file_get_contents(http://www.bicicletapublica.com.ar/mapa.aspx); $results
Currently I have this piece of code: if (!-e $request_filename) { rewrite ^/(.*)$ /index.php?/$1
I have this piece of PHP code: <?php $username=$_POST['username']; $password=$_POST['password']; if($username&&$password){ $connect=mysql_connect(localhost,root,) or die(
I have this piece of code: function MyFunction() { $.ajax({ type: POST, url: ajax.php,
I have this piece of code <ul> <?php $categories = get_categories('include=9,4,5,6,7,8,3&hide_empty=0'); foreach ($categories as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.