Hey guys,
Please help. I am using a tool called Webmaster to design my mysql tables but to my dismay the auto-generated php codes don't link to the database in my server. I know it's hard for you to understand the php codes if you don't use Webmaster to generate the php codes for you but i'd really appreciate it if any of you could help me identify what the problem is. Here's the link to Webmaster.
http://webmaster.webcentric1.com/bhelp/WebMASTERHelp_HTMLBuilder.php#Main
This is the error msg for the time being. I am taking a page called beyondgifts_add_Customer.php and wanted to save all the filled-in fields to my running mysql database server but got this error message instead.
1044: Access denied for user: '@localhost' to database 'mygifts'
There's a few library files besides the one i am attaching here called site_wide.php. And another seemingly important one is called standard.php, which i will I will post this on another new thread.
Below is the page i am trying to make sure connects to the mysql database.
beyondgifts_add_Customer.php
<?php
require('../library/standard.php');
require('functions.php');
checkDebug();
//=============================================================================
// beyondgifts_add_Customer_p.php Script
//
// Webcentric Data Services, Inc. provides this code 'as is' with no warranty of
// any kind. Webcentric Data Services, Inc. will not be responsible for the
// correction of any bugs or other deficiencies. In no event shall Webcentric
// Data Services, Inc. be liable for damages of any kind, including special,
// indirect or consequential damages, arising out of or in connection with use
// or performance of the code.
//
// The developer is encouraged to alter and customize the code. This code is
// an implementation of the interface that the WebMASTER generated code will use.
//
// This script was generated by Web Master to allow adding a record to the
// Customertable.
//=============================================================================
if( $i)
{
$i_enc = $i;
$i = wds_decrypt( $i);
}
$conn = new dbMySQLConn();
if( $i)
{
$l_sql = "update Customer "
. "set Company = '$Company' "
. ", NatureOfBusiness = '$NatureOfBusiness' "
. ", ContactPerson = '$ContactPerson' "
. ", Position = '$Position' "
. ", Address = '$Address' "
. ", Tel = $Tel "
. ", Fax = $Fax "
. ", MobilePhone = $MobilePhone "
. ", Email = '$Email' "
. ", Website = '$Website' "
. ", Birthday = '$Birthday' "
. ", Remarks = '$Remarks' "
. "where Customer_id = $i "
;
}
else
{
$l_sql = "insert into Customer "
. "( Company "
. ", NatureOfBusiness "
. ", ContactPerson "
. ", Position "
. ", Address "
. ", Tel "
. ", Fax "
. ", MobilePhone "
. ", Email "
. ", Website "
. ", Birthday "
. ", Remarks "
. ") values "
. "( '$Company' "
. ", '$NatureOfBusiness' "
. ", '$ContactPerson' "
. ", '$Position' "
. ", '$Address' "
. ", $Tel "
. ", $Fax "
. ", $MobilePhone "
. ", '$Email' "
. ", '$Website' "
. ", '$Birthday' "
. ", '$Remarks' "
. ")";
}
$result_id = $conn->exec( $l_sql);
if( $result_id == false)
{
echo "<P>Database Error</P>";
}
else
{
$l_redirect = "beyondgifts_list_Customer.php";
if( $r)
$l_redirect = $r . "?t=" . time();
if( $debug == "Y")
echo "<P>"
. "<A href=\"" . $l_redirect . "\">"
. $l_redirect
. "</A>"
. "</P>";
else
{
header( "location: $l_redirect");
exit;
}
}
?>