Link to home
Start Free TrialLog in
Avatar of Wanda Marston
Wanda MarstonFlag for Canada

asked on

Data not going into Database receiving a "500 Internal Server Error".

I am attempting to put form information into a database. The data is not going into the database and I am getting the following error. I have tried changing my code but do not know what I am missing.

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Following is the code for the php page that contains the form.
<?php

// Require the configuration before any PHP code as the configuration controls error reporting:
require ('./includes/config.inc.php');
// The config file also starts the session.

// Require the database connection:
require (MYSQL);

// For storing errors:
$DavisHome_errors = array();

// Check for a form submission:
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
	
	// Check for a contactor name:
			if (!empty($_POST['Name'])) {
		$o = mysqli_real_escape_string ($connect, $_POST['Name']);
	} else {
		$DavisHome_errors['Name'] = 'Please enter a Name for the Contractor.';
	}

	// Check for information:
			if (!empty($_POST['Info'])) {
		$a = mysqli_real_escape_string ($connect, $_POST['Info']);
	} else {
		$DavisHome_errors['Info'] = 'Please enter any contact Information.';
	}
	
	// Check for a type:
				if (!empty($_POST['Type'])) {
		$m = mysqli_real_escape_string ($connect, $_POST['Type']);
	} else {
		$DavisHome_errors['Type'] = 'Please enter the Type of Work.';
	}
	
	// Check for a an hourly rate:
				if (!empty($_POST['Hourly'])) {
		$c = mysqli_real_escape_string ($connect, $_POST['Hourly']);
	} else {
		$DavisHome_errors['Hourly'] = 'Please enter an Hourly Rate';
	}

	// Check for Cash, Check or Credit:
					if (!empty($_POST['Monetary'])) {
		$t = mysqli_real_escape_string ($connect, $_POST['Monetary']);
	} else {
		$DavisHome_errors['Monetary'] = 'Cash, Check or Credit?';
	}
	
	// Check for speed:
				if (!empty($_POST['Speed'])) {
		$l = mysqli_real_escape_string ($connect, $_POST['Speed']);
	} else {
		$DavisHome_errors['Speed'] = 'Quick or Slow?';
	}

	// Check for a description:
			if (!empty($_POST['Description'])) {
		$d = mysqli_real_escape_string ($connect, $_POST['Description']);
	} else {
		$DavisHome_errors['Description'] = 'Please enter a Description.';
	}
	
if (empty($DavisHome_errors)) { // If everything's OK...

//INSERT DATA
				
$N = $_POST["Name"];
$I = $_POST["Info"];
$T = $_POST["Type"];
$H = $_POST["Hourly"];
$M = $_POST["Monetary"];
$S = $_POST["Speed"];
$D = $_POST["Description"];
				
//if (isset($_POST['submit'])){
$q = "INSERT INTO contractors (Name, Info, Type, Hourly, Monetary, Speed, Description) VALUES ('".$N."', '".$I."', '".$T."', '".$H."', '".$M."', '".$S."' ,'".$D."')";

			$r = mysqli_query ($connect, $q);

			if (mysqli_affected_rows($connect) == 1) { // If it ran OK.
			}
			
										// Let the user know that a Contractor has been added:
				include ('./includes/header.html');
		
						echo '<h3>Your Contractor Should now be listed!</h3>';
	
				
				include ('./includes/footer.html');
				exit();
				
			// Clear $_POST:
			$_POST = array();
				
			}
}

?>

<!doctype html>
<!--[if lt IE 7]> <html class="ie6 oldie"> <![endif]-->
<!--[if IE 7]>    <html class="ie7 oldie"> <![endif]-->
<!--[if IE 8]>    <html class="ie8 oldie"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="">
<!--<![endif]-->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>DavisvilleMews</title>

<script>
<!--
var limit = 300;
var left = limit;

function chlimit(what){
        var count = what.value.length;
        left = limit - count;

        if (left < 0) {
                what.value = what.value.substring(0,limit)
                placeholderobj.innerHTML = lengthleft
        }
        document.getElementById("div1").innerHTML="Characters Left = " + left;
}
// -->
</script>
<link href="boilerplate.css" rel="stylesheet" type="text/css">
<link href="css/Davisville.css" rel="stylesheet" type="text/css">
<!-- 
To learn more about the conditional comments around the html tags at the top of the file:
paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/

Do the following if you're using your customized build of modernizr (http://www.modernizr.com/):
* insert the link to your js here
* remove the link below to the html5shiv
* add the "no-js" class to the html tags at the top
* you can also remove the link to respond.min.js if you included the MQ Polyfill in your modernizr build 
-->
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script src="respond.min.js"></script>
</head>
<body>
<div class="gridContainer clearfix">
  <header class="fluid Header">
    <div align="center"><img src="DavisvileMewsSign.jpg" alt="DavisvilleMewsSign"/></div>
  </header>
  <div class="fluid ProperQuotes">
    <p>Davisville Mews Homeowner's Association</p>
    <p>Post your information about any contractors or workers that other <br>
      people in the circle may contact. We can revise these pages at any time in the future if this layout does not seem to be useful. </p>
<?php 
// Need the form functions script, which defines create_form_input():
require ('./includes/form_functions.inc.php');	
?>
<form action="DavisHome.php" method="POST" accept-charset="utf-8">
        
        <p><label for="Contractor" class="SmallHeading"><strong>Contractor</strong></label>
		<p class="noticeType">Please enter the name of the contractor or organization.</p>
		<?php create_form_input('Name', 'text', $DavisHome_errors); ?><br />
        
        <p>
          <label for="Phone No. / Email" class="SmallHeading"><strong>Phone # / Email</strong></label><strong></strong>
        <p class="noticeType">Contact information for the contractor. 
		    <br /></small></p>
        <?php create_form_input('Info', 'text', $DavisHome_errors); ?><br />
	    
        <p>
          <label for="Phone No. / Email" class="SmallHeading"><strong>Type of Work</strong></label><strong></strong>
        <p class="noticeType">Type of contactor - plumber, electrical, etc. 
		    <br />
        If we get a lot of a certain type we can make sub categories later.</small></p>
        <?php create_form_input('Type', 'text', $DavisHome_errors); ?><br />

		<p>
		  <label for="Hourly Rate" class="SmallHeading"><strong>Hourly Rate</strong></label>
        <p class="noticeType">Less than 20 characters please.</p> 
		<?php create_form_input('Hourly', 'text', $DavisHome_errors); ?><br />
        
        <p><label for="Monetary" class="SmallHeading"><strong>Cash, Check, Credit</strong></label>
        <p class="noticeType">Which payment do they prefer?</p>       
        <?php create_form_input('Monetary', 'text', $DavisHome_errors); ?><br />
        
        
        <p>
        <label for="Good Value?" class="SmallHeading"><strong>Quick or Slow?</strong></label>
        <p class="noticeType">Are they good value for the money?</p>        
		<?php create_form_input('Speed', 'text', $DavisHome_errors); ?><br />
        
        </p>
        <p><label for="Description" class="SmallHeading"><strong>Description</strong></label>
      <p>Please enter a brief description. You have up to 300 characters<br />
which includes spaces and special characters.</p>
		<p>
  <?php create_form_input('Description', "textarea", $DavisHome_errors,"maxlength='300' onkeyup='return chlimit(this)' "); ?>
<div id="div1">Characters Left = 300</div>

<p><input type="submit" name="submit_button" value="Submit Your Notice &rarr;" id="submit_button" class="formbutton"  /></p>

</form>
 
</div>
 </div>

<div class="fluid Quotes"></div>
<div></div>


<div class="gridContainer clearfix">
  <footer class="fluid Footer">This is the content for Layout Footer Tag "Footer"</footer>
</div>

</body>
</html>

Open in new window

Avatar of Kim Walker
Kim Walker
Flag of United States of America image

Just looking at the first 80 or so lines I'm wondering...
  1. Is the mysqli connection established in the required config.inc.php file?
  2. Why is the static variable MYSQL required but never used?
  3. Why are you storing escaped $_POST values into variables that are never used? ($o, $a, $m, $c, $t, $l, and $d)
  4. Why are you using the raw $_POST values in the insert statement? ($N, $I, $T, $H, $M, $S, and $D)

But none of these is likely to be causing your error. I suspect there might be an issue with reserved words such as Name and Type. Try adding backticks to your column names to avoid the reserved word conflict. Or better yet, change the names of your column to non-reserved words. (And use your escaped values.)
$q = "INSERT INTO `contractors` (`Name`, `Info`, `Type`, `Hourly`, `Monetary`, `Speed`, `Description`) VALUES ('".$o."', '".$a."', '".$m."', '".$c."', '".$t."', '".$l."' ,'".$d."')";

Open in new window

Avatar of Dave Baldwin
I ran into that yesterday when my 'include' for the database connection wasn't looking in the correct directory.
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Wanda Marston

ASKER

Thank you all for your comments. My code is based on similar pages that have worked in the past, although, have recently had some similar errors when attempting to get into the database of those particular sites.

I realize that that my PHP may not be as clean as it can be, although I must say a lot of this has come from previous questions posted to Experts-Exchange.

I believe that Ray Paseur has the answer that woul solve my problem.
@Ray Paseur. I almost agree with you. But I have run into several situations in the past where my SQL statement caused MySQL to bog down and resulted in a 500 Server Error. I do believe the vast majority of 500 Server Errors are server related, though.
Kim: Yes, I agree that it's possible to "break" the SQL server, but that is a pretty extreme edge case in my experience.  I've only ever seen it happen at GoDaddy, and only when the number of PHP clients (shared hosting) outgrew the capabilities of a shared SQL server.  So, like once in 15 years.  

I have also seen a bullfrog the size of a house cat in my swimming pool, but it's pretty rare.

:-)
Ray: about six months ago I had an error in an SQL statement that repeatedly resulted in a 500 Server error rather than returning an error code. I can't remember exactly what that was but it had something to do with using the wrong word or function name and it was on a GoDaddy server. Anyway, it made me skeptical of the server error as more of a catch-all error.

I would like to see if putting backtics around the reserved words would eliminate the error though. It's easy enough to try.
Hello all,

I have been in touch with my web host and awaiting their reply. Normally I do not have a problem with them - Netfirms - but when I do they do no admit any fault. Any ideas as to what could have been the problem from their end.

ALSO, this is interesting. I just looked at my database and there is now a number of fields filled up which were not filled yesterday and I was getting the red box with the white x when I attempted to open up the table. So I believe that something funny is happening with the server.  Just to reiterate, most of my code is modelled after other pages that work but the big difference is that this page does not need a user id or a user with a password. I have attempted to take all that out and leave just a bare bones PHP pages that inputs items into a database and then another page that will display it.
Have you tried putting backtics around the reserved words in your SQL? Did the other pages that worked use reserved words for column names? Have you tried executing the SQL statement directly in phpMyAdmin or whatever you are using for your database interface? I'll be happy to admit I'm wrong if you try it and it doesn't work. It'll only take a few seconds to try.
I understand what you are saying and haven't tried that yet as the code as I feel that the code as it is now should work, even if it is not conventional. I have never had to use back ticks before and don't like them. However, I may try your suggestions after I hear back from the web hosts. Thanks.
If you are using MySQL 'reserved words' without the back ticks, all bets are off.  Using back ticks is the recommended method for the database, table and column names even when they are not reserved words.
I believe the pages that worked did not have reserved words. However, which words are reserved in my sample - is the word "Type" one of these?

Following is code from the pages that work
//if (isset($_POST['submit'])){
$q = "INSERT INTO notices (users_id, organization, alternate, amount, currency, timeframe, location, description) VALUES ({$_SESSION['user_id']},'".$o."', '".$a."', '".$m."', '".$c."', '".$t."', '".$l."' ,'".$d."')";
//if (isset($_POST['submit'])){
$q = "INSERT INTO notices (users_id, organization, alternate, amount, currency, timeframe, location, description) VALUES ({$_SESSION['user_id']},'".$o."', '".$a."', '".$m."', '".$c."', '".$t."', '".$l."' ,'".$d."')";

Open in new window


Following is the example given in this question
//if (isset($_POST['submit'])){
$q = "INSERT INTO contractors (Name, Info, Type, Hourly, Monetary, Speed, Description) VALUES ('".$N."', '".$I."', '".$T."', '".$H."', '".$M."', '".$S."' ,'".$D."')";

Open in new window

Here is the 'official' list of words that are 'reserved' in MySQL:  https://dev.mysql.com/doc/refman/5.7/en/keywords.html
Okay thank you. I will check it out.
I changed the word "Type" and used "Labor", then got the same 500 Internal Server Error and nothing went into the database.

I was successful in entering data into the database using mysqladmin.

My webhosts want to know the exact URL. Oddly enough when I tried to use their LiveChat option the other day to ask them the same question, I was getting the same kind of error messages.

I am about to try the backtick method.
Okay I tried putting in backticks but I most likely put them in the wrong spot. However, I have single quotes, double quotes and now backticks. It seems like the code should be simpler.

$q = "INSERT INTO contractors (Name, Info, Labor, Hourly, Monetary, Speed, Description) VALUES (`'".$N."'`, `'".$I."'`, `'".$L."'`, `'".$H."'`, `'".$M."'`, `'".$S."'` ,`'".$D."'`)";

Open in new window

The back ticks go around the column names and quotes go around the values.
$q = "INSERT INTO contractors (`Name`, `Info`, `Labor`, `Hourly`, `Monetary`, `Speed`, `Description`) VALUES ('".$N."', '".$I."', '".$L."', '".$H."', '".$M."', '".$S."' ,'".$D."')";

Open in new window

If you copy and paste the sql string from my original comment, you'll not only add all the backticks but you'll be inserting the escaped string values instead of the raw ones too. Here it is again
$q = "INSERT INTO `contractors` (`Name`, `Info`, `Type`, `Hourly`, `Monetary`, `Speed`, `Description`) VALUES ('".$o."', '".$a."', '".$m."', '".$c."', '".$t."', '".$l."' ,'".$d."')";

Open in new window

Sorry thanks. I thought that someone had posted the sql string but for some reason couldn't find it - maybe an indication why this just isn't working out - obviously missing something.

Will try it again.
Got the same problem.

However this is the line that may be giving me a problem -

      $r = mysqli_query ($connect, $q);

Since I took this bit of code out of the script as I don't have a user and password situation and had taken the following code out.
<?php

$q = "SELECT id, username FROM users WHERE id={$_SESSION['user_id']}";

$r = mysqli_query($connect, $q);

if (mysqli_num_rows($r) > 0) {

while ($row = mysqli_fetch_array($r, MYSQLI_NUM)) {
	
		
 echo "<p><h2>Hello $row[1]!</p> 
 You can post a notice on this page.</p> 
 Please enter correct information in every form field. </h2>";
}
}
?>

Open in new window

Here is a working version of your code above.  It include the session_start(); required to make $_SESSION variables available and the connection string to access the database server.
<?php
error_reporting(E_ALL);
session_start(); 

include("dbivars.php");
// Opens a connection to a mySQL server
$connect = new mysqli($dbhost, $dbuser, $dbpass, $dbname);

if ($connect->connect_errno) {
    echo "Failed to connect to MySQL: (" . $connect->connect_errno . ") " . $connect->connect_error;
	}

$_SESSION['user_id'] = 3;

$q = "SELECT `id`, `username` FROM `users` WHERE `id` = {$_SESSION['user_id']}";

$r = mysqli_query($connect, $q);

if (mysqli_num_rows($r) > 0) {

	while ($row = mysqli_fetch_array($r, MYSQLI_NUM)) {
		echo "<h2>Hello $row[1]!</h2>
		<p>You can post a notice on this page.</p>
		Please enter correct information in every form field.</p>";
		}
	}
?>

Open in new window

That was question #1 in my original comment. Where is the MySQL connection being established? I assumed it was in the required config.inc.php file. Perhaps I should have elaborated more on that. But you are using a $connect variable that isn't being defined in the code you've posted.
The MySql connection should be established in these lines and should be reading the mysql.inc.php file.

// Require the database connection:
require (MYSQL);

This site does not have  registration process so no username or password or userid colum in the database.
The connection to the database is clear in my example code above.  None of us can see how you are making a connection.   require (MYSQL); is not adequate to do that.  And I happen to know from recent experience that a 500 error can occur when your database connection statement is missing for some reason.  In my case, I forgot which directory the connection file was in.

We would like to see the connection statement in 'mysql.inc.php'.  You can hide or obscure the login details but the connection statement similar to mine above must be there for your code to work.
Try loading the following into a file by itself in the same directory and load the page in your browser. Then paste any generated content here. Hopefully this will not trigger the 500 server error but if it does, we've narrowed down where to look.
<?php

header('Content-type: text/plain');

// WHEN WE ARE DEBUGGING OUR CODE, WE WANT TO SEE ALL THE ERRORS!
error_reporting(E_ALL);
ini_set('display_errors','on');

// Require the configuration before any PHP code as the configuration controls error reporting:
require ('./includes/config.inc.php');
// The config file also starts the session.

// WHEN WE ARE DEBUGGING OUR CODE, WE WANT TO SEE ALL THE ERRORS!
error_reporting(E_ALL);
ini_set('display_errors','on');

// Require the database connection:
require (MYSQL);

var_dump($connect);

Open in new window

MySql connection should be established...
Certainly agree with that, and the article linked w-a-a-a-y above will show you exactly how to do that.  But maybe it will help to break this code down a little bit.
require (MYSQL);

Open in new window

What we are saying to PHP here is "Go into the constants table in the global namespace, find the definition of the term MYSQL (almost certainly case-sensitive) and use the contents of the term in the require() statement."  Is this a good idea?  Maybe and maybe not.  It will depend on what the MYSQL constant contains, hopefully a correctly qualified path to a PHP script that connects and selects a database, and that also checks for connection and selection errors, and raises those errors at a level above Notice.  The error checking and visualization is important because if your script does not try to detect MySQL connect and select errors, they will occur silently and will remain hidden until some other part of your application fails when it tries to use the connection object!

MySQLi connect, whether procedural or OOP, returns an instance of the MySQLi object.  The require statement obscures the name of this object instance, meaning that we now need to go find the definition of the constant MYSQL, locate the path to the PHP script, dig into the PHP script to see if all the require error checking and visualization is present, etc.  I think it might be easier, at this point in the debugging cycle, to put the connection and selection code into clear text inside the PHP script.

PHP Notice messages are, by default, silent.  That is why I add error_reporting(E_ALL) to my demonstration scripts.  It makes for a clear reminder that you must tell PHP that you want to see all the messages!  PHP has predefined error reporting constants.

See the cautionary note about resources too.

Now what if the require statement were inside a function?  Or if the script that is brought in by require is loaded in a function scope?  In that case, the connection object would only exist inside the function scope and would be an undefined variable outside of the function scope.  Without Notice messages, we would not know that we were relying on an undefined variable (until some other consequence caused a higher level error).

Consider this little script.  It uses MySQL twice, assuming it to be a constant.  But it's not a constant, it's undefined.  When you run this you can see the effect of undefined constants, and to me it is a scary thing -- spooky action at a distance -- if you leave the PHP error_reporting() settings in the default state.
<?php // demo/temp_wchirnside.php
/**
 * https://www.experts-exchange.com/questions/28951725/Data-not-going-into-Database-receiving-a-500-Internal-Server-Error.html
 *
 * Note that error_reporting() is initially set to PHP default values
 */
// error_reporting(E_ALL); <-- TURNED OFF E_ALL


// UNDEFINED CONSTANT: COMPLETELY SILENT, ITS VALUE BECOMES A STRING LITERAL!
$x = MYSQL;
echo PHP_EOL . "x = $x" . PHP_EOL;


// TURN ON A MORE REASONABLE Error_Reporting() SETTING
error_reporting(E_ALL);
$y = MYSQL; // <-- Notice: Use of undefined constant MYSQL - assumed 'MYSQL'

Open in new window

All of this is by way of showing why we cannot immediately debug the situation you're facing.  We have some ideas and paths of inquiry, but there are so many things we cannot see.  Hopefully this note gives you some ideas that may make your code clearer and your debugging easier and more transparent.
Thanks for your recent comments.

I finally received a more sensible answer from my web hosts which is as follows: -

I was able to replicate the issue which you have reported. There is a script issue with the file 'public_html/wcgraphicdesign.ca/DavisMews/includes/config.inc.php' on line 73. The error log is as follows:
PHP Fatal error: Cannot redeclare my_error_handler() (previously declared in /hermes/bosnaweb05a/b717/nf.tiredofbeingrippedoff/public_html/wcgraphicdesign.ca/DavisMews/includes/config.inc.php:41) in /hermes/bosnaweb05a/b717/nf.tiredofbeingrippedoff/public_html/wcgraphicdesign.ca/DavisMews/includes/config.inc.php on line 73

Following is my config.inc.php code:

<?php

//This is the config file for the Davisville Mews Site. 

// ****** SETTINGS **** //

$live = true;

// Errors are emailed here:
$contact_email = 'wchirnside@hotmail.com';

//  SETTINGS ********* //

// CONSTANTS ******** //

// Determine location of files and the URL of the site:
define ('BASE_URI', '/home/users/web/b717/nf.tiredofbeingrippedoff/public_html/wcgraphicdesign.ca/TBR/');
define ('BASE_URL', 'www.wcgraphicdesign.ca/');
define ('MYSQL', BASE_URI . 'mysql.inc.php');

// ************ CONSTANTS *********** //

// Function for handling errors.
// Takes five arguments: error number, error message (string), name of the file where the error occurred (string) 
// line number where the error occurred, and the variables that existed at the time (array).
// Returns true.
function my_error_handler ($e_number, $e_message, $e_file, $e_line, $e_vars) {

	// Need these two vars:
	global $live, $contact_email;
	
	// Build the error message:
	$message = "An error occurred in script '$e_file' on line $e_line:\n$e_message\n";
	
	// Add the backtrace:
	$message .= "<pre>" .print_r(debug_backtrace(), 1) . "</pre>\n";
	
	// Or just append $e_vars to the message:
	//	$message .= "<pre>" . print_r ($e_vars, 1) . "</pre>\n";

	if (!$live) { // Show the error in the browser.
		
		echo '<div class="error">' . nl2br($message) . '</div>';

	} else { // Development (print the error).

		// Send the error in an email:
		error_log ($message, 1, $contact_email, 'From:admin@tiredofbeingrippedoff.ca');
		
		// Only print an error message in the browser, if the error isn't a notice:
		if ($e_number != E_NOTICE) {
			echo '<div class="error">A system error occurred. We apologize for the inconvenience.</div>';
		}

	} // End of $live IF-ELSE.
	
	return true; // So that PHP doesn't try to handle the error, too.

} // End of my_error_handler() definition.

// Use my error handler:
set_error_handler ('my_error_handler');

Open in new window


Following is the mysql.inc.php code:

<?php

// This file contains the database access information for the Davisville Mews site. 
// This file establishes a connection to mysqli and selects the database.
// This file defines a function for making data safe to use in queries.
// This file defines a function for hashing passwords.

//set database connection variables 
$hostname='xxxxx'; 
$username='xxxx'; 
$password='xxxx'; 
$database='xxxx'; 
//establish database connection 
$connect = mysqli_connect($hostname,$username,$password); 

/*
 * Use this instead of $connect_error if you need to ensure
 * compatibility with PHP versions prior to 5.2.9 and 5.3.0.
 */
if (mysqli_connect_error()) {
    die('Connect Error (' . mysqli_connect_errno() . ') '
            . mysqli_connect_error());
}

//display error if connection fails 
if ($connect==FALSE) { 
print 'Unable to connect to database: '.mysql_error(); 
exit; 
} 

// Set the character set:
mysqli_set_charset($connect = mysqli_connect($hostname,$username,$password,$database), 'utf8');

// Function for escaping and trimming form data.
// Takes one argument: the data to be treated (string).
// Returns the treated data (string).
function escape_data ($data) { 

	global $connect; // Database connection.
	
	// Strip the slashes if Magic Quotes is on:
	if (get_magic_quotes_gpc()) $data = stripslashes($data);
	
	// Apply trim() and mysqli_real_escape_string():
	return mysqli_real_escape_string ($connect, trim ($data));
	
} // End of the escape_data() function.

Open in new window

You have two copies of "mysqli_connect()" in 'mysql.inc.php'.  The first one is missing the $database parameter.
You've obviously removed a lot of lines from your config.inc.php file. Can you post just lines 41 and 73? According to the error, both of these lines should be declaring the my_error_handler function.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
IMHO if you have to use function_exists(), you're starting work with too many uncertainties.  And this question has wandered away from its original focus.  Highly recommend you consider Gigs, where you can get hands-on help from an Expert.  It will likely be the fastest path to a working application!

Best of luck with the project, ~Ray
Okay, I am still trying to sort things out.

Ray - understanding what you are saying about Gigs, but feel that source is best for brand new projects. I have paid a fee to Experts-Exchange and I felt that this code that is not working should be just a line or two that needs adjusting.

Kim - working on your suggestions.

Dave - I don't know exactly how you are seeing two copies of "mysqli_connect()" in 'mysql.inc.php'. Then later mention missing database information. If you are talking about the xxx's, I have put them there just in this site so that anyone would not have my login information. I have noticed in the past few years that if one google's my name, pages that have my questions for Expert-Exchange will come up for anyone to see.

Thanks.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Very difficult to figure out the points situation in this one as I feel you all contributed and led me to certain paths that may have come to a conclusion.