Jarod Posted November 22, 2009 Share Posted November 22, 2009 Fatal error: Maximum execution time of 60 seconds exceeded in C:\wamp\www\inc\lib\class.MySQL.php on line 24 I get this error on my page, I was testing if the function worked, and it doesn't apparently. This is the code I used: This is the class.MySQL.php file <?php require_once( dirname(__FILE__) . '/class.dbComponent.php'); class MySQL extends dbComponent { var $query; function __construct() { // Connect to the database dbComponent::connectDB('localhost', 'root', NULL, 'jv_cms'); } function select($table, $columns, $where=NULL, $orderby=NULL, $limit=NULL) { $etc = ""; if($where != NULL) { $etc .= " WHERE $where"; } if($orderby != NULL) { $etc .= " ORDER BY $orderby"; } if($limit != NULL) { $etc .= " LIMIT $limit"; } $this->query = "SELECT $columns FROM $table" . $etc; return mysql_query($this->query); } } ?> And the code in the index.php file, which is where the problem is occuring: (ignore the php comment) <?php include_once(dirname(__FILE__) . '/inc/lib/class.MySQL.php'); $mysql = new MySQL(); require_once('inc/header.php'); require_once('inc/sidebar.php'); ?> <div id="entries"> <div class="entry"> <!-- Entry #1 --> <div class="entry_name">This is an entry</div> <div class="entry_content"> <p> <?php //$query = $mysql->select('jays_users', '*', NULL, 'ASC', '5'); while( $row=mysql_fetch_assoc($mysql->select('jays_users', '*')) ) { $username = $row['users_username']; echo $username . "<br />\n"; } ?></p> </div> </div> <div id="browse_entries"><a href="#" title="Browse news archive">Browse Archive</a></div> </div> <?php require_once('inc/footer.php'); ?> The problem is though, is that my page literally outputs like a thousand usernames, when there's only 1 row in the table, how is that possible?? How did it even like multiply the query? Quote Link to comment Share on other sites More sharing options...
corbin Posted November 22, 2009 Share Posted November 22, 2009 My guess is that $mysql->select('jays_users', '*') Is returning a new resource every time it's executed. Quote Link to comment Share on other sites More sharing options...
Jarod Posted November 23, 2009 Author Share Posted November 23, 2009 so how can i fix it Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.