Mysql Explain problems
Posted: Mon Dec 15, 2014 8:18 am
Hi, I am trying to get the MySql EXPLAIN keyword to work. The code below is the top part of a PHP script with the MySql command. It works fine until I put in the EXPLAIN keyword (does not matter if the EXTENDED is in there). I am using PHP 5.5.11 on Xampp. When I put the EXPLAIN in I get "Undefined index: fldMM_AnnounceDateTime" so the MySql command is not working. However the mysqli_error($con) command is not adding anything to the message being fed into the error handler defined at the top. When I get this thing to work, am I suppose to see the EXPLAIN output in the PHP log? In the PHP ini file I have all output redirected to the error handler (well standard output is shut off). I hope I don't need to turn off the error handler which sends an email to me. The error handler is such an improvement over what I was doing before which was nothing short of awful - LOL.
Thanks,
John
Thanks,
John
Code: Select all
<?php
Include 'Mod_MyErrorHandler.php';
Include 'Mod_session_start.php';
if (!isset($_SESSION['login'])) {
trigger_error("Login SESSION is not set",E_USER_ERROR);
die();
}
Include 'Mod_Connect_DB.php';
$fldMM_Key = $_SESSION['fldMM_Key'];
$fldMM_MemberType_LU = $_SESSION['fldMM_MemberType_LU'];
$sqlMM = "
EXPLAIN EXTENDED SELECT
tblMemberMaster.fldMM_AnnounceDateTime
FROM
tblMemberMaster
WHERE
tblMemberMaster.fldMM_Key = '$fldMM_Key';
";
$resultMM = @mysqli_query($con,$sqlMM);
if (!$resultMM) {
$result = "Error retrieving member master (data) 1. " . mysqli_error($con);
trigger_error($resultMM,E_USER_ERROR);
}
$rowMM = @mysqli_fetch_array($resultMM);
if (!$rowMM) {
$result = "Error retrieving member master (data) 2. " . mysqli_error($con);
trigger_error($resultMM,E_USER_ERROR);
}
$fldMM_AnnounceDateTime = $rowMM['fldMM_AnnounceDateTime'];