FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


connecting to mysql





nclemale
what code do i use for html to connect to a myphpadmin sql database .

been running a wap site and want to code a html site to run on same database.

is it possible.

if so wot code i use to connect to it.

thanks in advance.
m-productions
You can not use html, you need to us php
nclemale
is it easy enough to convert a wml file which is written in php to work on the net instead of wap .

i have started changing a few things and it works on web but its the connection of the php sql am getting stuck on
ncwdavid
To connect do this:
Code:

<?php
$username = "YOUR_USERNAME";
$password = "YOUR_PASSWORD";
$hostname = "localhost";   
$conn = mysql_connect($hostname, $username, $password)
   or die("Unable to connect to MySQL");


//TO CLOSE THE CONNECTION DO THIS
mysql_close($conn);
?>

And the file converting thing I dunno what your talkin about there?
BlueVD
nclemale wrote:
is it easy enough to convert a wml file which is written in php to work on the net instead of wap .

i have started changing a few things and it works on web but its the connection of the php sql am getting stuck on

the difference between WML and HTML is the tag structure. So yeah, it should be easy.
nclemale
cool i have a hundred files to convert then lol.
see ya next year haha
Ecthelion
ncwdavid wrote:
To connect do this:
Code:

<?php
$username = "YOUR_USERNAME";
$password = "YOUR_PASSWORD";
$hostname = "localhost";   
$conn = mysql_connect($hostname, $username, $password)
   or die("Unable to connect to MySQL");


//TO CLOSE THE CONNECTION DO THIS
mysql_close($conn);
?>

And the file converting thing I dunno what your talkin about there?


Hi, I was looking for a function to test if the database is up before making a connection.
That way I can display a nice message when the database is down, instead of having those ugly
"Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server during query in"
all over the page.

Is there a way to check this?

My nice message gets displayed when the link fails, but that still leaves one of those "Warning: mysql_connect() [function.mysql-connect]: ... query in"
and I would like to get rid of it.

Thanks in advance
manum
mysql_connect($hostname, $username, $password)

but do not forget to create a database from mysql managment link in ur cp before using this script
Related topics
A very good PHP MySQL Tutorial
mySQL set-up on Frihost help please
Trouble connecting to MySQL
Error connecting to mysql ; please help
Problem with a disapearing mysql.sock file
Error when connecting to MySQL
Problem connecting to MySQL database with PHP [RESOLVED]
Connecting to MySQL server
MySQL, PHP and APACHE
The last foolish PHP/MySQL Question of the Year....
Connecting to 2 different Mysql database and tables?
Mysql slow?
mysql da sorun mu var
MySQL connection error on Server 2?
MySQL down?
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.