collecting data from html template for php script

You have VAULES. It is supposed to be VALUES and your closing double quote is outside the )

Your connection is $dbh the you start using $db out of nowhere and your missing a comma in your connection string before $user. These are all really careless mistakes.

There is much more wrong. You might want to refresh up on some PDO and programming tutorials.

with all due respect mr rubio i attempted to use the pdo_bumpstart_ver1.4 system and it fouled up my directory structure. it might be cool where one is starting from scratch but not where there is a file structure already in place on a remote server. i’m more confused than ever now. not your fault. i get this loud read error message reading no connection has been made. i followed the instructions in the readme text. next i attempted to employ the code given earlier:
[php]<?php
error_reporting(E_ALL);
ini_set(‘display_errors’, 1);
print_r($_POST);
die(“Got Here…Connections-order.php”);
?>[/php]
in hopes of catching where the errors are. still nothing directing me to where the errors are occurring. it may be better for me at this point to destroy the file structure i currently have and start over.

[php]

<?php //---------------------------------------------------------------------------- // Database Connection //---------------------------------------------------------------------------- // Set Your Database Connection Data (server_address, database, username, password) $dbhost = 'localhost'; $dbname = 'pdo_bumpstart'; $dbuser = 'root'; $dbpass = ''; try { $pdo = new PDO("mysql:host=$dbhost; dbname=$dbname", $dbuser, $dbpass); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { @mail("$email_to", "Database Down - ".APP_NAME, "The Database is down for ".APP_NAME, "From: $email_from\r\n"); die("

ERROR: No Database Connection

"); } ?>

the code above didn’t work either with regard to establishing a connection.

i type in the url to the site and i get that error: no database connection message:
eyewasframed.co
time to start from scratch.

[/php]

Did you enter the DB credentials for YOUR database?

In order to use it exactly as is,

your host needs to be localhost, your db needs to be named pdo_bumpstart, the user root needs access with NO password. If you have all that in place it will connect.

The comment clearly says:
// Set Your Database Connection Data (server_address, database, username, password)

Dont give up. There is nothing wrong with my code. You dont have the right parameters set.

If you were trying to run the PDO bumpstart DB there is no way it could mess up your directory structure. It is completely self contained and will run from any directory or sub-directory on the server. The only “setup” is importing the DB and setting your connection parameters.

Slade, this line…

$dbh = new PDO(“mysql:host=$hostname;dbname=mysql” $user, $password); /*this is line 41/

is missing a comma just before $user ! ! ! Easy mistake…

i have not given up and i wont. i have some of the best teachers to assist me. well, i’ve got some bad news. i was reading a tutorial from several sites so i could get a bit more insight. comes to find out that because the owner of the site is using a cms (moto cms) and this may make a difference. while i knew it was a site produced with a cms, i didn’t know that it may effect how i process php files…perhaps, but it may be a factor. is there anything i can do to see if this may be the culprit as to why the code is not processing.
don’t be cross with me…help me out, please. its not easy being green.

Well, Slade, keep at it… A CMS is basically a control-panel of sorts. It run over the site and controls parts of
it. But, you can also still directly access the database and still use it’s data. But, you must read my last post.
You have a bad PDO connection. You are missing a comma in it. Fix that and retest and let us know what the
next error is…

thanks for the encouragement guys.

in my attempt to delete pdo_bumpstart_ver1.4 that had my url showing the red “connection error” i now have encountered another slight issue. i get a new error message that reads "Forbidden

You don’t have permission to access / on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request."

i think it’s time to call godaddy and see if they can take the server back about 4 or 5 days or so. i think that once i get the server back to a state to where the url can be entered into the address bar and display the site i can begin again. thanks and see yall in a bit.

Slade, Godaddy doesn’t keep copies of your server. They do make server backups sometimes, but, it is really
up to the owner of the server. So, normally, during your developmental process, you make copies of all of
your files yourself. I normally place them into folders with their date on them. Then, I can back up if needed.
There are automated ways to do this, but, it’s just as easy to copy your files into a new folder…

Again, the 404 is that you are missing a folder, a file or you are pointing at the incorrect URL. In this case
of permisisons, you have told the code to access the root of your server. I am sure that is not what you
wanted your code to do…

Copying the project dir sounds like some random manual versioning process. I’m much more comfortable using version control (git) and having an incremental backup of that taken continuously.

I don’t agree manually copying / backing up files are just as easy as having a tool doing it automatically. In my experience if you have to do an operation manually you are way more likely to not do it. While an automated backup can run every minute if you want it to.

Crashplan and many more offers solutions to do this so you get incremental and versioned backups of your data saved off site. Also please remember that a folder copy, an external hard drive etc is not a backup, it’s a copy ^^

Discovering and using Git was one of the biggest improvements in my operation.

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…

While git is complicated, it is a separate entity from programming in general.

Git (or svn, mercurial, ect) would be good to learn as soon as possible while learning as well, in that if you make a major screw up, you can still revert to a working copy without having to recreate everything you had done.

thanks for the advice, guys. i’m back in. there was a change to the htaccess file or something. the help desk at the cms helped me get back in. now i can begin again. thanks. i haven’t given up on this project or on you guys. thanks…i couldn’t have gotten this far without y’all. :wink: i’m still on it.

happy Christmas Eve. blessings to you all and your families this holiday season.

here is where i think things may be going awry. it appears that the prac.php code i’m working with (trying to get this same connection) is not going to the public_html folder but instead to the directory just above (see img). the php file is supposed to be in the public_html file wich is the root, am i correct on that?
could this be my situation with regard to connecting?

when i enter the url (eyewasframed.co/prac.php) in the address bar i get a 500 server error message.

One other question, are these posts being displayed on the internet? i mean if i type in my url will these things we’re working on be in the index?

thanks and again very happy holidays


Your files need to be in public_html. That is the root directory for web accessible pages.

Slade, thanks! A very merry Christmas to all who are on this site!

Hang in there, Slade, you are making headway and can learn all you need here. To the others who have
helped him so far, thanks and Merry Christmas to you…

hello. yes i see the situation. now i can create a php doc in dreamweaver, save it then use filezilla to import it to the public_html on the server. while this is outside the scope of this forum how can i get dreamweaver to point to the public_html file as opposed to using the extra step via filezilla? I know it sounds a terribly naive question but i don’t know how i got things redirected. i believe that once i get the path straight i will be on my way. any input is honored and taken.

to chime in with ErnieAlex, to all who have assisted me in my learning and on this project thank you so much and to all of your families and to yourselves, have a great Holiday Season…

please be honest with me…i don’t have much but where can i donate?

hello, all. i’m still working through it. it seems i’m running my head into a brick wall. i’m sure this must be one of the easiest thing to do in php and i can’t get it right.

i continue to get a 404 error when i know i uploaded the file using filezilla.
below is a image of the filezilla file structure for public_html. it clearly shows that the file is there. yet its not found… >:(

here is the connection script:
[php]<?php

/*** mysql hostname ***/
$hostname = ‘xxxx.co’;

/*** mysql username ***/
$username = ‘xxxx’;

/*** mysql password ***/
$password = ‘xxxx’;

try {
$dbh = new PDO(“mysql:host=$hostname;dbname=mysql”, $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 “An Error Occurred. The Error Is Being Processed!”; //user friendly message
some_logging_function($ex->getMessage());
}
?>[/php]

the error message comes when using this url: http://eyewasframed.co/public_html/prac.php

its driving me batty


Sponsor our Newsletter | Privacy Policy | Terms of Service