Dear All,
I finally managed to get my form completed and working on my localhost machine and shipped the form over to the live server where it all fell apart on me :-(
I ran the form, entered the required data and hit the submit button. After a few seconds this came back to me...
I am assuming it it referring to line 7 in my On Submit Before code which looks like this
I don't know much about this stuff but I am learning (fast) so I don't really know where to begin looking or what I should be looking at, especially as the form worked perfectly on my test server.
TIA & Regards
Chris
I finally managed to get my form completed and working on my localhost machine and shipped the form over to the live server where it all fell apart on me :-(
I ran the form, entered the required data and hit the submit button. After a few seconds this came back to me...
Fatal error: Class 'mysqli' not found in /home/dwyert/public_html/components/com_chronocontact/libraries/customcode.php(64) : eval()'d code on line 7
I am assuming it it referring to line 7 in my On Submit Before code which looks like this
<?php
// Check if a file has been uploaded
if(isset($_FILES['filedata'])) {
// Make sure the file was sent without errors
if($_FILES['filedata']['error'] == 0) {
// Connect to the database
$dbLink = new mysqli('localhost', 'user', 'pwd', 'db');
if(mysqli_connect_errno()) {
die("MySQL connection failed: ". mysqli_connect_error());
}
// Gather all required data
$name = $dbLink->real_escape_string($_FILES['filedata']['name']);
$mime = $dbLink->real_escape_string($_FILES['filedata']['type']);
$data = $dbLink->real_escape_string(file_get_contents($_FILES['filedata']['tmp_name']));
$size = intval($_FILES['filedata']['size']);
$custname = $_POST['custname'];
$delnoteno = $_POST['delnoteno'];
$delrefno = $_POST['delrefno'];
$deldate = $_POST['deldate'];
// Create the SQL query
$query = "
INSERT INTO `table_name` (
`filename`, `filemimetype`, `filesize`, `filedata`, `filecreated`, `custname`, `delnoteno`, `delrefno`,`deldate`
)
VALUES (
'{$name}', '{$mime}', {$size}, '{$data}', NOW(), '{$custname}', '{$delnoteno}', '{$delrefno}', '{$deldate}'
)";
// Execute the query
$result = $dbLink->query($query);
// Check if it was successfull
if($result) {
echo '';
}
else {
echo 'Error! Failed to insert the file'
. "<pre>{$dbLink->error}</pre>";
}
}
else {
echo 'An error accured while the file was being uploaded. '
. 'Error code: '. intval($_FILES['filedata']['error']);
}
// Close the mysql connection
$dbLink->close();
}
else {
echo 'Error! A file was not sent!';
}
?>
I don't know much about this stuff but I am learning (fast) so I don't really know where to begin looking or what I should be looking at, especially as the form worked perfectly on my test server.
TIA & Regards
Chris