Unstoppable Domains

Some MySQL Question

Spaceship Spaceship
Watch

xrvel

i love automationVIP Member
Impact
165
Hi,

How to make MySQL function that returns list of data.
Here is the mockup that i want

Code:
function get_users() {
	@data = SELECT * FROM users;
	RETURN @data;
}

Plus how do i assign value of a column into MySQL variable.
Here is the mockup of what i want.
Code:
SELECT
	users.name,
	@var_a = (
		SELECT COUNT(*) FROM pets WHERE pets.owner_id = users.user_id
	) AS pet_count
FROM
	users
WHERE
	@var_a > 10

I know the codes above are totally wrong in syntax :p
Thanks for helping. :D
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Wait.. you want this as a MySQL function? Or are you wanting this done in PHP? It's late here, just want to make sure I understand :gl:
 
0
•••
Wait.. you want this as a MySQL function? Or are you wanting this done in PHP? It's late here, just want to make sure I understand :gl:
I want it to be done on MySQL function, or probably stored procedure (which is best or more suitable in this case on your opinion) :)
 
0
•••

We're social

Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back