/    Sign up×
Community /Pin to ProfileBookmark

connection problem

hi everyone,

Someone please help me. Tried online examples, tried many versions. Tried for 3hours. I couldn’t connect. I use bluehost server. I need your help please.

$con = odbc_connect(“Driver={MySQL ODBC 3.51 Driver};Server=xxx.xx.xxx.xxx:3306;Database=david;”, “usr”, “pwd”);

I have also tried this one,
$con = odbc_connect(“Driver={MySQL ODBC 3.51 Driver};Server=xxx.xx.xxx.xxx:3306;Database=david;”, $usr, $pwd);

Thank in advance

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogMar 07.2015 — What error(s) do you get? (Do you have error reporting turned on?)

Any particular reason you are using ODBC to connect to MySQL instead of PDO or MySQLi ?
Copy linkTweet thisAlerts:
@rootMar 08.2015 — That's what I was going to ask also NogDog.

have you tried the following?

[code=php]$con = new mysqli('localhost', 'my_user', 'my_password', 'my_db');
if ($mysqli->connect_error) {
die( "Connect Error ( " . $mysqli->connect_errno . " ) " . $mysqli->connect_error);
}
echo "YAY!!! We did it...";
[/code]


Also, try turning on error reporting, it might also help.
×

Success!

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