In my code I am getting this error:

Warning: mysql_connect() [function.mysql-connect]: User turt2liv_demo already has more than 'max_user_connections' active connections in /home/turt2liv/public_html/demo/jamond_website/class.php on line 11

That method looks like this:

	function __construct($debug){
		mysql_connect("localhost","turt2liv_demo","demoacc") or die("Connection Error: ".mysql_error()); 
		mysql_select_db("turt2liv_demo_jamond_website") or die("Selection Error: ".mysql_error());

and it only happens on the page that uses this code:

	public function catalogue($start,$search,$sort,$order){
			$start = 0;
		$q = mysql_query("SELECT * FROM `items` WHERE `verified`='1'")or die(mysql_error());
		$num = mysql_num_rows($q) or die(mysql_error());
		echo "<p>Songs are priced based on the Admin's choice, keep in mind though, VIP Accounts can download right away for $10.00 a month. You are not aloud to download or buy without an account! Our sample audio player is brough to you by <a href='http://www.premiumbeat.com/flash_media_players/'>Premium Beat</a>.</p>";
		echo "<p>To save music, right click the \"Download Now\" link and select \"Save Target As\" (or the equivlent of). This method does not work on \"Buy Now\" buttons. If you would like more information on a song, simply click it's name.</p>";
		echo "<div style='background:#151515;width:700px;'>".$this->getSortOptions($search,$start)."</div>";
		echo "<table border=0 style='width:700px;'>";
		$searchDo = false;
			$search = " AND (name LIKE '%".$search."%' OR owner LIKE '%".$search."%') ";
			$searchDo = true;
			$search = " ";
			if($sort == "mostrecent"){
				$q = mysql_query("SELECT * FROM items WHERE verified='1'".$search."ORDER BY date $order LIMIT $start, 20")or die("ERROR 1: ".mysql_error());
			}else if($sort == "topdownloaded"){
				$q = mysql_query("SELECT * FROM items WHERE verified='1'".$search."ORDER BY hits $order LIMIT $start, 20")or die("ERROR 2: ".mysql_error());
			}else if($sort == "artist"){
				$q = mysql_query("SELECT * FROM items WHERE verified='1'".$search."ORDER BY owner $order LIMIT $start, 20")or die("ERROR 3: ".mysql_error());
			}else if($sort == "song"){
				$q = mysql_query("SELECT * FROM items WHERE verified='1'".$search."ORDER BY name $order LIMIT $start, 20")or die("ERROR 4: ".mysql_error());
			$q = mysql_query("SELECT * FROM items WHERE verified='1'".$search."LIMIT ".$start.", 20;")or die("ERROR 5: ".mysql_error()."<br>"."SELECT * FROM items WHERE verified='1'".$search."LIMIT ".$start.", 20;");
			$res = mysql_num_rows($q);
			echo "<tr><td colspan=5 style='border-bottom:1px #6E6E6E solid;'><center><p>$res Results Found.</p></center></td></tr>";
		echo "<tr><th style='border-bottom:1px #6E6E6E solid;'>Sample</th><th style='border-bottom:1px #6E6E6E solid;width:225px;'>Song Name</th><th style='border-bottom:1px #6E6E6E solid;width:125px;'></th><th style='border-bottom:1px #6E6E6E solid;width:225px;'>Artist</th><th style='border-bottom:1px #6E6E6E solid;width:125px;'>Buy Now</th></tr>";
		if(mysql_num_rows($q) >= 1){
			while($a = mysql_fetch_array($q)){
				$id = $a['id'];
				$name = $a['name'];
				$artist = $a['owner'];
				$sample = $a['samplePath'];
				$path = $a['actualPath'];
				$id = $a['id'];
						$butt = "<a href='$path'>Download Now</a>";
						$q2 = mysql_query("SELECT * FROM boughtItems WHERE email='$email' AND item='$id'");
						if($a['owner_email']==$_COOKIE['username'] || mysql_num_rows($q2) == 1){
							$butt = "<a href='$path'>Download Now</a>";
							$butt = $this->purchaseButton($name,$a['cost']);
					$butt = "Please Login First!";
				echo "<tr><td style='border-bottom:1px #6E6E6E solid;'>".$this->audioPlayer($sample)."</td><td style='border-bottom:1px #6E6E6E solid;width:225px;'><a href='viewSong.php?id=$id'>$name</a></td><td style='border-bottom:1px #6E6E6E dashed;width:125px;'></td><td style='border-bottom:1px #6E6E6E solid;width:225px;'>$artist</td><td style='border-bottom:1px #6E6E6E solid;width:125px;'>$butt</td></tr>";
			echo "<tr><td colspan=5 style='border-bottom:1px #6E6E6E solid;'><center><p>No Results! Sorry.</p></center></td></tr>";
		echo "<tr><td colspan=5 style='border-bottom:1px #6E6E6E solid;'><center><p>".$this->getPages("cat.php",$start, $num)."</p></center></td></tr>";
		echo "</table>";

Any help would be appreciated :)


Easier to read code here

I get a broken link for the source code.

If you already have a connection established to the database, your class doesn't need to create another one when using the mysql_* functions. The connection, once made exists in any scope like a superglobal.

Link Fixed. Sorry about that.

The script uses OOP to handle everything, the __construct starts the connection and mysql_connect/select_db is never called again in the code.

Still it is showing broken link...check it....

Sorry about that... Website transfer and all that.

Turns out that the error it was giving me was wrong, instead I had an infinite loop in one of the functions.