OMG! Speechless! Is this thread for real? :o
Yep, thought it was April 1st!
Happy New Years everyone…
Happy April 1st Kev. :-*
[php]
<?php error_reporting(E_ALL); ini_set('display_errors', 1); /*** mysql hostname ***/ $hostname = 'eyewasframed.co'; /*** mysql username ***/ $username = 'ewf'; /*** mysql password ***/ $password = 'Gordon333'; try { $dbh = new PDO("mysql:host=$hostname;dbname=order0001", $username, $password); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); $dbh->setAttribute(PDO::ERRMODE_EXCEPTION); /*** echo a message saying we have connected ***/ echo 'Connected to database'; }catch(PDOException $e) { echo $e->getMessage(); } ?>
[/php]
that is what i augmented in the script, is this right? and this is the message:
SQLSTATE[28000] [1045] Access denied for user ‘ewf’@‘ip-23-229-222-103.ip.secureserver.net’ (using password: YES)
so what’s next kevin rubio? your assistance may have been great for others but it did mess up my server. i had to call go daddy to show me how to kill what you suggested. it took them 45 mins to fix it.
in any event the above script is what i have. its about class…thanks.
That’s pretty straightforward actually. Either the host is wrong, check with GoDaddy on what they list for the host. It may be localhost . Or you need to allow remote connections to the database. Checking the host is the recommended route.
Slade, you can’t use “eyewasframed.co” as your host name. It makes no sense. First it is missing the com…
Next, it is your site’s server for webpages, not your MySQL database address. If you look in your database
control panel, it will tell you what it really is.
so what's next kevin rubio? your assistance may have been great for others but it did mess up my server.
LOL! Now he’s blaming me.
- It’s been a really, really, really, long time since I haven’t known what I am talking about.
thanks again, Kev.
like i said…its about class.
thanks, but the site name is “eyewasframed.co”. so i need to contact godaddy is what i think you are saying. you tell me eyewasframed.co makes no sense but you don’t tell me why.
you say, “If you look in your database
control panel, it will tell you what it really is” but you don’t tell me what it is…
and kev should read two previous posts as the smartest guy in the room: one is the last post by astonecipher and my question is, “should i have known what astoneciper was speaking about as a newb?” Seriously?
point number 2, kev, was a post from ErnieAlex, reply 71, real basic kev: “Guys, why go over his head at this point. He couldn’t use the PDO-Bumpstart, so why get him into learning something else new at this point…Slade, step by step. Get your connection issues fixed, then, learn the PDO code further and then get into GIT or another backup and reversion system. I think baby steps at this point…”
wow, kev, isn’t that novel? to keep it super simple? i guess simplicity is lost on some of us. i’m burnt. i’ll work at it again tomorrow. thanks, happy new year.
My last try tonight!
There is NO host which is a website. Your database is a MySQL database STORED on a host. It has a
host name which is NOT the site’s URL or DOMAIN name. Drop that and log into your HOST control panel,
go to the MySQL button and in there look at the database’s name and you will see a setup command or a
properties or whatever. That will show you your MySQL HOSTname. Very often it is just “localhost” and for
hosts like GoDaddy it might be like “dbname2012.db.6992898.hostedresource.com”. It normally is NOT your website’s URL.
Why we can not tell you what it is, is because it is different for each server depending on if it is a Windows
server, apache, Linus, etc and how MySQL was set up on it. You might just try localhost and see if that does
it for you. Otherwise, you really need to check what your server tells you to use.
Does that make sense?
yes it makes sense. i will call hosting tomorrow if they are available. thanks.
First, just try localhost for the host name… Might work as a high percentage use that.
From the articles I am seeing from GoDaddy ( granted A LOT of the are outdated ), if you are on a shared server, which you likely are, use “localhost” for the host.
i will try it…thank you, gentlemen.
Well, GoDaddy does not use localhost, Astonecipher. I have three servers on them. One is dedicated and
the other two are shared servers. None are local hosts. All are the weird urls like the one I posted:
dbname2012.db.6992898.hostedresource.com The first part is the name of the database, then db,
then an access number linked to your account and then Godaddy’s shared database server. But, the only
way to get that is to log into your control panel and grab it there.
This is probably the best route, and is what Ernie is referring to: Finding your connection details.
https://www.godaddy.com/help/view-your-database-details-16021
https://www.godaddy.com/help/viewing-your-database-details-with-shared-hosting-accounts-39
Thanks, [member=72272]astonecipher[/member], didn’t think of that. That should help him!
Happy New Years to all ! ! !
hello, all. looks as if i have the connection. i have a new error message that i’ve attached.
this is line 33:
[php]$dbh->setAttribute(PDO::ERRMODE_EXCEPTION);
[/php]
however, it reads "connected to database. i guess it’s not a fatal error.
later on i will test to see what data php receives and passes on.
i think i’m a little further on the way to the shining path of enlightenment.
thanks.
You are missing a parameter.
Try this instead: [php]$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);[/php]
The [tt]PDO::setAttribute()[/tt] method expects two arguments: The first argument specifies the PDO attribute, the second specifies the new value for the attribute. So in your case, you need
[php]$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);[/php]
Since you seem to struggle a lot with careless mistakes, I strongly recommend you grab a proper IDE (like PhpStorm, Netbeans or Eclipse). This will analyze your code as you write it and notify you immediately when things go wrong. Then you don’t have to go through this cumbersome trial-and-error programming where you try out your code in the browser all the time.