SQL Syntax (Errors Using MySQL 5.0 Language PHP)
The Sql fail to submit. This is what I get when I test the page "SELECT * FROM employeelookup 0" I made this change to the code so that I can see the information
===========modified code===========
$query_Members = sprintf("SELECT * FROM employeelookup %s", GetSQLValueString($WhereParam_Members, "int"));
echo $query_Members;
exit;
$Members = mysql_query($query_Members, $Recipes) or die(mysql_error());
$row_Members = mysql_fetch_assoc($Members);
$totalRows_Members = mysql_num_rows($Members);
?>
=============end modified code==============
======================entire code=================
<?php require_once('../../Connections/Recipes.php'); ?>
<?php
mysql_select_db($database_Recipes, $Recipes);
$query_EmployeeLookup = "INSERT INTO employeelookup SELECT employees_1.EmployeeID, jobs.JobID, jobs.JobTitle, employees_1.EmployeeFirst, employees_1.EmployeeLast, departments.DepartmentName, CONCAT(employees.EmployeeFirst,' ',employees.EmployeeLast) AS ManagerName, employees_1.EmployeeEmail, employees_1.EmployeePhone, employees_1.EmployeeMobil, employees_1.EmployeeCube FROM employees, employees employees_1, jobs, jobs jobs_1, departments WHERE ((((jobs.JobTypeID = jobs_1.JobID) AND (jobs.JobDepartment = departments.DepartmentID)) AND (employees.EmployeeJob = jobs_1.JobID)) AND (employees_1.EmployeeJob = jobs.JobID))";
mysql_query($query_EmployeeLookup,$Recipes);
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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;
}
}
$WhereParam_Members = 'Where MemberID <> 0';
if (isset($WhereParam)) {
$WhereParam_Members = $WhereParam;
}
mysql_select_db($database_Recipes, $Recipes);
$query_Members = sprintf("SELECT * FROM employeelookup %s", GetSQLValueString($WhereParam_Members, "int"));
echo $query_Members;
exit;
$Members = mysql_query($query_Members, $Recipes) or die(mysql_error());
$row_Members = mysql_fetch_assoc($Members);
$totalRows_Members = mysql_num_rows($Members);
?><?php
$query_EmployeeLookup = "DELETE FROM employeelookup";
mysql_query($query_EmployeeLookup,$Recipes);
?>
======================end====================
Any help would be greatly helpful