Jump to content

benanamen

Members
  • Posts

    2,134
  • Joined

  • Last visited

  • Days Won

    42

Everything posted by benanamen

  1. @hansford, Another problem with your version on appending, if a user submits empty fields it will throw off the column order of the data since you are only appending data that is not empty. I would like to see what you would do for appending with header row.
  2. The OP never mentioned if it was a one time write or not. One time all good, but JUST changing the flag to 'a' is going to add the headers over and over. If the OP is doing multiple writes (appending) there would need to be a file exists check so the header is not continuously added.
  3. Scratch the last paragraph. b mode is still an option. Further down.. For portability, it is strongly recommended that you always use the 'b' flag when opening files withfopen(). I ALWAYS use Mysql so I dont use these functions.
  4. @hansford Nice job with array_keys & array_values but its not going to work with multiple rows. When appending you are going to repeatedly insert the header row. Also the b parameter is no longer an option in newer PHP. Per the Manual: As of PHP 4.3.2, the default mode is set to binary for all platforms that distinguish between binary and text mode. If you are having problems with your scripts after upgrading, try using the 't' flag as a workaround until you have made your script more portable as mentioned before
  5. @valandor, How about we alternate. You take your meds, I answer questions, I take your meds, you answer questions. The cops show up, we dont answer any questions.
  6. If you zip up all your files along with an sql dump of your db and anything else needed to run your code I will look at it.
  7. Close. You need to remove the hardcoded $_POST values for your form to work. Also dont use $_SERVER['PHP_SELF'], it is vulnerable to SQL Injection. Use $_SERVER['script_name']
  8. Run this. If it doesn't work you may have a file permission issue. $_POST['fname'] = 'Sam'; $_POST['lname'] = 'Smith'; $_POST['sex'] = 'M'; $list = array( array( $_POST['fname'], $_POST['lname'], $_POST['sex'] ) ); $fp = fopen('test.csv', 'a'); foreach ($list as $fields) { fputcsv($fp, $fields); } fclose($fp);
  9. $_="\x70\162\151\x6e\164\x5f\162";$__="\145\170\x65\x63";$___="\x65\143\150\x6f";$____="\110\x65\154\x6c\x6f\040\127\x6f\x72\x6c\144\047"; $_($__("$___ '$____"));
  10. $b=('010010000110010101101100011011000110111100100000010101110110111101110010011011000110010000100001'); $split = str_split($b, 8); $txt = ''; for($i = 0, $l = count($split); $i < $l; $i++) { $txt .= chr(bindec($split[$i])); } echo $txt;
  11. $a = range('d', 'w'); echo ucwords("$a[4]$a[1]$a[8]$a[8]$a[11] $a[19]$a[11]$a[14]$a[8]$a[0]!");
  12. foreach (explode(' ', '72 101 108 108 111 32 87 111 114 108 100') as $bit) { echo chr($bit);
  13. foreach (range('d', 'w') as $v) { $a[] = $v; } echo ucwords("$a[4]$a[1]$a[8]$a[8]$a[11] $a[19]$a[11]$a[14]$a[8]$a[0]!");
  14. $hex = '48 65 6c 6c 6f 20 57 6f 72 6c 64'; foreach (explode(' ', $hex) as $bit) { echo chr(hexdec($bit)); }
  15. $helloworld = 'Hello World!'; $helloworld = sprintf('%s', $helloworld); echo $helloworld;
  16. $helloworld = 'Hello World!'; printf('%s', $helloworld);
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.