ETSoft
-
Posts
5 -
Joined
-
Last visited
Posts posted by ETSoft
-
-
Hi,
the downlad script is working but when i try to pass an argument it is ignored.
$firma= $_GET['argument1']; function Database_Connect() { $Host="localhost"; $Username=""; $Password=""; $dbName=""; $Error_Message=""; @$Connector=new mysqli($Host,$Username,$Password,$dbName); if(mysqli_connect_errno()) { $Error_Message="<br/><br/><div class='alert alert-danger'><i class='icon-remove-circle'></i>Sorry System '".$dbName."' Database Connection Failed to Initiate on this: ".$Host." Server, Username: ".$Username.".Please try again Later</div>"; die($Error_Message); exit(); } else { return $Connector; } } function MySql_Excel_Exporter() { $Excel_File = $firma . "-Export_Planning_".date("Y-m-d").".xls"; $Separator="\t"; /* Header info settings */ header("Content-Type: application/xls"); header("Content-Disposition: attachment; filename=".$Excel_File.""); header("Pragma: no-cache"); header("Expires: 0"); $MySqli=Database_Connect(); $Sql="SELECT * from table Where Responsibility ='". $firma ."'order by Activityid"; $Query=$MySqli->prepare($Sql); $Query->execute(); $Query->bind_result($....); print(trim("Activiteit"."".$Separator.""."O"."".$Separator.""."P"."".$Separator.""."S"."".$Separator.""."K"."".$Separator.""."LA")); print "\n"; while($Fetch=$Query->fetch()) { $Schema_Insert = ""; /* HERE I ACCEPT IF THERE IS A BETTER WAY OF JUST GETTING THE VALUES IN A FORM OF DYNAMIC WAY OF REFFERING COLUMS AS IN THE ORIGINAL CODE JUST USED LOOP TO GET COLUMNS, BUT AS I FDIDNT KNOW HOW TO DO THAT AND SO I USED WHAT I KNOW THE bind_result() AND JUST ASSIGN THEM TO $Schema_Insert FOR EXCEL FORMATING */ $Schema_Insert =$A."".$Separator."".$Ac."".$Separator."".$p."".$Separator."".$s."".$Separator."".$k."".$Separator."".$la."".$Separator.""; $Schema_Insert = str_replace($Separator."$", "", $Schema_Insert); $Schema_Insert = preg_replace("/\r\n|\n\r|\n|\r/", " ", $Schema_Insert); $Schema_Insert .= "\t"; print(trim($Schema_Insert)); print "\n"; } $Query->close(); } MySql_Excel_Exporter(); ?>
(sensitive information is removed).
Without the $firma variable it is working.
Could someone help me on this one?
Thanks in advance
Erwin
-
This did the trick :
<?php header('Content-Type: text/html; charset=utf-8'); if(isset($_POST['submit'])){ $DBCon = new mysqli("localhost", "tacssuite_yara", "D29XkTh4", "tacssuite_yara"); mysqli_set_charset($DBCon, "utf8mb4"); $result = $DBCon->query($_POST['query_input']); echo "<span style='color: green;'>Hochladen in Datenbank bereit!! </span>"; } ?>
The 'mysqli_set_charset($DBcon , "utf8mb4")' cammand helped me out.
-
Hi thank you
when i insert the data with phpMyAdmin, it shows the correct characters, so i think the database is ready to accept this.
Only when i 'upload' the data with the mentioned html page and php function it does not do the job.
I've now tried in with the following between het <head> tags seperatly but without the correct result:
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<meta charset="utf-8"/>
-
Hi ,
I'm trying to upload data to a mysql database through a script but although the charset is set right in the database the uploaded data is in the wrong format, it needs to be in German (if i do it manually the data is correct) :
<?php if(isset($_POST['submit'])){ $DBCon = new mysqli("localhost", "", "", ""); $result = $DBCon->query($_POST['query_input']); echo "<span style='color: green;'>Hochladen in Datenbank bereit!! </span>"; } ?> <!DOCTYPE html> <html lang="en-US"> <head> <title> Daten in die Cloud-Datenbank hochladen</title> </head> <body> <table style=width:100%> <tr> <img src="TACS.png"> </tr> <tr> <h2> Daten in die Cloud-Datenbank hochladen</h2> <form action="" method="post"> <div> <label style="vertical-align: top;">Füge den Befehl hier ein : </label> <textarea name="query_input" rows="30" cols="100" required=""></textarea> </div> <BR> <div> <input type="submit" name="submit" value="Senden"> </div> </form> </tr> </body> </html>
Could someoen assist me?
Thanks in advance
Erwin
passing an argument in a php script to download info into excel not working
in PHP Coding Help
Posted
Yes this working, thank you