hi ,
these are the error that i encountered when using button to run the process as mention in the scriptcase tutorial.
here is the link for that tutorial
http://www.scriptcase.net/samples/tu…rid/grid46.php
problem are
-
the loop break even there are elements inside the array
-
the hard coded shell script display proper filename rather than taken from database.
-
inside the file generated using shell script, the content is missing.
i attach the picture for proper understanding the situation.
below here is the code that ive written on
$total = count([total_chked]);
for($x=0;$x<$total;$x++){
//first echo
echo "scriptcase handsome <br/>";
//job traker start
// Check for record
$check_sql = 'SELECT opType, opCommand, opName'
. ' FROM operations'
. " WHERE opId = '" . [total_chked][$x] . "'";
//initialize the field
sc_lookup(rs, $check_sql);
//execute command
$opType = {rs[0][0]};
$opCommand = {rs[0][1]};
$job_name = {rs[0][2]};
//this will execute mssql or php database script
if($opType == "SC_SCRIPT" || $opType == "MSSQL_SCRIPT" ){
sc_exec_sql($opCommand);
}
//this will execute cmd shell script
if($opType == "SHELL_CMD"){
//echo "execute shell script <br>";
//harcoded shell script command
exec('scriptcase_test_bat_file >> C:\\data\ estfile.txt');
//taken from database command
exec("'".$opCommand."'");
//sc_exit(sel);
}
$statusIdComplete = 5001;
$msg = "[usr_login] running " . $job_name;
// SQL statement parameters
$insert_table = 'Jobs'; // Table name
$insert_fields = array( // Field list, add as many as needed
'job_id' => "'".rand(1, 999)."'",
'job_name' => "'".$job_name."'",
'job_desc' => "'". $msg ."'",
'job_start' => "'". date('y-m-d H:i:s') ."'",
'job_end' => "'". new DateTime ('0000-00-00 00:00:00') ."'",
'lab_status' => "'". $statusIdComplete ."'",
'Label2' => "'". $statusIdComplete ."'",
'Label3' => "'". $statusIdComplete ."'",
'Label4' => "'". $statusIdComplete ."'",
'Label5' => "'". $statusIdComplete ."'",
);
// Insert record
$insert_sql = 'INSERT INTO ' . $insert_table
. ' (' . implode(', ', array_keys($insert_fields)) . ')'
. ' VALUES (' . implode(', ', array_values($insert_fields)) . ')';
sc_exec_sql($insert_sql);
}
im uploading my attachment so that u guys get a clear view what im trying to do.
thank you.
[ATTACH=JSON]{“data-align”:“none”,“data-size”:“full”,“title”:“overall overview process3.PNG”,“data-attachmentid”:84787}[/ATTACH]
[ATTACH=JSON]{“data-align”:“none”,“data-size”:“full”,“title”:“overall overview process2.PNG”,“data-attachmentid”:84786}[/ATTACH]
[ATTACH=JSON]{“data-align”:“none”,“data-size”:“full”,“title”:“overall overview process1.PNG”,“data-attachmentid”:84785}[/ATTACH]