DIGIT-ARC read-only archive · snapshot: July 23, 2026

Connection to mySQL through PHP

6 posts · originally from https://geek.digit.in/community/threads/connection-to-mysql-through-php.97557/

P
prathamtawde Original post #1
Sep 11, 2008 at 9:54 AM
Dear Digiterzz!!

I'm trying to create a connection between mySQL database through PHP but I'm not able to do so..
Check out the following code:

<?php
$dbhost = 'mysql2.freehostia.com';
$dbuser = 'db_User';
$dbpass = 'admin';

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql');

$dbname = 'db_Rakshak';
mysql_select_db($dbname);
?>


Please help!!
Thanks :)
P
Sep 11, 2008 at 2:51 PM
please post the error msg you are getting while connecting mysql to php

blank web page appears..

blank web page appears..

Not Found

The requested URL /test.php was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/1.3.33 Server at prathamtawde.freehostia.com Port 80
Garbage
Garbage #3
Sep 11, 2008 at 3:49 PM
If a 404 error, then it's not your code problem. Check the path of file and put the address according to that.
ManishSinha
Sep 11, 2008 at 5:57 PM
You are trying to run this code on your system locally or on the freehostia's hosting service?
M
Sep 11, 2008 at 7:22 PM
What is more recommended to use - mysql_connect or pear mdb2? And why?