CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Please help me mysql database

Print topic Send  topic

Author Message
Shoaib
Posted: 01/13/2003, 9:17 PM

Code charge website provide us an example of user registration form with three types of databases Microsoft ACCESS, sql server and mysql database. I have installed mysql database in my home i compile all the tables from sql script that is provideed by code charge and my tables are created in mysql database
So my question is that how to connect with these tables code charge studio includes two types of connection custom aur dsn which one to use if i choose nothing that it give me error that you have noi connection string i also change the values in common.php but when i connect to mywebserver i see a error

Fatal error: Cannot instantiate non-existent class: db_sql in G:\Inetpub\wwwroot\php registration form\common.php on line 19

I am also sending you my common.php file



-------------------------------------------------------------------------
<?php
/*********************************************************************************
* Filename: common.php
* Generated with CodeCharge v.1.1.19
* PHP build 02/26/2001
*********************************************************************************/
error_reporting (E_ALL ^ E_NOTICE);

//-- handling database connection
include("./");

define("DATABASE_NAME","persons");
define("DATABASE_USER","Internet");
define("DATABASE_PASSWORD","gnitaerc");
define("DATABASE_HOST","localhost");


//-- Database class
$db = new DB_Sql();
$db->Database = DATABASE_NAME;
$db->User = DATABASE_USER;
$db->Password = DATABASE_PASSWORD;
$db->Host = DATABASE_HOST;

$db2 = new DB_Sql();
$db2->Database = DATABASE_NAME;
$db2->User = DATABASE_USER;
$db2->Password = DATABASE_PASSWORD;
$db2->Host = DATABASE_HOST;


function tohtml($strValue)
{
return htmlspecialchars($strValue);
}

function tourl($strValue)
{
return urlencode($strValue);
}

function get_param($ParamName)
{
global $HTTP_POST_VARS;
global $HTTP_GET_VARS;

$ParamValue = "";
if(isset($HTTP_POST_VARS[$ParamName]))
$ParamValue = $HTTP_POST_VARS[$ParamName];
else if(isset($HTTP_GET_VARS[$ParamName]))
$ParamValue = $HTTP_GET_VARS[$ParamName];

return $ParamValue;
}

function get_session($ParamName)
{
global $HTTP_POST_VARS;
global $HTTP_GET_VARS;
global ${$ParamName};

$ParamValue = "";
if(!isset($HTTP_POST_VARS[$ParamName]) && !isset($HTTP_GET_VARS[$ParamName]) && session_is_registered($ParamName))
$ParamValue = ${$ParamName};

return $ParamValue;
}

function set_session($ParamName, $ParamValue)
{
global ${$ParamName};
if(session_is_registered($ParamName))
session_unregister($ParamName);
${$ParamName} = $ParamValue;
session_register($ParamName);
}

function is_number($string_value)
{
if(is_numeric($string_value) || !strlen($string_value))
return true;
else
return false;
}

function is_param($param_value)
{
if($param_value)
return 1;
else
return 0;
}

function tosql($value, $type="Text")
{
if($value == "")
{
return "NULL";
}
else
{
if($type == "Number")
return doubleval($value);
else
{
if(get_magic_quotes_gpc() == 0)
{
$value = str_replace("'","''",$value);
$value = str_replace("\","\\",$value);
}
else
{
$value = str_replace("\'","''",$value);
$value = str_replace("\\"","\"",$value);
}
return "'" . $value . "'";
}
}
}

function strip($value)
{
if(get_magic_quotes_gpc() == 0)
return $value;
else
return stripslashes($value);
}



function dlookup($Table, $fName, $sWhere)
{
global $db2;
$db2 = new DB_Sql();
$db2->Database = DATABASE_NAME;
$db2->User = DATABASE_USER;
$db2->Password = DATABASE_PASSWORD;
$db2->Host = DATABASE_HOST;

$db2->query("SELECT " . $fName . " FROM " . $Table . " WHERE " . $sWhere);
if($db2->next_record())
return $db2->f(0);
else
return "";
}


function get_checkbox_value($sVal, $CheckedValue, $UnCheckedValue)
{
if(!strlen($sVal))
return tosql($UnCheckedValue);
else
return tosql($CheckedValue);
}

//- function returns options for HMTL control "<select>" as one string
function get_options($sql,$is_search,$is_required,$selected_value)
{
global $db2; //-- connection special for list box

$options_str="";
if ($is_search)
$options_str.="<option value=\"\">All</option>";
else
{
if (!$is_required)
{
$options_str.="<option value=\"\"></option>";
}
}

$db2->query($sql);
while ($db2->next_record($sql))
{
$id=$db2->f(0);
$value=$db2->f(1);
$selected="";
if ($id == $selected_value)
{
$selected = "SELECTED";
}
$options_str.= "<option value='".$id."' ".$selected.">".$value."</option>";
}
return $options_str;
}
//--------------------------
function get_lov_options($lov_str,$is_search,$is_required,$selected_value)
{
$options_str="";
if (!$is_required && !$is_search)
$options_str.="<option value=\"\"></option>";

$LOV = split(";", $lov_str);

if(sizeof($LOV)%2 != 0)
$array_length = sizeof($LOV) - 1;
else
$array_length = sizeof($LOV);
reset($LOV);

for($i = 0; $i < $array_length; $i = $i + 2)
{
$id = $LOV[$i];
$value = $LOV[$i + 1];
$selected="";
if ($id == $selected_value)
$selected = "SELECTED";

$options_str.= "<option value='".$id."' ".$selected.">".$value."</option>";
}
return $options_str;
}
//--------------------------
//-- function take $lov_str as parameter, parse it and return the result as array
function get_lov_values($lov_str)
{
$options_str="";
$LOV = split(";", $lov_str);

if(sizeof($LOV)%2 != 0)
$array_length = sizeof($LOV) - 1;
else
$array_length = sizeof($LOV);
reset($LOV);

$values = array();
for($i = 0; $i < $array_length; $i = $i + 2)
{
$id = $LOV[$i];
$value = $LOV[$i + 1];
$values[$id] = $value;
}
return $values;
}



function check_security($iLevel)
{
global $UserRights;
if(!session_is_registered("UserID"))
header ("Location: Login.php?querystring=" . tourl(getenv("QUERY_STRING")) . "&ret_page=" . tourl(getenv("REQUEST_URI")));
else
if(!session_is_registered("UserRights") || $UserRights < $iLevel)
header ("Location: Login.php?querystring=" . tourl(getenv("QUERY_STRING")) . "&ret_page=" . tourl(getenv("REQUEST_URI")));
}

?>

-----------------------------------------------------------------------------



SnakePLiSKiN
Posted: 01/13/2003, 11:48 PM

I am not that good with PHP I mainly use ASP, but anyhow, If I'm looking at this right I would say your getting an error from the Database Server connection part. Not the local database connection but the 2nd one that the site would use AFTER it is published.

I dont know if this matters for PHP but, You may want to check to see if you are going to need MyODBC installed. I use the connection string:

"driver={MySql}; database=YourDatabase; server=your.hostname.com; uid=username; pwd=yourpassword"

If you have the newer driver version "driver={MySQL ODBC 3.51 Driver};" and you can use an IP address for the servername.

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.