marathonexplosions
New Member
I'm start to learn mysql not so long time ago, and now i have problem, that i cant solve by myself.I'm trying to connect to mysql server with php. My admin gaved me ip, port, login, pass and db name.Php file looks like this:\[code\]$hostname = '192.168.1.20:1433';$username = "h";$password = "h";$dbName = "mydb";mysql_connect($hostname,$username,$password) OR DIE(mysql_error());mysql_select_db($dbName) or die(mysql_error());$query = "SELECT * FROM `insy` WHERE 1;";$result=mysql_query($query) or die(mysql_error());echo "works!";mysql_close();\[/code\]When i run page, its do nothing few minutes, than errors appears: Warning: mysql_connect() [function.mysql-connect]: MySQL server has gone away in N:\home\192.168.1.19\www\phlib.php on line 12\[code\]Warning: mysql_connect() [function.mysql-connect]: Error while reading greeting packet. PID=1908 in N:\home\192.168.1.19\www\phlib.php on line 12Warning: mysql_connect() [function.mysql-connect]: MySQL server has gone away in N:\home\192.168.1.19\www\phlib.php on line 12MySQL server has gone away\[/code\]12'th line is:\[code\]mysql_connect($hostname,$username,$password) OR DIE(mysql_error());\[/code\]I tried to create ODBC Sql Server via Control Panel -> Administration - with same parameters - it works, connection is ok, and i ca see the Db's.Tell me please, where is my fault?I hope, i was clear.Thanks for help.