I can handle errors just fine on MySQL, but what about warnings? If I use the following code I still get to see the warning, while that is not what I want:

if(mysql_connect($host, $user, $pass)) {
			 $conn_server = true;
		}
	else {
			$msg = "Fout bij verbinden naar de server.";
			$type = "error";
		}
	
	if($conn_server = true) {
		if(mysql_select_db($database)) {
				$msg = "Verbonden met de server en database.";
				$type = "notification";
			}
		else {
				$msg = "Fout bij verbinden naar de database.";
				$type = "error";
			}
		}

Post the warnings here.

if($conn_server = true) {

This is a comparison operator and you are comparing if the value of $conn_server is "true". So, you should use == instead of =.
Apart from that, I don't see anything wrong with your code which could cause an error.

as nav33n said

Bah, what a stupid mistake, I can't believe it. Anyway the warnings include, but are not limited to:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user **'@'localhost' (using password: YES) in /opt/lampp/htdocs/VC/connect.php on line 9
arning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'locahost' (1) in /opt/lampp/htdocs/VC/connect.php on line 9

In other words: when the connection information is wrong, I get warnings, but I don't want these :)
Thanks

You can use @ before mysql statements to supress the warning and error messages. @mysql_connect(...)

Thanks, that worked :)!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.