Skip to main content
April 13, 2010
Question

Problem connecting form to database

  • April 13, 2010
  • 1 reply
  • 418 views

I'm having trouble connecting a form to a database. The MySql connection is good and the Recordset tests okay, but in LiveView or live on the site I'm getting:

Warning: require_once(Connections/grphlth.php) [function.require-once]: failed to open stream: No such file or directory in /home/williaco/public_html/empinfo.php on line 1

Fatal error: require_once() [function.require]: Failed opening required 'Connections/grphlth.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in

/home/williaco/public_html/empinfo.php on line 1

The PHP code:

<?php require_once('Connections/grphlth.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;   
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_grphlth, $grphlth);
$query_Recordset1 = "SELECT * FROM empinfo";
$Recordset1 = mysql_query($query_Recordset1, $grphlth) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>

This topic has been closed for replies.

1 reply

April 15, 2010

I figured this one out.  And, yes, it was something really stupid!

April 24, 2010

Great!!! Please mark this thread as ANSWERED.