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 5949751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:17:41+00:00 2026-05-22T17:17:41+00:00

I just moved to mysqli and I was wondering: can I do a multiple

  • 0

I just moved to mysqli and I was wondering: can I do a multiple query with the prepared statements?

Here is the example: I need to check if this username is also in the table “future_user” and not just in “user” as it is doing right now. For code appeal I’d rather not write again the same function just changing “user” with “future_user”.

function isFreeUsername($string)
{
$DB = databaseConnect();

$stmt = $DB->prepare("SELECT * FROM user WHERE username=? LIMIT 1");
$stmt->bind_param("s", $username);

if(isset($_SESSION) && isset($_GET['username']))   $username = $_GET['username'];
else                                               $username = $string;

$stmt->execute();
$stmt->store_result();

if($stmt->num_rows > 0)   $return = 0;
else                      $return = 1;  

$stmt->close();
$DB->close();

return $return;

}

TABLES:

CREATE TABLE user
(
uid      mediumint(6) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,

username varchar(15) NOT NULL,
password varchar(15) BINARY NOT NULL,
mail     varchar(50) NOT NULL,

name     varchar(50) NOT NULL,
surname  varchar(50) NOT NULL,
birth    char(10) NOT NULL,
sex      tinyint(1) unsigned NOT NULL default 1,

address  varchar(50) NOT NULL,
city     varchar(50) NOT NULL,
zip      char(5) NOT NULL,
province varchar(50) NOT NULL,
country  tinyint(3) NOT NULL,

number1  varchar(50) NOT NULL,
number2  varchar(50) NOT NULL,

last_login   TIMESTAMP,    
registered   TIMESTAMP,
online       tinyint(1) unsigned default 0,

admin           tinyint(1) unsigned default 0,
comment_allowed tinyint(1) unsigned default 0,
post_allowed    tinyint(1) unsigned default 0

) ENGINE=InnoDB;

CREATE TABLE future_user
(
username varchar(15) NOT NULL,
password varchar(15) BINARY NOT NULL,
mail     varchar(50) NOT NULL,

name     varchar(50) NOT NULL,
surname  varchar(50) NOT NULL,
birth    char(8) NOT NULL,
sex      tinyint(1) unsigned NOT NULL,

address  varchar(50) NOT NULL,
city     varchar(50) NOT NULL,
zip      char(10) NOT NULL,
province varchar(50) NOT NULL,
country  varchar(50) NOT NULL,

number1  varchar(50) NOT NULL,
number2  varchar(50) NOT NULL,

code     char(10) NOT NULL

) ENGINE=InnoDB;
  • 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-05-22T17:17:41+00:00Added an answer on May 22, 2026 at 5:17 pm
    "SELECT * 
     FROM user u
     LEFT JOIN future_user fu on fu.id = u.id 
     WHERE u.username=?
     LIMIT 1"
    

    With out seeing more of your table structure this what i can come up with.
    This will select the user in future user too

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just moved a web app project from VSS to TFS and when I
I just moved my website (asp.net) to the live environment. I realized they are
I just moved from Visual Studio 2008 to Visual Studio 2010 (final) and noticed one major
We just moved over to Git from SVN. In trying to clean up some
I've just moved onto a new machine. On my old work horse, I had
So i have just moved everything from my localhost to a new online server
I've just moved over from shared to dedicated hosting, and suddenly POST is not
I have just moved the dev site over to my linux server for production
I have just moved a site from a dedicated server to a GoDaddy shared
I've just moved a Joomla 1.7 site to a new server. Administration back-end works

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.