• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

Basic PHP/mySql question

Sm1th

n00b
Joined
Feb 20, 2011
Messages
9
Ok,

Code:
	public function execSql(){

		$result = mysql_query('select * from users');
		$data = array();
		while($row = mysql_fetch_assoc($result))
		{
			$data[] = $row;
		}
		//print_r($data);
		mysql_free_result ($result);
		
		return $data;
               
	}

Why would this function return rows as normal, but changing the

Code:
$result = mysql_query('select * from users');

to...
Code:
$result = mysql_query('call searchUsers()');

not return anything??

Sql:

Code:
DELIMITER $$

USE `instantmessenger`$$
DROP PROCEDURE IF EXISTS `searchUsers`$$


CREATE
    /*[DEFINER = { user | CURRENT_USER }]*/
    PROCEDURE `instantmessenger`.`searchUsers`()

    BEGIN
	SELECT * FROM users;
    END$$
 
What does "mysql_error" return when run immediately after the problem line of code?
 
MySQL error 1312: PROCEDURE instantmessenger.searchUsers can't return a result set in the given context
When executing:
call searchUsers()

Something wrong with the proc?
 
Something wrong with the proc?
Just looking at the error statement, it may be that the DB connection you are running from in your PHP code doesn't have permissions to that proc.

Alternatively, you could try the "mysqli_" objects.
 
Back
Top