/    Sign up×
Community /Pin to ProfileBookmark

php MySQL database connection function?

I have been looking on the net 4 awhile now with no luck I figured Id try asking 4 help. I trying to find a simple example of a function that makes a connection between php and a MySQL database. Im really new to php! Also do you have to create a connection before using sql statements or is the connection just used to view the database? Any help would be appreciated.
greatly appreciated!

to post a comment
PHP

7 Comments(s)

Copy linkTweet thisAlerts:
@TheRaveFeb 29.2008 — w3schools.com is where I started my php life. There is some basic php tutorials on there including a number of pages on MySQL databases:

http://www.w3schools.com/php/php_mysql_connect.asp
Copy linkTweet thisAlerts:
@MrCoderFeb 29.2008 — w3schools.com is where I started my php life. There is some basic php tutorials on there including a number of pages on MySQL databases:

http://www.w3schools.com/php/php_mysql_connect.asp[/QUOTE]


/salute o7


But honestly w3schools is out of date, you should learn MySQLi
Copy linkTweet thisAlerts:
@TheRaveFeb 29.2008 — True dat!

But might be better for him starting off on something that's more widely supported.

On two of the sites I've made it took weeks to get my client's host to enable php_mysqli.dll
Copy linkTweet thisAlerts:
@MrCoderFeb 29.2008 — I wish somebody had told me to use MySQLi on the first day ?

It will be harder then learning MySQL, but I think the step learning curve far out weights the fact that you would otherwise be using an outdated interface.

I think its a great way to get in to OOP too as MySQLi is great example of practical OOP usage.

Plus with MySQLi you dont have to worry about SQL injection.
Copy linkTweet thisAlerts:
@conrad4784authorMar 01.2008 — Thank you both for the help I will definitly check out the website (TheKrave) and MySQLi(MrCoder)
Copy linkTweet thisAlerts:
@conrad4784authorMar 01.2008 — Ive got another question for you guys. I need to download apache onto my computer and I found this site that allows you to download using mirrors Im not sure what this is and I cant find a download button here is the link

<a href ="http://httpd.apache.org/download.cgi"> http://httpd.apache.org/download.cgi</a>

any help would be appreciated thanks
Copy linkTweet thisAlerts:
@NogDogMar 01.2008 — If installing on Windows, you might want to look at http://www.wampserver.com/en/ for an all-in-one installer (Apache, PHP, MySQL, and assorted related tools).

As far as introductory tutorials go, check out http://devzone.zend.com/node/view/id/627.

But the primary reference for any PHP functions should be http://www.php.net/manual/en/. Or, just enter "http://www.php.net/[i]function_name[/i]" to find out about any specific function.
×

Success!

Help @conrad4784 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.7,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...