|
| DB Form Wizard script | |
|
| | |
|
| | |
Joined: 24 Apr 2006 |
Posts: 11 |
|
|
|
Posted: Thu Jun 22, 2006 3:44 pm |
|
|
|
|
|
Ok I see what is going on. The script the wizard made is poiting toward the file
require_once $site["path"].'db_myutil.inc';
ensureConnectionAvailable();
However, that function is not in the db_myutil.inc script
I did find that function in some of the other ones you listed. I tried to paste the function in the db_myutil script, but then it errors out with Fatal error: Call to undefined function: isconnectionavailable() in ... while seeking another function.
This is odd also because I chose the option of a stand alone script..so it should not have written the code that way anyway right?
ddmitrie wrote: | ensureConnectionAvailable() comes with DB module that should be included.
Depending on DB it can be either db_ibutil.inc, db_myutil.inc, db_pgutil.inc, db_util.inc, db_mssqlutil.inc, db_oracleutil.inc, or db_sqliteutil.inc.
Let me know if this was not included in code generated by the wizard. |
|
|
|
| | |
|
| | |
|
| | |
Site Admin
Joined: 13 Jul 2003 |
Posts: 8344 |
|
|
|
Posted: Sat Jun 24, 2006 4:42 pm |
|
|
|
|
|
then you need to triple check
below is the file listing of db_myutil.inc (Apr 3 2006, 20:46), bundled with PhpED version 4.6:
<?
/*
Misc MySQL utils to use with PHPEd generated scripts
*/
function isConnectionAvailable() {
return(function_exists('mysql_connect'));
}
function ensureConnectionAvailable() {
if (isConnectionAvailable()) {
return(true);
} else {
die("Please enable MySQL extension !");
}
}
function dbconnect($dbhost, $dbuser, $dbpass, $dbname) {
mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error());
mysql_select_db($dbname) or die(mysql_error());
}
function dbquery($sql){
return mysql_query($sql);
}
function dbnext($res){
return mysql_fetch_array($res);
}
function str2date($str){
global $site;
ereg('([0-9]{1,2})[./-]([0-9]{1,2})[./-]([0-9]{3,4})', $str, $arr);
if($site['sdate']=='mdy')
return "$arr[3]-$arr[1]-$arr[2]";
if($site['sdate']=='dmy')
return "$arr[3]-$arr[2]-$arr[1]";
if($site['sdate']=='ymd')
return "$arr[1]-$arr[2]-$arr[3]";
}
function date2Str($date){
global $site;
$d = split(' ', $date);
$y = split('-', $d[0]);
if($site['sdate']=='mdy')
return "$y[1]$site[dsep]$y[2]$site[dsep]$y[0]";
elseif($site['sdate']=='dmy')
return "$y[2]$site[dsep]$y[1]$site[dsep]$y[0]";
elseif($site['sdate']=='ymd')
return "$y[0]$site[dsep]$y[1]$site[dsep]$y[2]";
}
function datetime2Str($date){
global $site;
$d = split(' ', $date);
$y = split('-', $d[0]);
if($site['sdate']=='mdy')
return "$y[1]$site[dsep]$y[2]$site[dsep]$y[0] $d[1]";
elseif($site['sdate']=='dmy')
return "$y[2]$site[dsep]$y[1]$site[dsep]$y[0] $d[1]";
elseif($site['sdate']=='ymd')
return "$y[0]$site[dsep]$y[1]$site[dsep]$y[2] $d[1]";
}
function WriteCombo($vals, $name, $selected){
$res = "<select name='$name'>\n";
while(list($val, $opt)=each($vals)){
$res .= "<option value='$val'".
(($val==$selected)?' selected':'').
">$opt</option>\n";
}
$res .= "</select>\n";
return $res;
}
function WriteLookupArray($valname, $titlename, $table){
global $db;
$ret = array();
$reslt=dbquery("select $valname, $titlename from $table");
while($row=dbnext($reslt)){
$ret[$row[0]] = $row[1];
}
return $ret;
}
function WriteLookupCombo($name, $valname, $titlename, $table, $selected){
return WriteCombo(WriteLookupArray($valname, $titlename, $table), $name, $selected);
}
function toGlobals($row) {
while(list($f, $v)=each($row)){
if(!is_int($f)){
$GLOBALS[$f] = $v;
}
}
} |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
All times are GMT - 5 Hours
Page 1 of 1
|
|
|
| |