php host localhost user root pass 51835 db forum DBConnect host user p

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
$host = 'localhost';
$user = 'root';
$pass = '51835';
$db = 'forum';
DBConnect($host, $user, $pass, $db);
ini_set('display_errors','1');
ini_set('display_startup_errors','1');
error_reporting (E_ALL);
function DBConnect($DBHost, $DBUser, $Pass, $DBName)
{
$db = mysql_connect( $DBHost, $DBUser, $Pass );
if($db==FALSE)
{
$string = mysql_error( $db );
}
DBSelect ($DBName);
}
function DBSelect( $name )
{
mysql_select_db( $name );
if(mysql_errno()!=0 )
{
echo mysql_error( $db );
}
}
function Select2String( $sql )
{
$result = @mysql_query( $sql );
if( mysql_errno() )
{
echo mysql_error() . "<BR>";
}
$row = @mysql_fetch_array( $result );
@ mysql_free_result( $result );
return $row;
}