so I have 2 pages that are creating an html table using php here:
$Trainee_HTML = "<div id=\"container\"><table class=\"display\" id=master_table>";
$Trainee_HTML .= "<thead>";
$Trainee_HTML .= "<tr>";
$Trainee_HTML .= "<th> Enabled </th>";
$Trainee_HTML .= "<th> Name </th>";
$Trainee_HTML .= "<th> Email </th>";
$Trainee_HTML .= "<th> EID </th>";
$Trainee_HTML .= "<th> Spriden </th>";
$Trainee_HTML .= "<th> Active </th>";
$Trainee_HTML .= "<th> Source </th>";
$Trainee_HTML .= "<th> Date Inserted </th>";
$Trainee_HTML .= "<th> Next Contact </th>";
$Trainee_HTML .= "<th> Completion Status </th>";
$Trainee_HTML .= "<th> Completion Date </th>";
$Trainee_HTML .= "<th> Curriculum </th>";
$Trainee_HTML .= "<th> Group </th>";
$Trainee_HTML .= "<th> Stage </th>";
$Trainee_HTML .= "<th> Comments </th>";
$Trainee_HTML .= "<th> Comment Date </th>";
$Trainee_HTML .= "</tr>";
$Trainee_HTML .= "</thead>";
$Trainee_HTML .= "<tbody col = ".$num.">";
.....filling data here
$string = "COM";
$text = 'text';
$post = 'get';
$testphp="update_user.php";
$sub = "submit";
$user = "user";
$hidden = "hidden";
$name1 = "submit1";
$ename = "email";
$enab = "enabled";
$Trainee_HTML .= "<tr>";
$Trainee_HTML .= "<form method = ".$post." action = ".$testphp."><td>". $id ."<br>".
$edit_link. "</td>";
$Trainee_HTML .= "<td><center>". $enabled_img ."</center></td>";
$Trainee_HTML .= "<td>". $name. "</td>";
$Trainee_HTML .= "<td>". $email. "</td>";
$Trainee_HTML .= "<td>". $eid. "</td>";
$Trainee_HTML .= "<td>". $spriden. "</td>";
$Trainee_HTML .= "<td>". $active. "</td>";
$Trainee_HTML .= "<td>". $source. "</td>";
$Trainee_HTML .= "<td>". $date_inserted. "</td>";
$Trainee_HTML .= "<td>". $next_contact. "</td>";
$Trainee_HTML .= "<td>". $compstatus. "</td>";
$Trainee_HTML .= "<td>". $compdate. "</td>";
$Trainee_HTML .= "<td>". $curriculum. "</td>";
$Trainee_HTML .= "<td>". $group. "</td>";
$Trainee_HTML .= "<td>". $stage. "</td>";
$Trainee_HTML .= "<td><input type=".$text." name=".$string." ><br><input type=".$sub." name =".$name1."></td>";
$Trainee_HTML .= "<td>". $date. "</td>";//added as above
$Trainee_HTML .= "<input type=".$hidden." name = ".$enab." value = ".$enabled.">";
$Trainee_HTML .= "<input type=".$hidden." name = ".$ename." value = ".$email."> </form>";
$Trainee_HTML .= "</tr>";
}
// close table
$Trainee_HTML .= "</tbody>";
$Trainee_HTML .= "</table> </div><br /><br />";
And here is where i create the table using jquery.
<script type="text/javascript" language="javascript" src="./media/js/jquery.js"> </script>
<script type="text/javascript" language="javascript" src="./media/js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8" src="./media/js/ZeroClipboard.js"></script>
<script type="text/javascript" charset="utf-8" src="./media/js/TableTools.js"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready( function () {
$('#master_table').dataTable( {
"aaSorting": [[ 2, "asc" ]],
"bPaginate": false,
"bLengthChange": false,
"bFilter": true,
"bSort": true,
"bInfo": false,
"bJQueryUI": true,
"sDom": '<"H"Tfr>t<"F"ip>',
"oTableTools": {
"aButtons": [
"copy", "csv", "xls"
]
}
} );
} );
</script>
And I know the error is originating from this line
"oTableTools": {
"aButtons": [
"copy", "csv", "xls"
]
But I am not very good with jquery (i know practically nothing about it) I've checked the other answers on the site but none of those answers have helped me with my solution so that's the reason why I asked it differently. I have a page using the same exact code on a previous page but that page uses my entire database (around 400 entries) and this page is more of an 'edit' page so it's only one entry.Any help would be appreciated as this is for work and I have no idea what I'm doing.
EDIT
HERE is my database grabbing. The database loads just fine without any issue session_start(); $conn = mysql_connect( $db_server, $db_username, $db_password ) or die ('Error connecting to mysql'); mysql_select_db($db_name);
$date = date('Y-m-d');//the date from the system, created as a date stamp for the user.
$trainee_id = (!isset($_GET['id']))? "-1" : $_GET['id'];
// Select Trainees in main table
//
$Trainee_query = "Select t.id, t.enabled, t.name, t.email, t.eid, t.spriden, t.active, t.source, t.date_trainee_inserted, ".
"t.completion_status, t.completion_date, t.curriculum, ".
"t.group_name, t.stage, t.next_contact_email ".
"From ". $Main_Trainees_Tbl. " t ".
"Where t.id = ". $trainee_id. " ";
$result = mysql_query($Trainee_query) or die(mysql_error());