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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T18:21:06+00:00 2026-06-16T18:21:06+00:00

I have tried to make a stored procedure like this: DELIMITER $$ DROP PROCEDURE

  • 0

I have tried to make a stored procedure like this:

DELIMITER $$
DROP PROCEDURE IF EXISTS get_userStatUser $$
CREATE PROCEDURE get_UserStatUser
(
IN userId INT,
OUT Played INT,
OUT Win INT,
OUT Points INT
)
BEGIN
SELECT played, win, points
INTO Played, Win, Points
FROM nf_users
WHERE id = userId;
END $$
DELIMITER ;

I then try to get data from it like this:

$sql = mysqli_query($connect,"CALL get_userStatUser()") or die("Query fail: " . mysqli_error());
$row = mysqli_fetch_array($sql);

$played = $row['Played'];
$win = $row['Win'];
$points = $row['Points'];

But something is not right. I’m new to Stored Procedures and can not see where I go wrong? I get “Query fail:” with nothing in the error?

Any help is apreciated and thanks in advance 🙂

  • 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-16T18:21:07+00:00Added an answer on June 16, 2026 at 6:21 pm

    The Stored Procedure needs 4 parameters

    IN userId INT,
    OUT Played INT,
    OUT Win INT,
    OUT Points INT
    

    Given the way your PHP calls the Stored Procedure, you need to redefine the following:

    DELIMITER $$
    DROP PROCEDURE IF EXISTS get_userStatUser $$
    CREATE PROCEDURE get_UserStatUser
    (
    IN userId INT
    )
    BEGIN
    SELECT played, win, points
    FROM nf_users
    WHERE id = userId;
    END $$
    DELIMITER ;
    

    your PHP

    $given_userid = 372987;
    $sql = mysqli_query($connect,"CALL get_userStatUser($given_userid)") or die("Query fail: " . mysqli_error());
    $row = mysqli_fetch_array($sql);
    
    $played = $row['played'];
    $win = $row['win'];
    $points = $row['points'];
    

    Give it a Try !!!

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

Sidebar

Related Questions

This has me seriously stumped. I have a MySQL stored procedure that looks like
This might get a little confusing as I have tried everything to make this
I have a SQL Server database designed like this : TableParameter Id (int, PRIMARY
I have a stored procedure SP1 that calls another stored procedure SP2 like so:
I have tried to make the fullscreen feature of a SDI application with splitter
How to make a sticky footer i have tried on google found some results
How do I make the following url forbidden in apache; main/index.php?site=ing I have tried
I tried to make admin panel and I am using sessions , but have
Have tried to find solutions for this and can't really come up with anything.
I have tried searching over the internet about this problem but not able to

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.