code_junkie

MySQL or PHP is appending a ? whenever the ? is used

Nov 13th, 2011
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. // Create file and exit;
  2. $filename = $file."_".date("Y-m-d_H-i",time());
  3. header("Content-type: application/vnd.ms-excel");
  4. header("Content-disposition: csv" . date("Y-m-d") . ".csv");
  5. header( "Content-disposition: filename=".$filename.".csv");
  6. echo $csv_output;
  7.  
  8. // Create file and exit;
  9. $filename = $file."_".date("Y-m-d_H-i",time());
  10. header("Content-type: text/csv; charset=ISO-8859-1");
  11. header("Content-disposition: csv" . date("Y-m-d") . ".csv");
  12. header("Content-disposition: filename=".$filename.".csv");
  13.  
  14. echo iconv('UTF-8', 'ISO-8859-1', $csv_output);
  15.  
  16. mysql> SHOW COLUMNS FROM fraud_report;
  17. +--------------+--------------+------+-----+---------+----------------+
  18. | Field | Type | Null | Key | Default | Extra |
  19. +--------------+--------------+------+-----+---------+----------------+
  20. | id | mediumint(9) | | PRI | NULL | auto_increment |
  21. | crm_number | varchar(32) | YES | | NULL | |
  22. | datacash_ref | varchar(32) | YES | | NULL | |
  23. | amount | varchar(32) | YES | | NULL | |
  24. | sales_date | varchar(32) | YES | | NULL | |
  25. | domain | varchar(32) | YES | | NULL | |
  26. | date_added | datetime | YES | | NULL | |
  27. | agent_added | varchar(32) | YES | | NULL | |
  28. +--------------+--------------+------+-----+---------+----------------+
  29. 8 rows in set (0.03 sec)
  30.  
  31. function processFraudForm($crm_number, $datacash_ref, $amount, $sales_date, $domain, $agent_added) {
  32.  
  33. // Insert Data to DB
  34. $sql = "INSERT INTO fraud_report (id, crm_number, datacash_ref, amount, sales_date, domain, date_added, agent_added) VALUES (NULL, '$crm_number', '$datacash_ref', '$amount', '$sales_date', '$domain', NOW(), '$agent_added')";
  35. $result = mysql_query($sql) or die (mysql_error());
  36.  
  37. if ($result) {
  38. $outcome = "<div id="success">Emails sent and database updated.</div>";
  39. } else {
  40. $outcome = "<div id="error">Something went wrong!</div>";
  41. }
  42.  
  43. return $outcome;
  44. }
  45.  
  46. +----+------------+--------------+---------+------------+--------------------+---------------------+------------------+
  47. | id | crm_number | datacash_ref | amount | sales_date | domain | date_added | agent_added |
  48. +----+------------+--------------+---------+------------+--------------------+---------------------+------------------+
  49. | 13 | 100xxxxxxx | 10000000 | £10.93 | 18/12/08 | blargh.com | 2008-12-22 10:53:53 | agent.name |
  50.  
  51. print iconv('UTF-8', 'ASCII//TRANSLIT', "Mystring â"); //"Mystring "
Add Comment
Please, Sign In to add comment