3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php /*替换为你自己的数据库名*/ $dbname = 'RPGDugEAOoSvpJcerHpc'; /*填入数据库连接信息*/ $host = 'sqld.duapp.com'; $port = 4050; $user = 'ISDddvTQAsC00NmHsOrCcqIL';//用户名(api key) $pwd = 'GMEWfs0973mqDGlgfsz7zVSnEQxqAePM';//密码(secret key) /*以上信息都可以在数据库详情页查找到*/ /*接着调用mysql_connect()连接服务器*/ $link = @mysql_connect("{$host}:{$port}",$user,$pwd,true); if(!$link) { die("Connect Server Failed: " . mysql_error()); } /*连接成功后立即调用mysql_select_db()选中需要连接的数据库*/ if(!mysql_select_db($dbname,$link)) { die("Select Database Failed: " . mysql_error($link)); } /*至此连接已完全建立,就可对当前数据库进行相应的操作了*/ ?>
Output for 7.1.0
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /in/FZ2t5:13 Stack trace: #0 {main} thrown in /in/FZ2t5 on line 13
Process exited with code 255.
Output for 5.0.0 - 5.6.28, 7.0.0 - 7.0.14

Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Connect Server Failed: Unknown MySQL server host 'sqld.duapp.com' (111)
Output for 4.3.0 - 4.4.9
Connect Server Failed: Unknown MySQL Server Host 'sqld.duapp.com' (11)