# Solved: xampp limitations?



## JiminSA (Dec 15, 2011)

I am trying to use a database i have successfully set up in xampp's phpMyAdmin (screen shot attached) but using the following code, I can't get ANY mysql_query results.

```
function count_ads($make)
{

	$sql = "SELECT * FROM `adverts` WHERE `make`='$make'";
	$res = mysql_query($sql) or die(mysql_error());

	$result = mysql_num_rows($res);
}
		foreach ($cat_array as $make)
		{
// Search by Make(Category) and get numbers...

			$topic_foreach = $make;

			$single_class_records_total = count_ads($make);

			if ($single_class_records_total == NULL) $single_class_records_total = 0;

			if ($topic_get != "RECENT" && $topic_get == array_search($topic_foreach, $cat_array))
			{
				echo("<td class=\"classification_2\" >[URL]&nbsp $topic_foreach &nbsp ($single_class_records_total)[/URL] [/TD]");
			}
			else
			{
				echo("<td class=\"classification_1\" >[URL]&nbsp $topic_foreach &nbsp ($single_class_records_total)[/URL] [/TD]");
			}

			$topic_number++;

			if ($topic_number != count($cat_array) && substr_count($topic_number/6, ".") == 0)
			{
				echo("[/TR]
				  [TR]");
			}
			else if ($topic_number == count($cat_array) && substr_count($topic_number/6, ".") > 0)
			{
				echo("<td class=\"empty\">&nbsp[/TD][/TR]");
			}

			else if ($topic_number == count($cat_array) && substr_count($topic_number/6, ".") == 0)
			{
				echo("[/TR]");
			}

		}

	}
```
... maybe xampp has a limit on the number of tables or something? Because I can find no other reason for my script not to work?? Or maybe you can? It's been a hair-tearing time trying to suss this one


----------



## NegativeKelvin (Apr 12, 2012)

Perheaps update PHPMyAdmin? I use a newer version and it seems to work fine for everything (and I have LOTS of tables in the SQL Database. 4 WordPress Blogs, WebIM, phpBB, MediaWiki and drupal)


----------



## JiminSA (Dec 15, 2011)

No, unfortunately that's not the cause...

Do you happen to know if there is a step in PMA whereby a user, with all privileges granted, must be linked to a table? Or, as I am assuming the user is associated automatically?

I'm grasping at straws here...


----------



## JiminSA (Dec 15, 2011)

Ah well, we live and learn!

When using this count facility one must first execute mysql_query($query), then pass it's return value to mysql_num_rows. viz:-

```
count_ads($make);

		$category_total = mysql_num_rows($result);
```
It was nothing to do with being unable to access my DB!!!


----------

