Jump to content

PHP sql query not working

Go to solution Solved by Hazy125,

prepare > bind > execute > bind_result > fetch

Hello.

 

So I'm trying to get my usernames from my database but this returns nothing.

 

$data = $mysqli->prepare('SELECT username FROM game_profiles WHERE for_game=? AND platform=?');

        /* bind parameters for markers */
        $service = 'r6s';
        $data->bind_param('ss', $service, $platform);

        $data->bind_result($users);

        $data->fetch();
        /* execute query */
        $data->execute();

and I tryed a while $row = $users and echo the names but it dident work. 

 

So what did I do wrong? I'm not quite sure this is the correct way to do the query as I'm new to prepered statment in oop php.

Back-end developer, electronics "hacker"

Link to comment
https://linustechtips.com/topic/787745-php-sql-query-not-working/
Share on other sites

Link to post
Share on other sites

prepare > bind > execute > bind_result > fetch

I am good at computer

Spoiler

Motherboard: Gigabyte G1 sniper 3 | CPU: Intel 3770k @5.1Ghz | RAM: 32Gb G.Skill Ripjaws X @1600Mhz | Graphics card: EVGA 980 Ti SC | HDD: Seagate barracuda 3298534883327.74B + Samsung OEM 5400rpm drive + Seatgate barracude 2TB | PSU: Cougar CMX 1200w | CPU cooler: Custom loop

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×