[PHP] Re: Passing array from class to class produces more than one result...

2004-03-10 Thread Luis Mirabal
mmmh... i think its not coded the right way, first of all, you shouldn't put
this:

$this->setArray(@mysql_fetch_array($this->getResultID()));

in the Select method, you should do it in your FetchArray method, every time
it gets called, and return the value directly or false if there are no more
rows, an example:

function FetchArray() { return @mysql_fetch_array($this->getResultID()); }

or something like that

"Jonathan Villa" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> I'm writing a DBI class with the following function
>
> function Select($sql)
> {
> $this->setResultID(@mysql_query($sql,$this->getDBConn()));
> if ($this->getResultID() == false)
> Error::fatalError(__FILE__.' ('.__LINE__.') : Unable to run query :
> '.mysql_error().'('.mysql_errno().')');
>
> $this->setNumRows(@mysql_num_rows($this->getResultID()));
> $this->setArray(@mysql_fetch_array($this->getResultID()));
> }
>
>
> When I call this, I want to be able to run
>
> while($data = $objDBI->FetchArray)
> {
> echo $data['username'];
> }
>
> but the results I get are
>
>
jvillajvillajvillajvillajvillajvillajvillajvillajvillajvillajvillajvilla
etc
>
> my $sql query is simple
>
> SELECT username FROM staff;
>
> and there are four rows in the db...
>
>
> For some reason, I can't pass the value of mysql_fetch_array out of the
> Select function.

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



Re: [PHP] arrays, loops, vars and props

2004-03-10 Thread Luis Mirabal
i would do it this way

function MyClass()
{
$this->myArray = range(0, 99);
}

luis.


"Chris W. Parker" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
Jason Davidson 
on Wednesday, March 10, 2004 12:25 AM said:

> would the following example be faster or slower had i simply done
> $this->myArray[$i] = $i;
>
> class MyClass {
> var $myArray = array();
>
> function MyClass() {
> $myTempArray = array();
> for($i=0;$i<100;$i++)
> $myTempArray[$i] = $i;
> $this->myArray = $myTempArray;
>}
> }

here's how i would do it (coding styles aside):

function MyClass()
{
$limit = 100;

$i = -1;
while(++$i < $limit)
{
$this->myArray[] = $i;
}
}



chris.

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



[PHP] Re: what does this mean?

2004-03-10 Thread Luis Mirabal
the casting is as follows, any value distinct from zero, null or empty
string is converted to true, else the it is converted to false

"Harry Wiens" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> $this->styles['shadow'] = (boolean)$bool;
> 
>
> what does "(boolean)$bool" mean?
>
> mfg.
> harry wiens

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



[PHP] Re: Screen Res

2004-03-10 Thread Luis Mirabal
please post the code, so we can see the errors

luis.

"Res0b8b6" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> I am trying to get the users screen res into a var for php. And I have
> the Javascript that gets the screen res. But when I try to put that into
> a var, it puts it in as a string, storing the javascript code instead of
> the results of that code. Is there a way to fix this?

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



[PHP] current url function

2004-03-15 Thread Luis Mirabal
hey! i am working in an open source development, and have done a function
that gives me the current url, but i need it to work always, everywhere, in
every server with all browsers, could you tell me if you think it will or if
you have any suggestions? here is the code:

  /*
Returns the current URL
TODO: The function can not manage nor return user and pass in the URL if
present because it seems that you can not fetch them from PHP (or at least I
dont't know how to do it :P)
LIMITATIONS: fragment (after # sign) can not be fetched since it is a
client-side feature
  */
  function url($host=true, $querystring=true) {
$url = '';
if($host) {
  if ( (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') ||
(!empty($_ENV['HTTPS']) && $_ENV['HTTPS']=='on') ) $url = 'https://'; else
$url = 'http://';
  $url .= !empty($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] :
$_SERVER['SERVER_NAME'];
  //if((int)$_SERVER['SERVER_PORT']!=80) $url .= ':' .
$_SERVER['SERVER_PORT'];
}
//$url .= $_SERVER['SCRIPT_NAME'];
//if($querystring && !empty($_SERVER['QUERY_STRING'])) $url .= '?' .
$_SERVER['QUERY_STRING'];
if($querystring) $url .= $_SERVER['REQUEST_URI']; else $url .=
$_SERVER['PHP_SELF'];
return $url;
  }



thanx in advance!
luis.

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



[PHP] dbg extension...

2004-03-15 Thread Luis Mirabal
hey guys, i have a question on dbg extension, i want to get debug details
using the functions from php, ie. dbg_get_profiler_results, but they return
nothing... i am developing on windows using apache and php 4.3, any
suggestions?

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



Re: [PHP] current url function

2004-03-15 Thread Luis Mirabal
i checked http://sk2.php.net/manual/en/features.http-auth.php, but it doesnt
shows how to see if i passed user:pass in the url. i try
http://user:[EMAIL PROTECTED]/ and dumped globals, and there is nothing... any
ideas?

"Marek Kilimajer" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> Luis Mirabal wrote:
> > hey! i am working in an open source development, and have done a
function
> > that gives me the current url, but i need it to work always, everywhere,
in
> > every server with all browsers, could you tell me if you think it will
or if
> > you have any suggestions? here is the code:
> >
> >   /*
> > Returns the current URL
> > TODO: The function can not manage nor return user and pass in the
URL if
> > present because it seems that you can not fetch them from PHP (or at
least I
> > dont't know how to do it :P)
>
> False, check http://sk2.php.net/manual/en/features.http-auth.php
>
> > LIMITATIONS: fragment (after # sign) can not be fetched since it is
a
> > client-side feature
>
> True
>
> >   */

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



[PHP] Re: Problem with mkdir() under windows.

2004-03-15 Thread Luis Mirabal
mmmh... i think your problem isn't in mkdir, it is in evil MAGIC QUOTES!
(they are on by default)

if you are getting the name of the directory from GET, POST or COOKIE, check
the get_magic_quotes_gpc(), else check  get_magic_quotes_runtime(), if the
problem is in  get_magic_quotes_runtime(), you can do
set_magic_quotes_runtime(0) beforegetting the directory name, so it won't be
quoted, but if the problem is in  get_magic_quotes_gpc(), you will have to
do something like:

if(get_magic_quotes_gpc()) stripslashes($dirname);

luis.

"Brian J. Celenza" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> I'm having a problem using the mkdir() function under windows when the
> directory containts a special character. For instance, the directory
> "Someone's Files", a forward slash is added before the 's and the
directory
> returns an error. Is there a way around this?
>
> Thank you
> Brian

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



Re: [PHP] Printing landscape

2004-03-15 Thread Luis Mirabal
actually, you can control your printer, look:

http://www.php.net/manual/en/function.printer-set-option.php
you have to do:

$handle = printer_open();
printer_set_option ($handle,  PRINTER_ORIENTATION ,
PRINTER_ORIENTATION_LANDSCAPE);
printer_close($handle);

you've got many interesting options with this function.

( These functions are only available under Windows 9.x, ME, NT4 and 2000.
They have been added in PHP 4.0.4.)

and you can do something about the phase of the moon too, look here :P

http://www.phpclasses.org/browse/package/1201.html?download=targz

Cheers,
Luis.

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



Re: [PHP] dbg extension...

2004-03-16 Thread Luis Mirabal
yes, i found that the extension functions only works in debug sessions, so i
replaced it by Xdebug, it is very cool, i recommend it!
http://www.xdebug.org/

luis.

"Tom Rogers" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> Hi,
>
> Tuesday, March 16, 2004, 9:51:46 AM, you wrote:
> LM> hey guys, i have a question on dbg extension, i want to get debug
details
> LM> using the functions from php, ie. dbg_get_profiler_results, but they
return
> LM> nothing... i am developing on windows using apache and php 4.3, any
> LM> suggestions?
>
>
> You probably have to trigger the debugger by doing something like
> this:
>
> http://domain.com/test.php?DBGSESSID=123456
>
> --
> regards,
> Tom

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



[PHP] Re: Calculate

2004-03-16 Thread Luis Mirabal
from sql?? if you are doing:

select ... count(date) ...from ... where ...

do:

select ... count(date) ...from ... where ... group by date

luis.

"Tommi Virtanen" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> Hi!
>
> How I can calculate following:
>
> I have table:
> id(int) start_date(date) end_date(date)
> 001 2004-03-10 2004-03-12
> 002 2004-03-27 2004-04-02
> 003 2004-04-05 2004-04-06
>
> Total count of date is 12. But how I can calculate count of
> date per month?
>
> regards,
>
> gustavus

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



[PHP] mappath and unmappath function

2004-03-16 Thread Luis Mirabal
does someone knows a function to map a server path to a fs path, and a
function that does the inverse? i mean, if you have /var/www/html/script and
applies function unmappath, it returns /script and if apply mappath to
/script it returns /var/www/html/script. somebody has something like this?

thanx
luis.

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



[PHP] Re: $_FILE

2004-03-16 Thread Luis Mirabal
it is not $_FILE, it is $_FILES :P

luis.

"Bruno Santos" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> Hello.
>
> I've read in a book that we can access several file properties (when
> uploading a file) in two ways:
>
> 1st with the array $_FILE
> 2nd with $HTTP_POST_FILES
>
> i've used the 1st, but my program give many erros, and when using the
> 2nd, everything was fine.
>
> the 1st is avaiable from PHP 4.1.0, and im using PHP 4.3.4.
> Can someone tell me why does not work ???
>
> cheers
>
> --
> -
>.-'-.
>  .' `.
> : :
>:   :
>:  _/|  :   Bruno Santos
> :   =/_/  : [EMAIL PROTECTED]
>  `._/ | .'
>   (   /  ,|...-'Pagina Pessoal
>\_/^\/||__   http://feiticeir0.no-ip.org
> _/~  `""~`"` \_
>  __/  -'/  `-._ `\_\__
>/jgs  /-'`  `\   \  \-.\
>
>
>"Written very small on the back poket of a girl's jeans
>- 'If you can read this, you're WAY too close.'"

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



[PHP] Re: Regular expression checker

2004-03-17 Thread Luis Mirabal
an excelent tool: The Regex Coach, its free and you can grab it from
http://weitz.de/regex-coach/
and its available for windows and linux!

luis.

<[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> Hello all,
>
> For a while I tried in vain to find a decent regular expression tester.
The closest I found
> was RegExpEditor, by the same people who produce PHPEdit, but I found it
to be slow
> and didn't like its constant bitching about "invalid delimiters" or some
such thing.
>
> Anyway, I ended up writing a little tester for Perl-compatible regular
expressions and
> thought I'd share it with you. Maybe it'll come in handy to people who
often need to use
> regular expressions in their projects. Just copy the code below the dotted
line (which
> has Unix line breaks) and save it to a file.
>
> Cheers,
>
> Erik
>
> 
>
> 
> 
> 
> Regular Expression Tester
>  {
> $error = false;
> if($_POST['mode'] == 'one')
> {
> if( @preg_match('/'.$_POST['regexp'].'/', $_POST['text'], $matches) ===
> false )
> {
> $error = true;
> }
> }
> else
> {
> if( @preg_match_all('/'.$_POST['regexp'].'/', $_POST['text'], $matches)
> === false )
> {
> $error = true;
> }
> }
> }
> ?>
> 
> 
>  enctype="multipart/form-data">
> 
> 
> Regular expression:
> 
>  
> />
> 
> 
> 
> Text:
> 
> 
> 
> 
> 
> 
> 
> Mode:
> 
> 
>   {
> print 'selected';
> }
> ?>
> >First match
>   {
> print 'selected';
> }
> ?>
> >All matches
> 
> 
> 
> 
>   
>  
>    
> 
> 
> 
> 
> 
> 
> 
>  {
> exit(''.
> 'Invalid regular expression!');
> }
> ( isset($matches) && !empty($matches[0]) )
> {
> print 'Full
match(es):'.
>   ' ';
>
> if( !is_array($matches[0]) )
> {
> print ''.
>   '1'."\n".
>   ''.htmlentities($matches[0]).''.
>   '';
> }
> else
> {
> foreach($matches[0] as $key => $val)
> {
> print ''.($key+1).
>   ''."\n".''.htmlentities($val).''."\n".
>   '';
> }
> }
> }
> {
> print ''.
>   'No matches found.';
> }
> ( isset($matches[1]) && !empty($matches[1]) )
> {
> print ' '.
>   ''.
>   ' '.
>   ''.
>   'Sub-pattern match(es):'.
>   ' ';
> for($i = 1; $i < count($matches); $i++)
> {
> if( !is_array($matches[$i]) )
> {
> print ''.
>   ''.$i.''."\n".
>   ''.htmlentities($matches[$i]).''.
>   '';
> }
> else
> {
> foreach($matches[$i] as $key => $val)
> {
> print ''.
>   ''.$i.'.'.($key+1).
>   ''."\n".''.htmlentities($val).''."\n".
>   '';
> }
> }
> if( isset($matches[$i+1]) )
> {
> print ' ';
> }
> }
> }
> ?>
> 
> 
> 
> 

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



[PHP] js date picker

2004-03-17 Thread Luis Mirabal
anyone knows a good javascript date picker, i need it to be compatible with
all major browsers

thx,
luis.

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



[PHP] Re: Stupid question

2004-03-17 Thread Luis Mirabal
when you are working with classes and objects in php, and you are coding
inside a class, you must use the $this variable to access the members of the
class, for example:

class test {

//Class vars (something like properties)
var $a;
var $b;
var $c;
var $sum;

//Class function (Constructor)
function test() {
$this->a = 'value for a';
$this->b = 'value for b';
$this->c = 'value for c';
$this->set();
}

//Class function
function set() {
$sum = $this->a . $this->b . $this->c;
}

} //end class

luis.

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



[PHP] Re: js date picker

2004-03-17 Thread Luis Mirabal
i am using it from a php program... maybe i was not clear enough... but
thanx, i found some at phpclasses.org

"Ben Ramsey" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> This is a wee bit off topic, seeing as how this is a PHP mailing list.
> We'll be happy to help with PHP-related questions.  As for JavaScript
> stuff, use Google to find a good resource.  :-)
>
> Luis Mirabal wrote:
>
> > anyone knows a good javascript date picker, i need it to be compatible
with
> > all major browsers
> >
> > thx,
> > luis.
>
> --
> Regards,
>   Ben Ramsey
>   http://benramsey.com
>   http://www.phpcommunity.org/wiki/People/BenRamsey

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



[PHP] Re: Stupid question

2004-03-17 Thread Luis Mirabal
as Chris W. Parker noticed, there is a little mistake in the example above
posted by me, it says:

//Class function
function set() {
$sum = $this->a . $this->b . $this->c;
}

and it should say:

//Class function
function set() {
$this->sum = $this->a . $this->b . $this->c;
}

sorry :P
luis.

"Luis Mirabal" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> when you are working with classes and objects in php, and you are coding
> inside a class, you must use the $this variable to access the members of
the
> class, for example:
>
> class test {
>
> //Class vars (something like properties)
> var $a;
> var $b;
> var $c;
> var $sum;
>
> //Class function (Constructor)
> function test() {
> $this->a = 'value for a';
> $this->b = 'value for b';
> $this->c = 'value for c';
> $this->set();
> }
>
> //Class function
> function set() {
> $sum = $this->a . $this->b . $this->c;
> }
>
> } //end class
>
> luis.

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



[PHP] php + mysql + japanese???

2004-04-02 Thread Luis Mirabal
hi! i have developed a web site in php using mysql 3.x and have to
implement it in japanese, it seems that i have to use unicode/UTF-8,
but i am having problems with mysql... anyone could help or anyone knows of any 
resource
that helps in doing this?

thanx in advance,
luis

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