php - how to use a while condition for a given task? -


i fetching user details using date

if(date("d")==1) {     $time  = "m"; } if(date("l")=="friday") {     $time  = "w"; } $time  = "d";  $sql=mysql_query("select user table_users $reprt=".$time ."); while($row=mysql_fetch_array($sql) {     $sql==mysql_query("select * table_register $user="$row[0]"); } 

here when (date("d")==1) want select statement using both d , m how possible.

let's see if got right... should should doing in 1 query if understand properly

select * table_register $user in (select user table_users $reprt=".$time)

would better query have set up... still not best @ least it's 1 query.

to actual question, should change code following

if(date("d")==1) {  $time  = "m"; } if(date("l")=="friday") {  $time  = "w"; }  if($time == "m") // when want search d right? {   //we suggested earlier slight change   mysql_query("select * table_register $user in (select user table_users  $reprt=".$time." or $reprt=d)"); } else {   //we suggested earlier   mysql_query("select * table_register $user in (select user table_users  $reprt=".$time.")"); } 

hope helps.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -