karldesign Posted July 5, 2007 Share Posted July 5, 2007 Just a quick (and probably obvious) question... In the past, I have used a standard query to first compare a userId from a login session with the userId of a database sample. From this, I could redirect if it isn't the user or keep the user on the page if it is them. Having thought about it, there must be a quicker and more efficient way of doing this and wandered if there was an 'IF' statement that would do the same. (ie: UPDATE table WHERE row = get AND (IF row = session)). Link to comment https://forums.phpfreaks.com/topic/58549-sql-if-statements/ Share on other sites More sharing options...
Wildbug Posted July 5, 2007 Share Posted July 5, 2007 Could you clarify a bit more? Link to comment https://forums.phpfreaks.com/topic/58549-sql-if-statements/#findComment-290423 Share on other sites More sharing options...
akitchin Posted July 5, 2007 Share Posted July 5, 2007 the MySQL manual: http://dev.mysql.com/doc/refman/4.1/en/control-flow-functions.html#function_if as wildbug says, it's not totally clear what you want to do. MySQL can't take care of header redirection for you. Link to comment https://forums.phpfreaks.com/topic/58549-sql-if-statements/#findComment-290427 Share on other sites More sharing options...
Illusion Posted July 5, 2007 Share Posted July 5, 2007 UPDATE table set id=id+1 WHERE row = get AND IF(row = session,TRUE,FALSE); I don't know it works or not as per my knowledge it does not make any difference in performence prospective, it is always better if u use UPDATE table set id=id+1 WHERE row IN ('get','session'). Link to comment https://forums.phpfreaks.com/topic/58549-sql-if-statements/#findComment-290583 Share on other sites More sharing options...
fenway Posted July 10, 2007 Share Posted July 10, 2007 I really have no idea what this thread is about anymore. Link to comment https://forums.phpfreaks.com/topic/58549-sql-if-statements/#findComment-294624 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.