php - How can I get results of this MYSQL query? -



php - How can I get results of this MYSQL query? -

this question has reply here:

mysql query result in php variable 5 answers

how can results?:

$check = mysql_query("select username, email, case when max(username = '$username') > 0 , max(email = '$email') > 0 'both' when max(username = '$username') > 0 'username' when max(email = '$email') > 0 'email' end school_users username = '$username' or email = '$email'") or die(mysql_error());

i need "username" or "email" or "both" when exists. how receive these variables?

you should utilize fetch functions. mysql_query() returns resource of data, getting data, need utilize either mysql-fetch_assoc or mysql_fetch_array.

as mentioned, mysql_* functions deprecated of >php 5.5, , bad practice of using. should larn mysqli or pdo.

resources: http://php.net/mysql_query

http://php.net/mysql_fetch_assoc

http://php.net/mysql_fetch_array

http://php.net/mysqli

http://php.net/pdo

php mysql

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -