Mutley Posted July 26, 2009 Share Posted July 26, 2009 I'm wanting to execute functions rather than having to type out a query each time, at the moment I do this sort of thing: <?php $res=mysql_query("SELECT field FROM `table` WHERE where"); while($row=mysql_fetch_array($res)){ $variable = $row[""]; } $sql="SELECT * FROM table WHERE where LIMIT 1"; $res=mysql_query($sql); if(mysql_num_rows($res)!=0) { while(list($variables) = mysql_fetch_row($res)){ $variables; } } ?> Now I saw this: http://www.devshed.com/c/a/PHP/Creating-a-Secure-PHP-Login-Script/ Where they do queries by doing $db-> <?php $sql = "UPDATE member SET session = $session, ip = $ip WHERE " . "id = $this->id"; $this->db->query($sql);?> However I can't get my head around it, what is it doing? I've not really used -> before so don't understand what that refers to either. And would a function to execute queries only be limited to certain queries? Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/167482-sql-query-function-help/ Share on other sites More sharing options...
vineld Posted July 26, 2009 Share Posted July 26, 2009 Search for object oriented php. It's built around classes. Link to comment https://forums.phpfreaks.com/topic/167482-sql-query-function-help/#findComment-883127 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.