Re: [PHP] what would a c extension buy me

2006-03-13 Thread Ben Litton
Something that is chiefly bottlenecked at the database isn't going to be improved enough at the C level to be worth the trouble. Always optimize where it's slow. Database design and indexing helps. Minimizing unnecessary queries, writing good ones, helps too. Once you get to the point that

[PHP] Re: Two version of PHP in single server

2005-11-29 Thread Ben Litton
You can do this if you register a different add-type. Say php5 for the php 5.1 pages and just php for the regular ones. You may (I can't recall) have to install one as mod_php and the other as a cgi. There are surely guides on the internet to help you get both running simultaneously. On

[PHP] Re: protect password?

2005-11-04 Thread Ben Litton
I'm not sure if there's a way around this, though there's a few simple precautions you can take. You can put a function that returns the resource in an include file outside of the public html folders, which helps a little bit. It's also always good to give the least permission possible and

[PHP] Re: getting rid of bad characters

2005-10-31 Thread Ben Litton
Check in the comments section of ths page: http://us3.php.net/htmlentities . You're not the first person to have this problem. Ben On Mon, 31 Oct 2005 10:30:49 -0500, Dan McCullough [EMAIL PROTECTED] wrote: I having been looking for some snippet to help me with changing MS Word double,

Re: [PHP] GUID or any other unique IDs

2005-10-25 Thread Ben Litton
While not ideal, you could do a select on a db. MS SQL and MySQL both have functions to generate unique id's and I imagine the other databases do as well. While running a SELECT uuid() and hitting the database for each one of these things is annoying, it is one possible pseudo-solution. On

[PHP] Re: Email Validation built-in? RFC

2005-10-24 Thread Ben Litton
You could certainly write an extension to do so. That's what I did (mostly I was writing one for another purpose and added a function I stole from O'Reilly. You can find the C code I used here: http://www.oreillynet.com/pub/a/network/excerpt/spcookbook_chap03/index3.html. It's pretty

[PHP] Re: Inserting NULL Integer Values

2005-10-18 Thread Ben Litton
Either cast your empty ints (which should make it zero) or do an if (!isset($variable)) { $variable = 'NULL'; } Ben On Tue, 18 Oct 2005 12:15:41 -0400, Shaun [EMAIL PROTECTED] wrote: Hi, Up to this point in time I used to construct my insert statements like this $qid =

[PHP] Re: Inserting NULL Integer Values

2005-10-18 Thread Ben Litton
, woudn't that insert a string with a value of'NULL';? Ben Litton [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Either cast your empty ints (which should make it zero) or do an if (!isset($variable)) { $variable = 'NULL'; } Ben On Tue, 18 Oct 2005 12:15:41 -0400, Shaun [EMAIL

Re: [PHP] Re: Inserting NULL Integer Values

2005-10-18 Thread Ben Litton
Good explanation but I think he wanted to avoid quoting the integers. I may be wrong, but I think not quoting integers is a decent practice because it makes it easier to port your SQL over to a different database if you later decide you must do so. Of course he could just add a single

Re: [PHP] Re: Inserting NULL Integer Values

2005-10-18 Thread Ben Litton
You're using two =='s for your assignment. On Tue, 18 Oct 2005 15:15:59 -0400, Shaun [EMAIL PROTECTED] wrote: Hi all, Thanks for your replies, rather than check each vaule by name I am trying to produce a more dynamic solution: foreach ($_POST as $key = $value) { if ($value == '') {

[PHP] Re: Recommended Reading?

2005-10-18 Thread Ben Litton
I liked Schlossnagle's 'Advanced PHP Programming' http://www.amazon.com/exec/obidos/tg/detail/-/0672325616/qid=1129664190/sr=8-1/ref=pd_bbs_1/002-6178615-3953615?v=glances=booksn=507846 It has a little primer on a variety of things but is for the php5 user. You might also want to read a book

Re: [PHP] Uploaded CSV - database

2005-10-17 Thread Ben Litton
Actually I think fgetcsv will work with any valid file pointer and at least in PHP 5, the streams implementation will allow you to use a variety of protocols to create the stream. http://us2.php.net/manual/en/wrappers.php I understand that it isn't even too teribbly difficult to implement

[PHP] Re: Array within array

2005-09-30 Thread Ben Litton
I would do something like $fp = fopen($file_location, 'r'); while (!$fp) { $csv_line = fgetcsv($fp); //insert line into database here after appropriate validation and cleaning } On Fri, 30 Sep 2005 06:29:11 -0400, Chris [EMAIL PROTECTED] wrote: Greetings PHP community, I have a CSV text file