/    Sign up×
Community /Pin to ProfileBookmark

Problem connecting to database

What’s up guys??…. Im trying to connect to this database but its not working. Here is the code and the error message that I get. Any help would be greatly appriciated.

Thanks in advance.
Code:

[code=php]/* Connect to the database */
$db = mysql_connect (“server”, “username”, “password”)
or die(“Could not connect”);[/code]

Error:
Fatal error: Call to undefined function: mysql_connect() in /home/groups/home/web/cosc/create_alumni_tables.php on line 3

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@skywalker2208Jun 07.2007 — I am not sure if you can use the or like that. I am not 100% about that though.

You could try using something like this which is directly off of the w3schools.com web site.
[code=php]
<?php
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}


mysql_close($con);
?>
[/code]
Copy linkTweet thisAlerts:
@harlemrisinauthorJun 07.2007 — ok thank you!
×

Success!

Help @harlemrisin 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.20,
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,
)...