Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 08-06-2013, 04:52 PM   #1
eMonk
Confirmed User
 
Industry Role:
Join Date: Aug 2003
Location: Canada
Posts: 2,310
mysqli prepared statements num_rows

This keeps returning 0 results. Any ideas?

Code:
$qry1 = $db->prepare("SELECT id FROM user WHERE username = ? AND password = ?");
$qry1->bind_param('ss', $_GET['username'], $_GET['password']);
$qry1->execute(); 

$qry1->store_result();
$result_1 = $qry1->num_rows;

echo $result_1;
eMonk is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-06-2013, 05:02 PM   #2
EddyTheDog
Just Doing My Own Thing
 
EddyTheDog's Avatar
 
Industry Role:
Join Date: Jan 2011
Location: London, Spain, New Zealand, GFY - Not Croydon...
Posts: 25,272
Quote:
Originally Posted by eMonk View Post
This keeps returning 0 results. Any ideas?

Code:
$qry1 = $db->prepare("SELECT id FROM user WHERE username = ? AND password = ?");
$qry1->bind_param('ss', $_GET['username'], $_GET['password']);
$qry1->execute(); 

$qry1->store_result();
$result_1 = $qry1->num_rows;

echo $result_1;
that's because ->bind_result() is a method of the mysqli_stmt class. it's not a method of the mysqli class.

lol - Just kidding - It's a small world...
EddyTheDog is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-06-2013, 05:11 PM   #3
valeriyCE
Registered User
 
Industry Role:
Join Date: Jul 2013
Posts: 82
It has to do with binding arrays that are not declared

$params = array('ss', 'stan', 'Stanley');
$tmp = array();
foreach($params as $key => $value) $tmp[$key] = &$params[$key];
call_user_func_array(array($stmt, 'bind_param'), $tmp);

use this style.
valeriyCE is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-06-2013, 05:13 PM   #4
Dankasaur
So Fucking Fossilized
 
Industry Role:
Join Date: Sep 2011
Posts: 1,432
Code:
$db->prepare("SELECT id FROM user WHERE username = ? AND password = ?");
$db->bind_param('ss', $_GET['username'], $_GET['password']);
$db->execute(); 

$db->store_result();
$result_1 = $db->num_rows;

echo $result_1;
Dankasaur is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-06-2013, 05:19 PM   #5
eMonk
Confirmed User
 
Industry Role:
Join Date: Aug 2003
Location: Canada
Posts: 2,310
Quote:
Originally Posted by EddyTheDog View Post
that's because ->bind_result() is a method of the mysqli_stmt class. it's not a method of the mysqli class.

lol - Just kidding - It's a small world...
LOL. Dude, I've been trying to figure this out the past 2 days and no luck.

I've searched google but the sites I checked said to include store_result() which I tried but still 0 results returned.
eMonk is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.