Menu

Database deliver, password and config.inc.php

Help
Tyeise
2012-03-12
2013-06-03
  • Tyeise

    Tyeise - 2012-03-12

    I created a database with your formGenerator.  The form is currently at http://newportfinance.com/form.htm

    The website is hosted on bluehost.com, and they are the ones that recommended you.  I set up a database, and pointed the form to that database and table.  Under Delivery settings, it ways the password will not be stored; we'll ask you later.  I never got asked for my password.

    But when I submit my form, I keep getting the following error message:
    Could not connect to database: Access denied for user 'root'@'localhost' (using password: NO)

    I did look on your help forum, and the best I can figure out is that there should be a config.inc.php file that contains the password information.  The info I found also said that this version of the formGenerator should create that for me.  However, I can't find any such file, nor do I know how to create it.

    According to another post I found, it would be safer to have the file in admin/config.inc.php, and then to password protect that file.  Will that interfere with submitting the form in any way? Do I have to put that password somewhere in the coding for the form to access it?

    Thank you for any help you can provide.

     
  • TNTEverett

    TNTEverett - 2012-03-12

    It is always helpful to include the Form Generator Version you are using. 
    In any case I can help you fix whatever problems you are having if you make the files available to me.  Be sure not to include any private information if you post anything on this forum. 
    So to start I would need to see all or part of your processor.php file.  If you copy the file to a plain text file "p.txt" and send me a link to the file, or send me a SF email and we can use email outside the forum to send the files back and forth.  Up to you but somehow I need to see this one file. 

     
  • Tyeise

    Tyeise - 2012-03-13

    I have sent you messages containing the text of the file.  Messages start with newport financial as their topic.

     
  • TNTEverett

    TNTEverett - 2012-03-13

    Create this "config.inc.php" file.  Put it in the same folder as the "processor.php" file. 
    The $db_host is typically "localhost" but can be the fully qualified domain name of your site.
    The $db_user is a valid MySQL user name.
    The $db_pass is the valid password for $db_user.
    The $db_name is the name of a valid MySQL db.
    The $db_table is the table name in the valid MySQL db. 

    <?php
    $db_host="";
    $db_user="";
    $db_pass="";
    $db_name="";
    $db_table="";

    One of my "config.inc.php" files as an example.
    <?php
    $db_host="localhost";
    $db_user = "tnt";
    $db_pass = "xyz";
    $db_name = "testsql_db";
    $db_table = "testfilewritedb";

    The file can have the php typical trailing "?>" but it is not required in this case. 
    Also since this DB does not exist you will need to create it yourself.  I think the intention of the install.php was that this would allow you to create the DB by pointing your browser to this file but I can see that it is blank and this will not work for you. 
    In your case you will need a named DB with some table that has 32 field entries that are compatible with your form data types.  I can probably help you create the SQL required to create this if you don't know how to do it using something like phpMyAdmin.

     
  • Tyeise

    Tyeise - 2012-03-13

    Thank you for your quick response.  I don't get any more errors, but when I open my database, there is nothing there.  Am I still doing something wrong?

     
  • TNTEverett

    TNTEverett - 2012-03-13

    Are you familiar with phpMyAdmin?
    If you open it do you see your DB/Table/Fields?

     
  • Tyeise

    Tyeise - 2012-03-13

    I have gone into the control panel, and opened phpMyAdmin.  I created a database, and can go in and see the database, the table and the fields.

     
  • Tyeise

    Tyeise - 2012-03-13

    Just an additional thought.  I am very familiar with Microsoft Access, not so much with phpMyAdmin.  But I find a lot of the basics about tables and fields to be the same.

     
  • TNTEverett

    TNTEverett - 2012-03-13

    When I have issues I like to add some debug features to the processor.php file.
    At the top just after "<?php" add "$DEBUG=1;".
    Just before "mysql_query($query)" add "if($DEBUG) {print "<li>".$query."<br>";}".
    Just before "mail(" add "if($DEBUG){exit;}".

    This will print the SQL query that should be adding data to the DB.  You can check this query by copying the printed text and entering it directly in phpMyAdmin. 

     
  • Tyeise

    Tyeise - 2012-03-13

    Ok, the text I got was:

    ".$query."
    ";} mysql_query($query); mysql_close($link); if($DEBUG){exit;} mail("info@newportfinance.com","phpFormGenerator - Form submission","Form data: Borrower Name: " . $_POST . " Borrower date of birth: " . $_POST . " Co-Borrower: " . $_POST . " Co-borrower date of birth: " . $_POST . " Property Address: " . $_POST . " Property Address: " . $_POST . " City: " . $_POST . " State: " . $_POST . " Zip Code: " . $_POST . " Home Phone: " . $_POST . " Work Phone: " . $_POST . " Cell Phone: " . $_POST . " Email Address: " . $_POST . " Year Built: " . $_POST . " Original Cost: " . $_POST . " Year Aquired: " . $_POST . " Current Value: " . $_POST . " New Mortgage Request: " . $_POST . " Occupancy Status: " . $_POST . " Property Type: " . $_POST . " Annual Taxes: " . $_POST . " Annual Insurance: " . $_POST . " Loan Officer: " . $_POST . " Field question 1: " . $_POST . " Field question 2: " . $_POST . " Field question 3: " . $_POST . " Field question 4: " . $_POST . " Address: " . $_POST . " Address: " . $_POST . " City: " . $_POST . " State: " . $_POST . " Zip Code: " . $_POST . " powered by phpFormGenerator. "); include("confirm.html"); ?>

    The query then reads:
    SELECT `Applications`.*
    FROM Applications
            ".$query."
    ";} mysql_query($query); mysql_close($link); if($DEBUG){exit;} mail("info@newportfinance.com","phpFormGenerator - Form submission","Form data: Borrower Name: " . $_POST . " Borrower date of birth: " . $_POST . " Co-Borrower: " . $_POST . " Co-borrower date of birth: " . $_POST . " Property Address: " . $_POST . " Property Address: " . $_POST . " City: " . $_POST . " State: " . $_POST . " Zip Code: " . $_POST . " Home Phone: " . $_POST . " Work Phone: " . $_POST . " Cell Phone: " . $_POST . " Email Address: " . $_POST . " Year Built: " . $_POST . " Original Cost: " . $_POST . " Year Aquired: " . $_POST . " Current Value: " . $_POST . " New Mortgage Request: " . $_POST . " Occupancy Status: " . $_POST . " Property Type: " . $_POST . " Annual Taxes: " . $_POST . " Annual Insurance: " . $_POST . " Loan Officer: " . $_POST . " Field question 1: " . $_POST . " Field question 2: " . $_POST . " Field question 3: " . $_POST . " Field question 4: " . $_POST . " Address: " . $_POST . " Address: " . $_POST . " City: " . $_POST . " State: " . $_POST . " Zip Code: " . $_POST . " powered by phpFormGenerator. "); include("confirm.html"); ?>

    The error message then says:

    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '".$query." ";} mysql_query($query); mysql_close($link); if($DEBUG){exit;} mail(' at line 3

     
  • TNTEverett

    TNTEverett - 2012-03-13

    Must be some syntax error in the additions you made.  Give me some time to work on this and I will get back to you.

     
  • TNTEverett

    TNTEverett - 2012-03-13

    I have this working on my server.
    I have attached files that I used.  I have also included the SQL required to create your DB table.
    You only had 28 fields so this is the most obvious difference in the processor.php file. 

    Use the SQL to create the DB and table.
    Copy over the processor.php and it should work as long as you have the right info in the config.inc.php file

     
  • Tyeise

    Tyeise - 2012-03-13

    Hmmm… I looked over the text I sent you again, and found 4 form fields I don't remember creating.  I went ahead and created them in the database.

    You said you attached files - please excuse my being dense, where or how do I get them?

    Thanks.

     
  • TNTEverett

    TNTEverett - 2012-03-13

    Sorry, I've been sending files to your email identified in the process.php file.  If you can not get them, please send me your email address (something outside this forum) through my SF email. 

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.