[PHP-DB] Unsubscribe me please

2012-09-19 Thread Graham H.
Hi,

I tried unsubscribing from the list, but I was unsuccessful, I believe
because when I subscribed I cleverly added +php to the end of my email
address (for Gmail filtering).

Could I be removed please? Thanks.

-- 
Graham Holtslander
Computer Systems Technologist
www.graham.holtslander.com
mene...@gmail.com


Re: [PHP-DB] Another PDO ?

2012-09-10 Thread Graham H.
I think it's so that you could write functions as generically as possible.
So you don't have to pass in the number of columns or hard code in values
for number of columns, you can dynamically check the column count for each
result set that gets passed in. That's my guess.

On Mon, Sep 10, 2012 at 8:51 AM, Jim Giner jim.gi...@albanyhandball.comwrote:

 On 9/10/2012 10:49 AM, Bastien Koert wrote:

 On Mon, Sep 10, 2012 at 9:48 AM, Jim Giner jim.gi...@albanyhandball.com
 wrote:

 Reading up on the pdostatement class.  Wondering what the intent of the
 columnCount function is.  I mean, aren't the number of columns in a
 result
 known when you write the query?  Granted, you might have some very
 complex
 query that you may not know the number, but for most queries you will
 know
 the columns you are expecting.  So - what am I not seeing?

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 It might be for those cases where you run a select * from ...

  But - again - one already knows how many fields are in that table when
 one writes the query...


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Graham Holtslander
Computer Systems Technologist
www.graham.holtslander.com
mene...@gmail.com


Re: [PHP-DB] convert special characters.

2012-08-09 Thread Graham H.
Not sure if this will work any better, but have you tried using
htmlspecialchars instead of htmlentities?
http://www.php.net/manual/en/function.htmlspecialchars.php

You should also use mysql*i*_real_escape_string instead of the older (and
deprecated) mysql_real_escape_string. When you use the mysqli you'll need
to pass in a link to your database as the first parameter, with the string
to be escaped as the second. This will also require you to use mysqli
objects I'm pretty sure (which are better to be using in the first place).
See more about it here:
http://ca3.php.net/manual/en/mysqli.real-escape-string.php

Better than nothing? Sorry!

On Thu, Aug 9, 2012 at 3:19 PM, Karl DeSaulniers k...@designdrumm.comwrote:


 On Aug 9, 2012, at 5:41 AM, Karl DeSaulniers wrote:


 On Aug 9, 2012, at 5:37 AM, Karl DeSaulniers wrote:

  Help!

 How do I get special characters to convert correctly when inserting and
 reading from my database.
 For example.

 é = eacute;
 ë = euml;

 I keep getting

 ë and é

 using htmlentities, htmlspecialchars, etc...

 Any pointers? Please!
 Going bald over here.

 here is my funcitons

 function stringToMysqlFormat($original_**input) {
  //for inserting the data with special characters INTO mysql
  $html_encoded = htmlentities(mysql_real_**
 escape_string($original_input)**);
  return $html_encoded;
 }
 function mysqlToHTMLFormat($encoded) {
  //for displaying the data FROM mysql
  $html_decoded = html_entity_decode(**
 stripslashes($encoded));
  return $html_decoded;
 }

 TIA,

 Karl DeSaulniers
 Design Drumm
 http://designdrumm.com



 using UTF-8


 Karl DeSaulniers
 Design Drumm
 http://designdrumm.com


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



 No one?
 Not even a link I can go look this up myself with?

 I have successfuly converted before, but this time the company
 is in the netherlands and their special characters are doing this.
 Also, I have the database set to UTF-8, but when I check the charset:

 $charset = mysql_client_encoding($con);

 it returns latin1?

 Can someone tell me what I am doing wrong here?
 Not looking for someone to do it for me.
 Just some help figuring out which way to look.

 Why is htmlentities() converting wrong?

 Hope someone out there can help.


 TIA,

 Karl DeSaulniers
 Design Drumm
 http://designdrumm.com


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Graham Holtslander
Computer Systems Technologist
www.graham.holtslander.com
mene...@gmail.com


Re: [PHP-DB] Re: Stuck trying to upload and grab file name

2012-07-24 Thread Graham H.
Does the problem have anything to do with this:


 [tmp_name]= string(14) /tmp/phpcLtE6W

So this:

$file = $_FILES[file][tmp_name];

Would make $file == /tmp/phpcLtE6W

I'm not sure if that's what you want. Seems more likely that you'd want it
to be:

$file = $_FILES[file][name];

Useful?

On Tue, Jul 24, 2012 at 9:18 AM, Brad nyctelec...@gmail.com wrote:

 Thank you very much my friend.
 The significant difference between your code and mine is that my file
 contents are going into a MySQL database and it is this db function that is
 crapping out. The SQL (with variables replaced with static values) runs
 clean -  http://pastie.org/4302489
 But as soon as you throw in a variable/dynamic value, it just becomes a
 mess.

 Brad


 -Original Message-
 From: Jim Giner [mailto:jim.gi...@albanyhandball.com]
 Sent: Tuesday, July 24, 2012 8:45 AM
 To: php-db@lists.php.net
 Subject: [PHP-DB] Re: Stuck trying to upload and grab file name

 At the risk of being unable to understand all the posts that are here
 already,  here is some std. code that I use when I'm uploading a file.

 First - i capture the input field in a local var and all of its components
 in other local vars to make my coding easier later on.

 $inputfield = $_POST['infile'];// infile is the html name of the
 type='file' field
 $destfolder = (where I want the end result stored) $outfile = (the filename
 of the end result) $result =
 HandleUploadedFile($inputfield,$destfolder,$outfile);
 (handle $result after return)
 ***

 The function I use:

 function HandleUploadedFile($inputfield,$destfolder,$outfile)
 {// parm 1 is the name of the type=file field in the html; 2  3 are
 path and output filename you want to store it in
  global $msg,$ftype,$ferror,$fname,$fsize,$ftmpname;
  $ftype = $_FILES[$inputfield][type];
  $ferror = $_FILES[$inputfield][error];
  $fname = $_FILES[$inputfield][name];
  $fsize = $_FILES[$inputfield][size];
  $ftmpname = $_FILES[$inputfield][tmp_name];
  // code up acceptabe filetypes here
  if ( $ftype == text/plain)
  {
  if ($ferror  0)
  {
  $msg .= ' Upload error - return code was '.$ferror;
  return False;
  }
  else
  {
  if (file_exists($destfolder . $fname))
  {
  $msg .=  Duplicate filename - upload not done,
 continuing.;
  return True;
  }
  else
  {
  $msg .=  File has been uploaded to:  . $destfolder
 .$outfile;
  move_uploaded_file($ftmpname,$destfolder . $outfile);
  return True;
  }
  }
  }
  else
  {
  $msg .=  Invalid file type for menu input upload;
  $msg .=  Type is .$ftype;
  return False;
  }
 }


 You of course want to name your end result like the original filename, so
 you will have to make a change to that parameter, but this will work for
 you.

 --
 PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit:
 http://www.php.net/unsub.php


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Graham Holtslander
Computer Systems Technologist
www.graham.holtslander.com
mene...@gmail.com


Re: [PHP-DB] Re: Stuck trying to upload and grab file name

2012-07-24 Thread Graham H.
If by the line you mean:   [tmp_name]= string(14) /tmp/phpcLtE6W

That is from the bottom of this Pastie link: http://pastie.org/4317155

On Tue, Jul 24, 2012 at 10:29 AM, Jim Giner jim.gi...@albanyhandball.comwrote:


 On 7/24/2012 12:05 PM, Graham H. wrote:

 Does the problem have anything to do with this:


   [tmp_name]= string(14) /tmp/phpcLtE6W

 So this:

 $file = $_FILES[file][tmp_name];

 Would make $file == /tmp/phpcLtE6W

 I'm not sure if that's what you want. Seems more likely that you'd want it
 to be:

 $file = $_FILES[file][name];

 Useful?


  Graham,
 The line you reference - I don't see that in my code (which is production
 code) nor in the OP's code.


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Graham Holtslander
Computer Systems Technologist
www.graham.holtslander.com
mene...@gmail.com


Re: [PHP-DB] Re: Stuck trying to upload and grab file name

2012-07-24 Thread Graham H.
Okay.

That line is also in the Pastie code :) Though it isn't in the OP. Hence my
(and your) confusion now. Line 20 from here: http://pastie.org/4317155 also
line 24.

On Tue, Jul 24, 2012 at 10:44 AM, Jim Giner jim.gi...@albanyhandball.comwrote:

 On 7/24/2012 12:40 PM, Graham H. wrote:

 If by the line you mean:   [tmp_name]= string(14) /tmp/phpcLtE6W

 That is from the bottom of this Pastie link: http://pastie.org/4317155


 $file = $_FILES[file][tmp_name];


  I meant the above line.


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Graham Holtslander
Computer Systems Technologist
www.graham.holtslander.com
mene...@gmail.com