jdauthre
-
Posts
6 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by jdauthre
-
-
I have a web site that lists students in a database on a server, and can add a students details. It then relists the students pulling the new list off the database. All worked well until I transferred everything to a new webhost. It still works to the point of relisting when I get the old list not the updated one. Checking the database(mysql) directly it has actually put the new student in. and if I log out of the web site and back in the new student's details are there. how do get this to work? relevent code is below:
html/javascript:
function listStudents(password){
var oReq = new XMLHttpRequest();
oReq.onload = function() {
// This is where you handle what to do with the response.
// The actual data is found on this.responseText
allTheStudents = JSON.parse(this.responseText);
if(allTheStudents){
select = document.getElementById("audioFile");
for(index in allTheStudents) {
select.options[select.options.length] = new Option(allTheStudents[index], index);
}}else{
alert("There are no students");
}document.getElementById("fileLabel").innerHTML= "Select Student(s) from the list:";
document.getElementById("fileLabel").style = "display:show;font-family: Calibri; font-size: 16px; font-weight: bold;color:#E3C208;";
};
oReq.open("get", "listStudents.php?x=" + username, true);
oReq.send();
oReq.close;
}function addStudent(){
document.getElementById("familyNameId").innerHTML="";
document.getElementById("qInput").style="display:none";familyName = document.getElementById("familyNameId").value;
givenName = document.getElementById("givenNameId").value;
email = document.getElementById("emailId").value;
studentdetails = familyName+","+ givenName +","+email+","+ username ;
listNewStudent = familyName+" "+ givenName +" "+email;
addaStudent = JSON.stringify(studentdetails);
var oReq = new XMLHttpRequest();
oReq.onload = function() {
};
oReq.open("get", "saddStudent.php?x=" + addaStudent, true);
oReq.send();
oReq.close;
//alert("username "+ username);
alert("about to list");
select = document.getElementById("audioFile");
//select.options = new Option(listNewStudent);
select.options[select.options.length] = new Option(listNewStudent);listStudents();
}php:
<?php$studentdetails = json_decode($_GET["x"],false);
//$var = file_get_contents('php://input');
//$studentArray = json_decode($var);//$length = count($studentArray);
$servername = xxxxx
$user = xxxxxx
$pass=xxxxx
$db ='xxxxxx// Create connection
$con = new mysqli($servername, $user, $pass, $db) or die("Unable to connect to Database: " . $db);if ($con->connect_error) {
die("Connection failed: " . $con->connect_error);
}
$studentElements = str_getcsv($studentdetails,",","");
$fname=$studentElements[0];
$gname=$studentElements[1];
$ename=$studentElements[2];
$sqla = "INSERT INTO students (familyName,givenName,email,)
VALUES ('$fname','$gname','$ename);";
if (mysqli_multi_query($con,$sqla) === TRUE) {
// echo "New records created successfully";
} else {}
$con->close();
?>Thanks in advance
-
I am quite new to java, and try as I might, I can't find any examples to help me. I am running ffmpeg as a process and parsing the stderr to get various bits of data - all of which is working fine, but I want to send a "q\n" command to ffmpeg's input from a gui menu item to gracefully quit it whilst it is running when necessary. So all I want to do is send a string programmatically to ffmpeg, the equivalent of sending q return from terminal. A simplified segment of the source code is attached Thanks in advance
-
I am pretty new to javascript and node.js. I am wanting to display some text using
document.getElementById('txt').innerHTML= "some text"
followed by a node module :
var spawn = require('child_process').spawnSync;
child = spawn('ffmpeg',['-y -i ',some_file , result_file ], { shell: true }); (which takes some time)and then
document.getElementById('txt').innerHTML= "some other text";
However it only disp[ays the second lot of text after the external program has finished. I had assumed that as I am using the synchronous version of spawn that the first line would get displayed first, how can I do this?
Thanks
-
Thanks, I will have to move on to plan B
-
I need to get the raw window handle for a html / javascript window (hwnd in windows 10), using javascript / node.js / nwjs but can't find a way. does anybody have any ideas? I want to embed mpv or mplayer in a window using the -wid option which requires the window handle as an integer. Or does anyone have any ideas how to do this as an alternative?
Thanks
child_process and async/await
in JavaScript
Posted
I want to feed some input files stored in an array to a ffmpeg childprocess , but it needs to be asynchronous because I want to capture std.err live. However I need to feed one input at a time waiting for the previous one to finish. I think I need to use promises or async await but I cannot work out how. my code (simplified) is:
Thanks in advance