Page 1 of 1
Connect to MySQL
Posted: Mon Apr 12, 2010 10:56 am
by Insignia
The PHP way of connecting to MySQL.
Code: Select all<?php
$db = mysql_connect("mysql server", "username", "password")
or die("Cannot connect to: " . mysql_error());
echo "Succesfully connected to the MySQL Database";
mysql_close($db);
?>
Have Fun

Re: Connect to MySQL
Posted: Sat Jan 15, 2011 5:42 pm
by rocky4126
I'd use a PDO connection. More secure. Just my advice
Re: Connect to MySQL
Posted: Sat Jan 15, 2011 6:27 pm
by Scottie1972
I like to use MySQL.Connector.NET
LINK:
http://www.mysql.com/downloads/connector/net/
It is very easy to use, and there is all sorts of example code snippets all over the internet and a few nice snippets at the Snippet Library.
Snippet Library
LINK:
http://dlh-digital.com/Snippet/Welcome.php
Re: Connect to MySQL
Posted: Sat Jan 15, 2011 7:47 pm
by mandai
How is PDO more secure?
Re: Connect to MySQL
Posted: Fri Jun 10, 2011 7:01 pm
by IxPr0GrAm
The easiest way for me is just ftp and filezilla to also make forums with phpbb there is site that already got mysql built in and you can just make one for w/e the site is: Byethost.com
Re: Connect to MySQL
Posted: Fri Jun 10, 2011 9:14 pm
by daniz
Insignia wrote:The PHP way of connecting to MySQL.
Code: Select all<?php
$db = mysql_connect("mysql server", "username", "password")
or die("Cannot connect to: " . mysql_error());
echo "Succesfully connected to the MySQL Database";
mysql_close($db);
?>
Have Fun 
Try with: $db = mysql_connect("mysql server", "databasename", "username", "password")
mandai wrote:How is PDO more secure than the MySQL connector?
PDO prevents MySQL Injections with the prepared statements and its faster with the queryes!!