Re: [PHP] mysql: UPDATE statment

2001-05-11 Thread Christian Dechery

At 21:40 10/5/2001 -0400, [EMAIL PROTECTED] wrote:
>why isnt this working
>
>i need to get 5 values updated in a table called 'user_polls'
>
>how do I do this?
>i have
>
>UPDATE user_polls WHERE id = '$id' VALUES($1, $2. and so on


your statement is incorrect... the correct UPDATE syntax is:

UPDATE user_polls set field='value', field2='value2', field3=value3 where 
id=$id;

hope it helps...


. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] fopen() and persmissions

2001-05-10 Thread Christian Dechery

as I've seen PHP running as Apache module cannot create or update files...

it gives me 'permission denied'...

so I've tried these solutions:

* fopen("ftp://user:[EMAIL PROTECTED]/directory/newfile.ext","w";);
this actually works... but only for "w"... if I wanna update this file, 
like "a", it can't be done as it says the file already exists... so I'd 
have to read it entirely, add the new data and write it back... (not so 
good)

* chmod 777 in the dir I am... so 'nobody' (apache user) can write to it... 
but what happens is that, the file isn't mine... it belongs to nobody... so 
I have no rights to it in FTP or telnet...

is there a better solution then either of these two???

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] sending attachments via mail(), possible?

2001-05-09 Thread Christian Dechery

At 15:17 9/5/2001 -0400, Tym Rehm wrote:
>You have to open the file and encode it.
>Check out this:
>
>/* Define the attachment and encode it base64 */ 
>$filename="/var/www/sf/Ftp_User_Info.doc"; $fd = fopen($filename, "r"); 
>$contents = fread($fd, filesize($filename)); 
>$encoded=chunk_split(base64_encode($contents)); fclose($fd); /* Trim white 
>spaces */ $request_by = trim($request_by); $email = trim($email); $company 
>= trim($company); /* testing if form is filled out */

the problem is that is NO file... I want to put in the attachment part just 
a text... but I want it to go as a text attachment...
I still have to base64_encode-it even if it is text file?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] About MySQl and Transactions

2001-05-09 Thread Christian Dechery

At 20:09 9/5/2001 +0200, Fredrik Rodland wrote:
>I don't think MySql does not have support for transactions.  Try using
>another DB - like postgres.

yes it does... download Mysql-Max or install BDB in your mysql dist (if you 
are under *ux or *ix)...

Mysql-Max is the newest Mysql dist including BDB (which support transactions)...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] sending attachments via mail(), possible?

2001-05-09 Thread Christian Dechery

Is it possible to send attachments via mail() function?

I tried it, and it didn't work out... the email I receive is all messed up, 
and even the simple text part of it is screwed up. I now very little about 
MIME, but I really need to send an attachment, any help? It's a text 
attachment...

This is the code I'm using:

function send_email($body,$num_pedido,$filename)
{
define(NL,"\n");
$boundary="test".chr(rand(65,91))."".md5(uniqid(rand()));
$message="Segue em anexo dados referentes ao pedido $num_pedido.".NL.NL;
$message="Content-type: text/plain\nContent-transfer-encoding: 
7bit".NL.NL.$message;
$attach="Content-type: text/plain\nContent-transfer-encoding: 
base64\nContent-disposition: attachment; filename=".$filename.NL.NL;
$attach.=base64_encode($body);
$attach.=NL;
$mail_body=$boundary.NL.$message.$boundary.NL.$attach.$boundary."-";
$header="MIME-Version: 1.0\nContent-Type: 
multipart/mixed;\n\tboundary=\"".$boundary."\"\nContent-Transfer-Encoding: 
7bit";
// echo "$mail_body";
mail("[EMAIL PROTECTED]","CDYOU Pedido: 
".$num_pedido,$mail_body,$header);
}

the headers are sent perfectly... and if I echo the $mail_body (I think) 
it's correct, but when I get the mail it's all screwed up...

thanks...
_
. Christian Dechery - CTO
.. WebDeveloper @ Webstyle!
.. http://www.webstyle.com.br
.. http://www.tanamesa.com.br


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Working with numbers

2001-05-09 Thread Christian Dechery

At 11:22 9/5/2001 -0700, Gerry wrote:
>Could you suggest a function for displaying decimal zeros.
>
>For example I have this:
>$num = "2.00";
>$num2 = "3.00";
>$result = $num + $num2;
>echo "$result";
>
>I get "5" but not "5.00"

try $result = (float)$num + (float)$num2;


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] attach file to email

2001-05-09 Thread Christian Dechery

How do I attach a file to an email?

I'd have a mailbody also, with some text... ad I wanna attach a text file 
to it, but I don't want it to be appended in the body... I want it as an 
attachment.
_____
. Christian Dechery - CTO
.. WebDeveloper @ Webstyle!
.. http://www.webstyle.com.br
.. http://www.tanamesa.com.br


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] download successfull... but in binary... why?

2001-05-09 Thread Christian Dechery

At 07:45 9/5/2001 -0700, you wrote:
>You decided it was using binary because \n was not being converted to \r\n?
>
>Aren't you just struggling with the difference between unix and windows
>files?
>
>Perhaps if you filtered the files replacing \n to \r\n when destination is
>windows platform.

thanks man... that actually worked out... now the file is in perfect ascii 
mode just the way I wanted it.

Thanks a lot!


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] download successfull... but in binary... why?

2001-05-09 Thread Christian Dechery

At 08:39 9/5/2001 -0500, Boget, Chris wrote:
> > header("Content-type: application/download");
>
>I think you'd need to change this to:
>
>header("Content-type: text/plain");
>
>but I could be wrong...
>
> > and where can I find reference on these header stuff?
>
>Not sure.  I find bits and pieces in this list...

tried it... doesn't work.

if I change to 'text/plain' the download doesn't occur... it shows the 
output on screen...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] download successfull... but in binary... why?

2001-05-09 Thread Christian Dechery

I got my script to successfully force the otuput to be redirected to a download
of a new file.

using:

if(stristr($HTTP_USER_AGENT,"MSIE"))
$att="";
else
$att=" attachment;";
header("Content-type: application/download");
header("Content-disposition:".$att." filename=".$filename);

but the problem is, the output is comming as binary... so the '\n' is not
working, instead it'comming as a one giant line with lots of weird chars
instead of '\n'... how do I force it to be in ASCII mode?

and where can I find reference on these header stuff?





. [ Christian Dechery  ]
. Webdeveloper @ Tá Na Mesa!
. Listmaster @ Gaita-L
. http://www.tanamesa.com.br



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] VERY URGENT

2001-05-08 Thread Christian Dechery

what in Gods name is that?

At 02:51 9/5/2001 +0100, SOLOMON BALOGUN wrote:
>VERY URGENT BUSINESS,
>#20 LOUIS BOTHA CRESCENT,
>SADTON.SOUTH AFRICA,
>Tel:874-762-727947,
>Fax:87-4762-727949.
>
>Dear sir,
>
>In order to transfer out (USD 126 M) One hundred and
>twenty six million United States Dollars) from African
>Development Bank. I have the courage to ask you to
>look for a reliable and honest person who will be
>capable for
>this important business believing that you will never
>let me down either now or in future.
>
>I am SOLOMON BALOGUN, the Chief auditor of African
>Development Bank (ADB). There is an account opened in
>this bank in 1980 and since 1990 nobody has operated
>on this account again. after going through some old
>files in the records I discovered that if I do not
>remit this money out urgently it will be forfeited for
>nothing. the owner of this account is Mr. Smith B.
>Andreas, a foreigner, and a miner at kruger gold co.,
>a geologist by profession and  he died since 1990. no
>other person knows about this account or any thing
>concerning it, the account has no other beneficiary
>and my investigation proved to me as well that this
>company does not know anything about this account and
>the amount involved is (USD 126M) One hundred and
>twenty six million United States Dollars million
>dollars. I want to first transfer USDM twenty six
>million United States Dollars from this money into a
>safe foreigners account abroad before the rest, but I
>don't know any foreigner, I am only contacting you as
>a foreigner because this money can not be approved to
>a local bank here, but can only be approved to any
>foreign account because the money is in us dollars and
>the former owner of the account is Mr. Smith B.
>Andreas is  a foreigner too.  I know that this message
>will come to you as a surprise as we  don't know our
>selves before, we will sign agreement, but be sure
>that it is real and a genuine business. I
>only got your contact address my from my secretary who
>operates computer,
>with believe in god that you will never let me down in
>this business you are the only person that I have
>contacted in this business, so please reply urgently
>so that I will inform you the next step to take
>urgently. Send also your private telephone and fax
>number including the full details of the account to be
>used for the deposit.
>
>I want us to meet face to face or sign a binding
>agreement to bind us together so that you can receive
>this money into a foreign account or any account of
>your choice where the fund will be safe. and I will
>fly to your country for withdrawal and sharing and
>other investments.
>
>I am contacting you because of the need to involve a
>foreigner with foreign account and foreign
>beneficiary. I need your full co-operation to make
>this work fine. because the management is ready to
>approve this payment to any foreigner who has correct
>information of this account, which Iwill give to you
>later immediately, if you are able and with capability
>to handle such amount in strict confidence and trust
>according to my instructions and advice for our mutual
>benefit because this opportunity will never come again
>in my life. I need truthful person in this business
>because I don't want to make mistake I need your
>strong assurance and trust.
>
>With my position now in the office I can transfer this
>money to any foreigner's reliable account which you
>can provide with assurance that this money will be
>intact pending my physical arrival in your country for
>sharing. I will destroy all documents of transaction
>immediately we receive this money leaving no trace to
>any place. you can also come to discuss with me face
>to face after which I will make this remittance in
>your presence and two of us will fly to your country
>at least two days ahead of the money going into the
>account.
>
>I will apply for annual leave to get visa immediately
>I hear from you that you are ready to act and receive
>this fund in your account. I will use my position and
>influence to effect legal approvals and onward
>transfer of this money to your account with
>appropriate clearance forms of the ministries and
>foreign exchange departments.
>
>At the conclusion of this business, you will be given
>35% of the total amount, 60% will be for me, while 5%
>will be for expenses both parties might have incurred
>during the process of transferring.
>
>I look forward to your earliest reply through my email
>address or by my
>Tel:874-762-727947,
>fax:874-762-727949.
>
>yours truly
>
>SOLOMON BALOGUN.
>
>
>
>
>
>
>______

Re: [PHP] forcing download instead of showing output

2001-05-08 Thread Christian Dechery

At 16:53 8/5/2001 -0400, Toby Miller wrote:
>I use this code:
>
>header("Content-Type: $filetype");
>header("Content-Disposition: atachment; filename=$showfilename");
>header("Content-Length: $filesize");
>readfile($source);
>
>Note the mispelling of "atachment". This seems wrong but is actually the
>correct spelling for IE, Netscape doesn't seem to mind either way.

tried that... didn't work... all it did was tried to save the file being 
displayed (the form) to script.html..

I'm going to explain a little better what my script does, so it's easier to 
help me.

there is a form with only one field... a file field... than the user 
selects the file, clicks on submit, by doing this, the file is uploaded and 
processed... it's a CSV file, that has to be checked and processed and 
return another CSV file with a specific filename (in my case 
$filename="003".date("dmy").".txt";)... so what I really want is the user 
to download this file with the processed content from the uploaded file...

Do I really have to create this file with fopen() or something and only 
then put the headers? In this case I'd have a file that I don't want... I'd 
have to delete it later on, isn't there a way I can just redirect all the 
output generated by php to a download and instruct the browser the filename 
to be saved?

Where can I get some reference to all this header stuff?

thanks

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] forcing download of new file

2001-05-08 Thread Christian Dechery

I want the script I'm doing to redirect all the output to a filename and
that it gets downloaded.

In other words... When someone presses the submit button I want the download
screen to show with the filename I declared so the user can save the output
from the script.

something like this:

- there's a form, the user fills it up and presses submit
- then instead of showing the output on the screen I want the output to
go to a file for him to download with a dynamically made filename (in this
case the date) containing the results of the execution of the script

is this possible? I think it is... I once saw it...

thanks


. [ Christian Dechery  ]
. Webdeveloper @ Tá Na Mesa!
. Listmaster @ Gaita-L
. http://www.tanamesa.com.br



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] forcing upload instead of showing doc

2001-05-08 Thread Christian Dechery

It didn't work at all.

It started a download, but with a filename called myscriptfilename.html
and with the contents of the html (in this case the form) being shown and
not the output.

I want to set these headers, and then do regular echo statements to this
newly created downloading file.

>Hi,
>
>
>header("Content-Type: application/octet-stream");
>header("Content-Disposition: attachment; filename=name.doc");
>include("file.doc");
>?>
>
>Wieger
>
>Christian Dechery wrote:
>>
>> How do I force an output to be recognized by the browser by a downloadable
>> text file as soon as I press the submit button?
>>
>> what header(*) stuff should I add before echo-ing stuff?
>>
>> thanks
>>
>> . [ Christian Dechery  ]
>> . Webdeveloper @ Tá Na Mesa!
>> . Listmaster @ Gaita-L
>> . http://www.tanamesa.com.br
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>--
>Wieger Uffink
>tel: +31 20 428 6868
>fax: +31 20 470 6905
>web: http://www.usmedia.nl
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>



. [ Christian Dechery  ]
. Webdeveloper @ Tá Na Mesa!
. Listmaster @ Gaita-L
. http://www.tanamesa.com.br



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] forcing upload instead of showing doc

2001-05-08 Thread Christian Dechery

How do I force an output to be recognized by the browser by a downloadable
text file as soon as I press the submit button?

what header(*) stuff should I add before echo-ing stuff?

thanks


. [ Christian Dechery  ]
. Webdeveloper @ Tá Na Mesa!
. Listmaster @ Gaita-L
. http://www.tanamesa.com.br



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] arrays and strings... a little confusing.

2001-05-07 Thread Christian Dechery

Whats is the difference between [] and {} ?

define(NL,"\n");
$str="How do you do?";
echo $str[3].NL;
echo $str{3}.NL;
$array = array("how","do","you","do?");
echo $array[2].NL;
echo $array{2}.NL;

this outputs
d
d
you
you

so there's no difference right? When does a string become an array and 
vice-versa?
if I do $str=(array)$str; then $str[0] will contain "How do you do?" but if 
I do $array=(string)$array then $array contains the string "Array", so it 
doesn't work both ways. How does PHP works with this? I come from C where a 
string and an array of char is exactly the same thing, so this kinda 
confuses me.

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] % always return int?

2001-05-03 Thread Christian Dechery

How can I get the modulus of an float by an integer?

$time=3.345345;
$time2=2.34234;
$time3=$time%$time2;
echo $time3;

this outputs 1.

$time=3.345345;
$time2=2
$time3=$time%$time2;
echo $time3;

this also outputs 1.

Of course... when dividing two floats, there is no remainder... but, there 
is an integer invovled... is automatically converted to float before 
dividing, so that's why no remainder?
____
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] redirection to another page function

2001-04-22 Thread Christian Dechery

At 12:48 23/4/2001 +1000, Chris Aitken wrote:
>At 11:40 PM 22/04/2001, you wrote:
>
>>I justed pointed out that it could work nicely... and I just tought of 
>>that... I user header("location: ... ") on all my scripts and struggle to 
>>put them before any output (that's not easy)...
>>I work on a e-commerce website (coding in ASP, but what can I do?) with 
>>lots of JavaScript calls that in some cases are the heart of the 
>>operation, and we never had any trouble or complaints with it.
>
>While I do utilise some javascript niceties in some of my work, I usually 
>only do it either when a) its an internal sytsem here at work and I know 
>everyone has the same system/software/setup or b) where its only an 
>enhancement and it wont affect the usability of the system if its not 
>there. Ill always try and use PHP and server side solutions before 
>resorting to client side solutions

that's a better way to think about it...

Altough... I still think that URL redirection should be something easier to 
do... as it is something very usefull and very basic, if u think in the 
concepts of WWW and surfing... going from one page to another is almost a 
primitive... u know where I'm getting at?


. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] redirection to another page function

2001-04-22 Thread Christian Dechery

At 12:42 23/4/2001 +1000, you wrote:
> > I work on a e-commerce website (coding in ASP, but what can I
> > do?) with lots of JavaScript calls that in some cases are the heart
> > of the operation, and we never had any trouble or complaints with it.
>
>I want your job.

I don't think u do. :) ASP sux. Win2K sux even worse, I was just working at 
home in huge PHP script that ended up haning the entire system because I 
remotely restarted WIN2K and crappy-old-IIS didn't get back. Can u imagine 
my ears tomorrow? :)) hehehehe


>We have people complain every time we set a cookie. Imagine the
>fuss we'd have if we required JavaScript for something. :)



____
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] redirection to another page function

2001-04-22 Thread Christian Dechery

At 12:22 23/4/2001 +1000, Chris Aitken wrote:
>At 11:15 PM 22/04/2001, Christian Dechery wrote:
>
>>Yeah... I know that... but, c'mon... a browser that doesn't support 
>>Javascript can't surf trough at least 30% of all websites... it's the 
>>absolute minority. Netscape itself is a minority.
>
>While its true Netscape is a minority, and browsers not allowing 
>Javascript are an even bigger minority (Bigger Minority. Military 
>Intelligence Microsoft Works ?), I think Jasons point was more to show 
>that its best to use an option which will work on all environments if 
>possible. Sure, the Javascript system will work, but the header() function 
>works better.
>
>Surely its better to write your code trying not to exclude any user if at 
>all possible.

Yeah... I know what you and Jason mean.

I justed pointed out that it could work nicely... and I just tought of 
that... I user header("location: ... ") on all my scripts and struggle to 
put them before any output (that's not easy)...
I work on a e-commerce website (coding in ASP, but what can I do?) with 
lots of JavaScript calls that in some cases are the heart of the operation, 
and we never had any trouble or complaints with it.

I know that, the best way is to get your script running anywhere regardless 
of what browser or OS people use, but is important too to use as much of 
the technology as you can. Like HTML capable clients... in a recent pass, 
that was a nightmare cuz half the people used the most outdated email 
clients, but nowadays, almost every spam or corporate email I get, is HTML, 
people who don't have HTML capable clients, hurry to get them. I won't even 
get started with "Your browser isn't frames capable", 
hehe. Javascipt is almost a standard and it is a great help in many cases 
where server-side simply won't do the job. I don't know... I'm just 
thinking here... maybe its all BS! :)

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] redirection to another page function

2001-04-22 Thread Christian Dechery

At 11:56 23/4/2001 +1000, you wrote:
> > I never had any trouble using header() to redirect, but
> > wouldn't something like this work even better (without
> > worring about previous outputs)??
> >
> > function redirect($dest)
> > {
> >  ?>
> >  
> >  parent.location.href='<?=$dest?>';
> >  
> >   > }
> >
> > it would work wouldn't it?
>
>In Netscape:
>
>  Menu >> Edit >> Preferences >> Advanced >>
>[ ] Enable Javascript
> ^
> Not ticked
>
>Oops. I just broke that redirection. :)

Yeah... I know that... but, c'mon... a browser that doesn't support 
Javascript can't surf trough at least 30% of all websites... it's the 
absolute minority. Netscape itself is a minority.


. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] redirection to another page function

2001-04-22 Thread Christian Dechery

At 11:22 23/4/2001 +1000, Jason Murray wrote:
> > Is there any PHP native function to redirect to another page or URL?
>
>No, because you can only redirect a browser to another page using the
>appropriate HTTP command (it is a header) or JavaScript.
>
> > I would like that once the user clicks on home.php4 and a few
> > verifications are done, he/she would be redirected to home.html.
>
>You can issue a HTTP redirection command to the web browser by using
>PHP's Header() function. You'll want to use this kind of code:
>
>Header("Location:
>http://this.is.the.destination.com/directory/file.php");
>?>

I never had any trouble using header() to redirect, but wouldn't something 
like this work even better (without worring about previous outputs)??

function redirect($dest)
{
 ?>
 
 parent.location.href='';
 
 http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] CGI x DSO: Output Buffering

2001-04-22 Thread Christian Dechery

As I've seen and tested, Apache running in Win2k won't do output buffering 
running PHP as CGI.

But will perfectly running PHP as DSO.

Any explanations?
____
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] strtok not working...

2001-04-22 Thread Christian Dechery

I have a chunk of text like this:

$string="bla bla bla (12837) ble blo bli sjhs9 39udjkd";

I only want "bla bla bla" out of it...

what is wrong with:
$newString = strtok ($string,"(128");

altough this seems to work:
$newStrArray = explode("(128",$string);

so $newStrArray[0] would have exactly what I want... why doesn't strtok() 
works here?
____
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] weird mail() behaviour

2001-04-22 Thread Christian Dechery

I have a formmail script that works both under Win32 as in Linux.

It has a function email() that calls either mail() if in Win32 or 
sendmail() if in Linux... in Linux this sendmail() function works exactly 
as mail() but calling a popen() to sendmail... and it works fine..
but sometimes in Win mail() simply terminates the script and the email 
isn't sent.

It's weird, it's like mail() had some internall error and had to quit the 
entire script execution, cuz nothing after the mail() funcion is called 
happens, and it does not give me any error message either...
____
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] huge PHP file, hardcore processing

2001-04-10 Thread Christian Dechery

At 10:20 11/4/2001 +0900, you wrote:
>I think DLL for MS SQL Server will work with Apache for Windows/PHP for 
>Windows.
>There are many basic functions are not supported under PHP for Windows, but it
>work fine for me other than those missing functions. If your server may have
>multiple IP addressees, it's easy to co-exist with IIS.
>
>How about give it a try?


I guess I don't have multiple IP adresses on my server... can't I just 
install Apache and have it listen on port 8080 instead? Will it co-exist 
nicely with IIS?

____
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] huge PHP file, hardcore processing

2001-04-10 Thread Christian Dechery

At 12:06 10/4/2001 +0900, you wrote:
>You should be able to use ODBC under UNIX. I guess.
>
>Source code for  MS SQL Server modules seems it does not compile under UNIX. I
>guess it may work with Apache under Windows.
>
> From mssql_win32_howto.txt in PHP source.
>
>24 Start Visual Studio, load php_modules.dsw, select the MSSQL projects,
>  25 configuration and build it.
>  26
>  27 This module requires ntwdblib.dll and one or more of the following dll's
>  28
>  29 dbmsadsn.dll
>  30 dbmsrpcn.dll
>  31 dbmsshrn.dll
>  32 dbmssocn.dllfor tcp/ip connections
>  33 dbmsspxn.dllfor ipx/spx connections
>  34 dbmsvinn.dll
>  35 dbnmpntw.dllfor netbios connections
>
>Sorry I don't use MS SQL Server.

well... I don't have Visual Studio here... so I guess I'm stuck with 
shitty-old IIS... :(

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] huge PHP file, hardcore processing

2001-04-09 Thread Christian Dechery

At 18:40 9/4/2001 -0700, you wrote:
>On 4/9/01 6:38 PM, "Christian Dechery" <[EMAIL PROTECTED]> wrote:
>
> > At 10:23 10/4/2001 +0900, you wrote:
> >> IIS ISAPI(PHP4.0.4pl1 and PHP4.0.5RC1) does not work well for me and 
> too many
> >> problems. So I switched to Apache. However, ob_implicit_flush() seems 
> slows
> >> things down on W2K/Apache/PHP4.0.4RC1 also. (ob_implicit_flush() may slow
> >> things
> >> down, but it's more apparent than my Linux/Apache box)
> >>
> >> You may get better result on UNIX/Apache.
> >>
> >> Someone mentioned he/she does not have any problem with W2K/IIS
> >> ISAPI/PHP4.0.3pl1 with more than 250,000 hits/day. You may want to 
> down grade
> >> your PHP to 4.0.3pl1.
> >
> > but how can I access an MS SQL database from Apache???
> > 
> > . Christian Dechery (lemming)
> > . http://www.tanamesa.com.br
> > . Gaita-L Owner / Web Developer
> >
>with PHP
>
>Apache/PHP combo will run just fine on Windows, and you should be able use
>PHP's ODBC functions to access Access databases.

sorry... I did not make myself clear. I don't intend to switch from IIS to 
Apache, cuz I can't. The server runs a whole site in ASP... this is the 
only PHP script that runs on it, I was thinking more of running it in 
Linux... can I access a MS SQL server from within Apache/PHP under Linux???

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] huge PHP file, hardcore processing

2001-04-09 Thread Christian Dechery

At 10:23 10/4/2001 +0900, you wrote:
>IIS ISAPI(PHP4.0.4pl1 and PHP4.0.5RC1) does not work well for me and too many
>problems. So I switched to Apache. However, ob_implicit_flush() seems slows
>things down on W2K/Apache/PHP4.0.4RC1 also. (ob_implicit_flush() may slow 
>things
>down, but it's more apparent than my Linux/Apache box)
>
>You may get better result on UNIX/Apache.
>
>Someone mentioned he/she does not have any problem with W2K/IIS
>ISAPI/PHP4.0.3pl1 with more than 250,000 hits/day. You may want to down grade
>your PHP to 4.0.3pl1.

but how can I access an MS SQL database from Apache???
________
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] huge PHP file, hardcore processing

2001-04-09 Thread Christian Dechery

I have a huge (at least I think, for a script anyway) PHP script... it is 
over 1.000 lines of code.
And it updates (do an entire DELETE-ALL / LOAD-ALL) an SQL Server database 
(over 35MB). It runs for over an hour (sometimes 2hs)... and I divided it 
into steps... so each step is a function in the script that when is over 
calls a javascript function that reloads the script to the next step.

I was wondering if this is enough to get a good 'memory-cleaning'. Or it 
would be better to have lots of files (in total, there are 27 separate 
steps). I began noticing some processing slowness after the first 35 
mins... it get's 'tired'. The script starts running and with 
ob_implicit_flush() on, the output is flushed almost at real time... but 
after 10 or 12 steps it starts to get slow and do NO FLUSHING at all... 
only showing the entire output at once after the whole step has ended. 
Should I split it into files? Is because it's running on (eek!) IIS? Maybe 
the size of the file is getting in the way?

Can someone help me out?

Ah... one other thing. Has anybody experienced very weird behaviours of PHP 
with IIS? Sometimes I press 'stop' at the browser but PHP is still running. 
I can see it eating up memory in the TaskManager. And it won't stop until I 
kill it. And the most weird part is, as soon as I call a script (any 
script) PHP returns to the TaskManager with the same amount of memory it 
had when it was running tha massive script mentioned above. Does IIS really 
suck, or is there something very wrong with my config?
____
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] anything wrong with php.net?

2001-04-08 Thread Christian Dechery

Is there anything wrong with www.php.net?

I can't access it for two days now...
____
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Char Problem

2001-04-07 Thread Christian Dechery

At 20:45 7/4/2001 +0200, you wrote:
>Hello... I have a problem with some special chars I created some kind of
>editor for text files but chars like " get a \ in front everytime you
>send it here is my code:
>
>
>
>
>
>
>
>
>If you just enter " and click send you see what my problem is does
>someone have a idea how to fix this???
>Thanks!


try stripslashes()...

like this


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] doubt in ob_*() functions

2001-04-05 Thread Christian Dechery

take a look at this small code:

ob_start();
echo "something";
echo "something else";  
$string=ob_get_contents();
ob_end_flush();

echo $string."";

shouldn't this be the output?

something
something else

so why it outputs this?

something
something else
something
something else
________
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] probs with session_register() solved...

2001-04-05 Thread Christian Dechery

After about 4 or 5 posts asking for help with session_register() with no 
replies I finally got my array into session vars...

I tried the manual, just not thoroughly enough in the users contribution 
section...
and there was the answer to all my problems... one single sentence "in 
order to register session vars, the MUST be global"...

this should be crucial manual information, don't u think?
____
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] ob_*() functions in Win9x

2001-04-05 Thread Christian Dechery

While struggling to get MS SQL error messages from PHP, someone here gave 
me the idea of capturing the output when executing a query and even offered 
me the code (thanks again)... I tried, the code was correct, but nothing 
happened...

I develop under Win98Me with Apache... but the script will run in Win2k 
with IIS...

does any of the ob_*() function family works under Win9x, or just in UNIX 
and Win2k/NT? Is there a reasonable explanation for this?

I see this as a real fault... means that nobody developing in Win9X 
platforms can get MS SQL error messages, or anything that needs some more 
of output handling, and not just relying on *_error() functions...

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] output buffering

2001-04-05 Thread Christian Dechery

At 00:26 5/4/2001 -0500, Plutarck wrote:
>http://www.php.net/manual/en/ref.outcontrol.php
>
>If you want to use output buffering you must use the ob_* family of
>functions.
>
>In any script where you want it used you _must_ use it explicitly, or so do
>in an included file. Unless you can change the php.ini, there is no way to
>force all pages to use output buffering. I don't reccommend you do such a
>thing anyway.
>
>If you aren't using output compression all it does is allow bad programming
>practices. One exception is for hosting companies that want to force ads to
>be displayed on the page with the auto_prepend type settings.
>
>
>Output buffering should only be used if you have a specific reason for doing
>so. Kind of like all PHP functions :)
>
>It doesn't cost much in performance except when a script pumps out a very
>large amount of data. If you want to print a 10mb text file to the browser
>it is a considerably _BAD_ idea to force PHP to buffer that all up into one
>chunk before puking it out.
>
>
>But, enter the gz_handler functions. If you want to compress your output,
>then you have a reason for using output buffering. The cost in performance
>varies widely, but if your server is already under a considerable load you
>probably shouldn't use it.
>
>But it's very cool to use if you have the extra processor power, but wait
>for 4.0.5 to do it. Many people complain about memory leaks and sub-standard
>output buffering functions. It's supposed to all be fixed in the new
>version, so feel free to play around with it :)
>
>Still, it's better to be able to set it only in the places you want it run
>rather than making all output use it.

exactly... I don't want to set this option to an entire site just because 
of one little script I'm having trouble setting a header() or 
setcookie()... and I wanna use them in the middle of the output...
something like ASP's <% response.flush=true %>, it can be set anywhere u 
want...
but of course... the best way is to code right and not to mess with headers 
once the output has started... but sometimes I wish I could, u know? It 
would really make somethings a lot simpler...

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] output buffering

2001-04-04 Thread Christian Dechery

as I saw on the manual output_buffering cannot be changed at runtime... so 
there is NO WAY? If I want output_buffering I'll have to do it on all my pages?

and does it really cost that much in performance? is it worthed?
____
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] using system() on NT/2K

2001-04-02 Thread Christian Dechery

Why does system() - or any of its cousins, I've tried them all: exec(), 
passthru(), backtick operator, etc - doesn't output anything when running 
on a Win2k/IIS5 machine?

I ran the exact same script on a WinME/Apache, and the output was perfect
____
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] problems with session_register()...

2001-04-02 Thread Christian Dechery

Why does one variable gets registered and the other don't (the order 
doesn't alter anything.. I've tried)...


$script_total_time=(float)$total_time;
session_register("script_total_time");
$step_times_array[$step]=$total_time;
$step_times=serialize($step_times_array);
//echo "step_times=\"$step_times\"";
session_register("step_times");


after that (and there are no mentions to either of those vars after that), 
these are the contents of the session-cookie:
script_total_time|d:4.8891049623489;!step_times|

step_times simply doesn't get registered...

BTW... the commented echo above outputs:
step_times="a:1:{s:8:"download";d:4.8891049623489;}"

what is wrong with my code?


. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer



[PHP] registering an array into a session (?)

2001-03-31 Thread Christian Dechery

Can somebody please help me out??
I'm going nuts...
what's wrong with this piece of code?


 if(!isset($script_total_time))
 {
 // register the session variables to keep track of 
step times
 $script_total_time=(float)$total_time;
 session_register("script_total_time");
 $step_times_array[$step]=$total_time;
 $step_times=serialize($step_times_array);
 //echo "step_times=\"$step_times\""; <- this 
echoes perfeclty
 session_register("step_times");
 }
 else
 {
 // update session variables
 $script_total_time+=(float)$total_time;
 $step_times_array=unserialize($step_times);
 $step_times_array[$step]=$total_time;
 $step_times=serialize($step_times_array);
 }


why doesn't $step_times gets registered correctly? it always register an 
empty var...

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer



[PHP] fetching MS SQL errors...

2001-03-31 Thread Christian Dechery

Has anyone successfully handled MS SQL error messages?

some articles? or code? anyone?

thanks...

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] problem loading extension

2001-03-31 Thread Christian Dechery

of course...
it's while loading apache that the error message appears...

>restart apache/php?
>
>-jack
>
>Christian Dechery wrote:
> >
> > I posted a message a while ago about having trouble loading php_mssql.dll
> > extension.
> > It gave me that error: 'can't find ...'. So I was stuppid enough to realize
> > I didn't have MS SQL 7 installed here.
> >
> > Somone here told me to download a proggie called Dependency Walker, that
> > lists all the dependencies of a DLL.
> > So I did it, and it really was missing a DLL (MS SQL).
> >
> > So I installed MS SQL 7 here, and now Dependency Walker doesn't give me any
> > error, but PHP still gives me the message and still does not load
> > php_mssql.dll. Why? MSSQL is started, working perfectly, PHP is working 
> fine...
> >
> > what may be wrong?
> > 
> > . Christian Dechery (lemming)
> > . http://www.tanamesa.com.br
> > . Gaita-L Owner / Web Developer
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]


. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] problem loading extension

2001-03-31 Thread Christian Dechery

I posted a message a while ago about having trouble loading php_mssql.dll 
extension.
It gave me that error: 'can't find ...'. So I was stuppid enough to realize 
I didn't have MS SQL 7 installed here.

Somone here told me to download a proggie called Dependency Walker, that 
lists all the dependencies of a DLL.
So I did it, and it really was missing a DLL (MS SQL).

So I installed MS SQL 7 here, and now Dependency Walker doesn't give me any 
error, but PHP still gives me the message and still does not load 
php_mssql.dll. Why? MSSQL is started, working perfectly, PHP is working fine...

what may be wrong?
________
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] MS SQL error handling...

2001-03-31 Thread Christian Dechery

At 11:58 30/3/2001 -0500, you wrote:
>Hope it helps.
>Let me know if it works for you.

well... it was in fact a great idea... but it didn't work... for some 
reason... ob_*() functions do not grab warnings and error messages 
generated by PHP... so warnings AND the error messages were lost...

maybe I didn't implement it the best way... I don't know... but I really 
tried every way I can possibly imagine, and it didn't work.


thanks anyway...
________
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] MS SQL error handling...

2001-03-30 Thread Christian Dechery

isn't there a better way to handle MS SQL error messages? I can't even 
fetch them...
look at these warnings... they only show in development side, I don't want 
warnings on the production site, so I turn them off with error_reporting()...

Warning: MS SQL message: There is already an object named 'FK_genre_genre' 
in the database. (severity 16) in 
S:\Inetpub\wwwroot\liquid\liquid_catalog_update.php on line 607

Warning: MS SQL message: Could not create constraint. See previous errors. 
(severity 16) in S:\Inetpub\wwwroot\liquid\liquid_catalog_update.php on 
line 607

Warning: MS SQL: Query failed in 
S:\Inetpub\wwwroot\liquid\liquid_catalog_update.php on line 607

Could not create constraint. See previous errors. <-- this is what I get 
from mssql_get_last_message()
MS SQL: Query failed <-- this is the content of $php_errormsg

you guys have to agree with me, that neither of them help me at all
why can't I fetch the first Warning, the one with the really interesting 
content???


[PHP] MS SQL errors...

2001-03-29 Thread Christian Dechery

why do MS SQL reports errors so poorly on PHP?

you can do anything with those errors, they're useless... and the worse 
part is the actual important part of the error is in the warning, and not 
on the contents of mssql_get_last_message(), where they should be...

and, worse... mssql_query() returns false even when they query ran ok...

I have a script that runs a lot of queries that loads several 'alter 
tables' into mssql to create FKs... for some reason when the query is run 
it generates a warning like this: " Context changed to database 'LIQUID' ", 
which is not really an error, and the query is executed... but returns 
false... I don't consider this to be a bug... but there's certainly 
something wrong about error handling in mssql_db_functions*()...
____
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] arrays in sessions, please!

2001-03-29 Thread Christian Dechery

Why I can get this to work?
I don't understand... I made another simple script that the only thing it 
did was the "build array/serialize it/register the session var/ => next 
page load unserialize it into array/update array/serialize it again".. and 
it worked like a charm...
I'm doing the exact same thing here but step_times gets registered empty... 
and script_total_time is OK...
and the weirdest part is that, when I uncomment the "echo ...", it displays 
perfectly the contents of $step_times as a string...

PLEASE?!?!?!


if(!isset($script_total_time))
{
$script_total_time=(float)$total_time;
session_register("script_total_time");
$step_times_array[$step]=(float)$total_time;
$step_times=serialize($step_times_array);
//echo "step_times=\"$step_times\"";
session_register("step_times");
}
else
{
$script_total_time+=(float)$total_time;
$step_times_array=unserialize($step_times);
$step_times_array[$step]=(float)$total_time;
$step_times=serialize($step_times_array);
}



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Sessions: what's wrong sith this code?

2001-03-28 Thread Christian Dechery

I tried to put an array into a session, but I can get it to work... here is 
my code:


if(!isset($script_total_time))
{
$script_total_time=(float)$total_time;
session_register("script_total_time");
$step_times_array[$step]=$total_time;
$step_times=serialize($step_times_array);
//echo "step_times=\"$step_times\"";
//this when not commented, echoes perfectly the string with 
the 
serialized array...
session_register("step_times");
//so why doesn't it work if $step_times is in fact a string?
}
else
{
$script_total_time+=(float)$total_time;
$step_times_array=unserialize($step_times);
$step_times_array[$step]=$total_time;
$step_times=serialize($step_times_array);
}


the variable $script_total_time works like a charm, and it also updates 
perfectly, but the step_times array simply doesn't work... I looked into 
the session-cookie-file and the step_times is set but as empty... I don't 
get what is wrong... For the record this is a code from a script which have 
several steps, all reloads of the same .php file and I want to store the 
execution times for each step (step_times) and the total running time 
(already working)...

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] array in sessions

2001-03-27 Thread Christian Dechery

How do I store (and update) an array within a session...

Like I'd have



cuz I'll have more pages...
$time["page20"]="300";

is this going to automatically load into the session vars or I have to do 
something first?
________
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




php-general@lists.php.net

2001-03-26 Thread Christian Dechery

By doing this:



is PHP using the same amount of memory as this:



because it seems to me, that the script gets a little slower when I 
introduce the function method.


. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] 'How to jump..' part 2

2001-03-26 Thread Christian Dechery


>I don't think PHP will understand commas as command separators.
>
>Perhaps what you could try is a simple loop 0 to 6 and for each iteration
>of the loop, unset the corresponding array element
>
>for($i=0; $i <= 6; $i++) {
>  unset($array[$i];
>  }

this actually worked... thanks for the hint:


 function array_sshift(&$array,$number_of_elements=1)
 {
 for($count=0;$count<$number_of_elements;$count++)
 {
 array_shift($array);
 }
 }

________
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] 'How to jump..' part 2

2001-03-26 Thread Christian Dechery


>I don't think PHP will understand commas as command separators.
>
>Perhaps what you could try is a simple loop 0 to 6 and for each iteration
>of the loop, unset the corresponding array element
>
>for($i=0; $i <= 6; $i++) {
>  unset($array[$i];
>  }

I got it working, and YES... PHP did understand the commas as separators 
just like in C...

so what I have now is

for(reset($array),$count=0;$count<7;array_shift($array),$count++);
//this removes the 7 top elements of an array...

I wonder if I did a function like array_sshift(&$array,$number_of_elements) 
it would work fine... I'll try...

but thanks anyway... :)

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] 'How to jump..' part 2

2001-03-25 Thread Christian Dechery

Regarding my last email (about jumping the first 7 rows of an array)...

why does this code doesnt work?

for(reset($array),$count=0;$count<6;next($array),$count++);

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] How to jump 7 rows in array

2001-03-25 Thread Christian Dechery

I'm loading a set of txt files into a DB. The first 7 lines of each file 
are useless to me...
I want some way I can always jump those 7 lines... I tought of doing a 
little function like jumpfirstsevenrows(array), but then I'd have to pass 
the whole array as parameter and that can get real memory consuming for 
such a small task. I'll have arrays with more than 100.000 lines...

since there are pointers in PHP, I'm lost... I don't wanna have to get the 
same 'for bla bla bla code' in each and every function that processes this 
file (there is one function per file, more then 20 overall)...
________
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] getting numeric index of array

2001-03-25 Thread Christian Dechery

I wanna get the numeric index for a multi-dimensional associative array...

I have like

$myArray = array(
"one" => "something",
"two" => "otherthing",
"three" => "whatever"
);

I want to, given the key (or value), it returns me the numeric index for 
that ocurrence... examples:

given "one" -> returns 0
given "whatever" -> returns 2
given "two" -> returns 1
given "four" -> returns NULL or false...

anyone?

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] huge time/memory consuming script

2001-03-25 Thread Christian Dechery

I'm thinking about building a PHP script that loads an entire database on a 
weekly basis, based on a text catalog.

The reason I'm doing it, it's because the catalog is too generic and has 
lots off stuff to be done in it (such as lots of string replacements and 
'fixing') before I can really parse it and create the insert statements.

The doubt I have is this: it's kinda of BIG catalog, I'm talking about more 
than 20MB of text files, and I have to 'clean' the whole DB and load it 
entirely again (I don't make the rules, this is how it works)...
I'm worried about the time it will take and the memory it'll cost, so I was 
thinking of a step-by-step solution, like break the process into several 
'steps' that of course would be carried out automatically.

Like I'd have


So... just by reloading the page, I get a good 'memory cleaning' so I can 
be sure everything is going to get carried out??... there are steps that 
I'm worried about taking over 30min to finish, like loading the main table 
with 140.000 rows...

thanks...

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] executables (.exe)

2001-03-22 Thread Christian Dechery

At 18:18 21/3/2001 -0800, you wrote:
>If you're on windows, (which i'm assuming you are) you can call the PHP
>binary with the path to your php script...
>
>so (assuming you have C:\php\bin\ as part of your PATH enviromental
>variables for windows) you could do PHP C:\path\to\php-script.php and it
>will run on the command line...or just give the full path to the php.exe
>file...
>
>C:\php\bin\php.exe C:\path\to\php-script.php

oh okay... I was thinking more of a standalone file like php-script.exe... 
but that should work as well...
Thanks!
________
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] executables (.exe)

2001-03-21 Thread Christian Dechery

Correct me if I'm completely out of my mind here (often I am).

But I think, I read somewhere that u can compile .php files and make 
executables of them to run in the command line like programs... is this 
true? How can I get it to work? WHat do I need?
____
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] include virtual, file or exec cgi?

2001-03-21 Thread Christian Dechery


>this will work, however:
>
>
>
>
>
>  

that is the problem... THIS is not working...
I have my html file like this:

index.shtml



... stuff...




and it's not working... there are 4 "include virtual"'s on this page... 
this would be the 5th... all of them work,why not this one?
____
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] include virtual, file or exec cgi?

2001-03-21 Thread Christian Dechery


>You could just do a rename *.shtml *.php under
>DOS or UNIX or cp *.shtml ./*.php then
>use some sort of regex program/function to replace
>the internal links.

I'm not willing to change my entire site (which have over 3.000 html files) 
just because PHP can't do something... I'd rather work something out in 
Perl or C...
________
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] include virtual, file or exec cgi?

2001-03-21 Thread Christian Dechery

>When I first started playing with PHP I had been using SSI's.  I tried
to
>find a way that I could get a file that contained SSI's and php to be
>parsed, but I haven't seen it done.  In Apache it seems like it would be
>as
>easy as adding a handler that parses shtml files as php files, but that
>causes the SSI and/or the PHP parser not to run.

so... what you're saying is that I can't have a PHP file <#--include-->'ed
in a regular server parsed html file? it doesn't work?
I can have included C and Perl stuff but not PHP?

Well I gotta tell ya, that sucks! :(


. [ Christian Dechery  ]
. Webdeveloper @ Tá Na Mesa!
. Listmaster @ Gaita-L
. http://www.tanamesa.com.br



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] include virtual, file or exec cgi?

2001-03-21 Thread Christian Dechery

>you won't be able to use $PHP_SELF, and you will encounter problems with
>passing values via the querystring, but other than that you can use SSI
>to
>call a PHP page.

I don't really need any of this, the script is a simple 15-lines-of-code
image randomizer that shows a random image from a list. It couldn't be simpler,
but in C it's much more code to write.

So why isn't SSI working with my PHP file? SHould it have chmod 755 or be
in a cgi directory or something like that? I tried everything...

does it make any difference if PHP runs as a DSO module or CGI for me to
use SSI??



. [ Christian Dechery  ]
. Webdeveloper @ Tá Na Mesa!
. Listmaster @ Gaita-L
. http://www.tanamesa.com.br



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] include virtual, file or exec cgi?

2001-03-21 Thread Christian Dechery

>Is there a reason you not using PHP's include method
>to do this?
>Rename your shtml file to have a PHP extension, replace
>the SSI instructions with PHP functions. You should
>be good to go.

I don't wanna rename all my shtml files (which are a LOT) and change all
my links to .php in files like this that processess nothing only run a few
"includes" (all built in C)...

but I'd like to be able now to run PHP made stuff... can't I?




. [ Christian Dechery  ]
. Webdeveloper @ Tá Na Mesa!
. Listmaster @ Gaita-L
. http://www.tanamesa.com.br



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] include virtual, file or exec cgi?

2001-03-21 Thread Christian Dechery

Can't I

 or
 or
 ???

I'm trying to, the script works fine if I load it normally, but as an include
in a shtml (server parsed) file it always returns "error ocurred bla bla
bla".

What am I doing wrong?


. [ Christian Dechery  ]
. Webdeveloper @ Tá Na Mesa!
. Listmaster @ Gaita-L
. http://www.tanamesa.com.br



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] switch with multiple case

2001-03-14 Thread Christian Dechery

In ASP, you can have something like:


<%
select case something
case "this" do that
case "those","them" do other
case "crap","doesn't matter","whatever" do nothing
case else print error
end select
%>


IN PHP you can't do cases like that, because like in C, u must have a 
constant, not a list of them.
Is there anyway to get pass this? Doing a case for each thing even tough it 
does the exact same thing as 10 others is going to get a little stupid code.

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] DSO x CGI

2001-03-14 Thread Christian Dechery

What are the main differences of running PHP as a DSO Module or as CGI?

I had some problems running as DSO, cuz I need the mssq70 extension and 
everytime I ran a script it caused a GPF in php4ts.dll. So I switched back 
to CGI and the error disapeared.

I wanna know if I'm loosing something with CGI.
____
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] DSO x CGI

2001-03-12 Thread Christian Dechery

What are the main differences of running PHP as a DSO Module or as CGI?

I had some problems running as DSO, cuz I need the mssq70 extension and 
everytime I ran a script it caused a GPF in php4ts.dll. So I switched back 
to CGI and the error disapeared.

I wanna know if I'm loosing something with CGI.
____
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] php4ts.dll error

2001-03-09 Thread Christian Dechery

I'm working with WinMe with apache 1.3.9 and PHP 4.04 now. And it allways
worked perfectly...

when I had to use the extension php_mssql70.dll, I went into php.ini changed
some stuff and everything went ok, but now... everytime I run a script (whether
I use mssql's functions or not) it runs and when it stops it comes up with
a GPF window for PHP4TS.DLL telling me that Apache caused, so it restarts
apache.

What might be causing this? How can I fix it?


. [ Christian Dechery  ]
. Webdeveloper @ Tá Na Mesa!
. Listmaster @ Gaita-L
. http://www.tanamesa.com.br



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] in_array() with multidimensional array

2001-03-09 Thread Christian Dechery

How can I check if a value is in a multidimensional array?

like I have

";
$produtos_sem_tracking[$i]['cod']=$idt[0];
$produtos_sem_tracking[$i]['idt']=$idt[1];
$produtos_sem_tracking[$i]['gen']=$idt[2];
}
?>

how can I check for an existing $produtos_sem_tracking['cod'] value for
example?


. [ Christian Dechery  ]
. Webdeveloper @ Tá Na Mesa!
. Listmaster @ Gaita-L
. http://www.tanamesa.com.br



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] can't load extension

2001-03-08 Thread Christian Dechery

I had Apache 1.3.12 here with php 4.0.3 and all was working fine.

I decided to upgrade to 1.3.17 and all came down, I spent hours bringing it 
all back... when I finally did it, there's still something that WON'T work...

I can't load php_mssql70.dll... it simply does not load. I've set 
extenstion_dir (php.ini) correctly (I tried every combination possible : 
"c:\php4\extensions", "c:\php4\extensions\", "c:/php4/extensions", 
"c:/php4/extensions/", and all of those without qutoes). The file is there, 
were it always was... why does it gives me that error msg (in the log):

"PHP Warning:  Unable to load dynamic library 
'c:/php4/extensions/php_mssql70.dll' - Não é possível encontrar um dos 
arquivos de biblioteca necessário para executar esse aplicativo. 
(translating: Can't find one of the library files needed to run this 
application [something like that, doesn't really matter])

  in Unknown on line 0"

why? why? whyy?


. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer



[PHP] connecting do MS Access...

2001-03-04 Thread Christian Dechery

which is the best way to connect to MS Access and process and request queries?
is it with odbc_*() functions? cuz I found that not that good...

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] user_error() default error type

2001-02-28 Thread Christian Dechery

Can't I change the default value for error type in user_error or trigger_error?

I wanted to echo an error everytime a query failed because of syntax errors 
so I'd to something like:

$q="select * from bogustable";
mysql_query($q) or trigger_error(mysql_error()." in ".$q,E_USER_ERROR);
-> ^^^
kinda BIG don't u think?


this would do exactly what I need when an query fails cuz of syntax error:
- echoes the error, the query and the line of code
- stop the execution of the script

I NEED all of those, and that E_USER_ERROR in every call is making that 
function call get huge. Isn't there a way I can't default it to that 
instead of E_USER_NOTICE (which doesn't really help)...

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] redefine constants

2001-02-28 Thread Christian Dechery

why can't I redefine __LINE__?

like define(LN,__LINE__);

it's a rather big constant to put in code to generate my error messages, I 
was thinking more of L, or LN... but if I redefine it, it assumes the value 
of de redefine() line of code... so it's not really redefining a constant 
it's only atributing LN the value of __LINE__...

and in the manual I saw examples where redefining constants were used...
________
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Caller's __LINE__

2001-02-28 Thread Christian Dechery


>Pass __LINE__ to the function as one of its arguments:
>
>  function debuginfo($msg, __LINE__)
>   {
>echo"the message is $msg, at line" . __LINE__ . " ";
>   }

that won't work since __LINE__ returns the exact line where it's used... so 
it will always show the line of the function header...

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] running a big sql script

2001-02-19 Thread Christian Dechery

I have a complex query, that because of mysql's lack of resources became 
twice as big and complex.

I had to create a temporary table and put stuff in it and then select data 
from it, cuz 'union' is not available...


but I can't execute the whole script once, can I?

like

$sql="create temporary table tmp; insert into tmp select bla bla bla; ";
$sql.="insert into tmp select bla bla; select * from tmp;";

I cant mysql_query($sql)... it gives me an error msg? Do I really have to 
run each step of the script as a separated query
____
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] better (cleaner and smaller) code

2001-02-19 Thread Christian Dechery

To handle sql syntax errors (including, the query, the Line number of the 
code and possibly the file name) I came up with this...

define(LN,__LINE__);

$query="bogus query to cause error";
$rslt=mysql_query($query) or query_error(LN,$query);  (*)
this one works fine but I have to pass __LINE__ (LN) as an argument... and 
I don't like that...
(*)

function query_error($line,$query="unspecified)
{
 $errstr="SQL Error: 
'$query' failed at line $line\n";
 $errstr.=mysql_errno()." : ".mysql_error()."";
 die($errstr);
}

or

$rslt=mysql_query($query) or user_error(mysql_error()." at 
'$query'",E_USER_ERROR);
works fine too, gives me the filename, the line and handles the error more 
PHP-likely... but still it's a huge function call to EVERY single query...

I want to write at least code as possible and get the error, the query, the 
line number and (possibly) the filename..

isn't there anyway I could build a mask for a function or something like 
that to pass __LINE__ as an argument always.. I don't know... any ideas?


. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer



[PHP] the best so far

2001-02-15 Thread Christian Dechery

this is the best I got so far, for treating any sql syntax errors as normal 
ERROrs and halting the parsing to report it.

like:

SQL Syntax Error: 
'$query'\n";
$msg.="[".mysql_errno()."]" 
".mysql_error()."at $errline";
die($msg);
}

?>

anyone has a 'less-code' idea?
I wanted a smaller code on the calls to qerr(), I'd really like to call a 1 
parameter (just the query) function and print the error_msg and the line of 
code (the trickiest)...
is there anyway I can define something as a mask for a function or 
something? I don't know... just having crazy ideas...
this is pretty good as it is.. I just wanted even better...

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] need better solution

2001-02-14 Thread Christian Dechery

At 19:53 14/2/2001 +0100, Christian Reiniger wrote:
>On Wednesday 14 February 2001 18:43, Christian Dechery wrote:
> > that's kinda what I have here... but the line of code isn't being
> > shown... and that is the problem... I for one, think that in an error
> > message the line of code is crucial.
>
>Check the manual for set_error_handler ()

well... that could help, but even than I'd have to call that error_handler 
everytime I execd a query and still would have to pass to it the __LINE__ 
of code...

so, I'd wouldn't exactly help...

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] need better solution

2001-02-14 Thread Christian Dechery

>works for me, just call it. change it to better match yours if you like.
>
> function check_db($query = 'Unavailble')
> {
>  global $store_db;
>  if ( mysql_errno() )
>{
>  echo "Error: Problem with DataBase : $store_db\n";
>  echo "Error: " . mysql_errno() . ':' . mysql_error() . "\n";
>  echo "Query: $query\n";
>  exit();
>}
> }

that's kinda what I have here... but the line of code isn't being shown...
and that is the problem... I for one, think that in an error message the
line of code is crucial.



. [ Christian Dechery  ]
. Webdeveloper @ Tá Na Mesa!
. Listmaster @ Gaita-L
. http://www.tanamesa.com.br



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] need better solution

2001-02-14 Thread Christian Dechery

I need a better solution for reporting SQL errors.

I'm used to work with ASP, and whenever a query has a syntax error, it stops
the script and reports the error as if it was a compile error. This is very
usefull, but int PHP it doesn't work like that, I know.

I came with a function query_error() that I call after each query, that
prints out the query, the error and the line... so I need to call it like
this.

if(!$rs) query_error($query,__LINE__);

but having to writ this down after EVERY single query, along with the __LINE__
thing can get very boring, does anyone has a better solution?


. [ Christian Dechery  ]
. Webdeveloper @ Tá Na Mesa!
. Listmaster @ Gaita-L
. http://www.tanamesa.com.br



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP globals aren't really globals

2001-02-14 Thread Christian Dechery


>The idea is to avoid really nasty scope-related bugs that are common in
>C
>code that uses lots of global variables.  Years and years ago when I wrote
>the first version of PHP I was working for a telco writing software for
>a
>large telephone switch.  The code was huge and extremely ugly.  Global
>variables everywhere.  The team had been chasing a bug for about a week
>when I got stubborn and decided it was time to kill the bug.  I printed
>out all the source code and laid it out in a long hallway as I crawled
>along with different coloured pens and manually traced my way through it
>as none of the debuggers we had at the time were of any use.  After
>countless hours the bug turned out to be inside a function that silently
>modified a global variable which affected another piece of code in a
>completely different part of the program.
>
>I swore I would not have the same problem in PHP and thus the requirement
>for people to be explicit about using global variables inside functions.
>Hopefully it also forces a little bit of structure and organization on
>people.

thanks...
now I have an answer I can swallow... cuz I simply didn't get why PHP (which
came from C) had a differente behaviour according to globals.
I never had any problem handling them, but in the other hand I never had
50 of them in a program.
I can understand that making global every single form variable would take
a whole lot of control by the compiler...

I just came with a nice foreach() to make my globals local, and I have to
put them in ALL my functions that handles form vars... I'll consider using
arrays in my next forms

but hey, don't worry... PHP really kicks ASP ass in all matters! :)

cya


. [ Christian Dechery  ]
. Webdeveloper @ Tá Na Mesa!
. Listmaster @ Gaita-L
. http://www.tanamesa.com.br



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] PHP globals aren't really globals

2001-02-14 Thread Christian Dechery

>> function u want to use it. THis is not nice, what about if u
>> have a form with 50 fields and want a function to validate
>> all of them, u have to pass them all to the function or build
>> a little piece of code to make all the $GLOBALS local right?
>> Is this really the idea of global vars?
>
>Yes.  But with regards to form variables, all you need to do is
>make one variable global:
>
>$HTTP_POST_VARS
>
>it is an associative array that contains all the post variables from
>the form.  Make it global and just loop through it.

exactly, u need to loop to an array to get the globals u want.
this is not the idea of global, global is global... if it's set outside
of ALL functions it should be available 'with no extra code' to ALL functions,
it works that way in all programming language I'm familiar with... why not
in PHP? that's what I wanna know, why globals in PHP doesn't really work
like globals?


. [ Christian Dechery  ]
. Webdeveloper @ Tá Na Mesa!
. Listmaster @ Gaita-L
. http://www.tanamesa.com.br



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] PHP globals aren't really globals

2001-02-14 Thread Christian Dechery

I've been programming in C all my life, and now I just started developing
in PHP and I'm really enjoying it, it has all the missing improvements that
C needed to be more user-likely.

But one thin I can't get, how can PHP call a variabel global, if it isn't
global.
A global var, is a var defined outside all functions and it's available
to all and altered by all, without having to redefine or call the var again.

In PHP, for a var to be global you have to add a 'global $var' inside the
function u want to use it. THis is not nice, what about if u have a form
with 50 fields and want a function to validate all of them, u have to pass
them all to the function or build a little piece of code to make all th
$GLOBALS local right?

Is this really the idea of global vars?


. [ Christian Dechery  ]
. Webdeveloper @ Tá Na Mesa!
. Listmaster @ Gaita-L
. http://www.tanamesa.com.br



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] mysql_error() not really helping

2001-02-14 Thread Christian Dechery

>Christian -
>
>You need to be checking the return values of the mysql_*() functions. Make
>sure you're not calling them with a @mysql_*() as that will disable error
>reporting.
>
>Perhaps you should give us some examples of what's failing and how?
>
>Also, if the server isn't yours the server admin may have turnd down the
>level of error reporting in php so errors never even show up. See
>http://www.php.net/manual/en/configuration.php and look at display_errors
>and
>error_reporting then check your server settings with phpinfo().

the server is local, I'm running it (apache 1.3.12)...
I set the error_reporting to the default in php.ini, I even set error_reporting(E_ALL),
but all I got were warnings about every thing PHP did, nothing MySQL related...
but nevermind, I've already fixed me a function that I call EVERY query
I run (altough I find this very annoying) that tells me when there's a sql
syntax error...

thanks



. [ Christian Dechery  ]
. Webdeveloper @ Tá Na Mesa!
. Listmaster @ Gaita-L
. http://www.tanamesa.com.br



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] mysql_error() not really helping

2001-02-13 Thread Christian Dechery

I'm having a little trouble here developing and running queries.

I spent some time developing in ASP, and whenever there was something wrong 
with a query, the script halted, and the error message - from ODBC, tye sql 
syntax error - was printed along with the line of code.

In PHP that's not how it goes, it doesn't tell me when theres an error with 
a mysql_query unless I place a call to mysql_error() after each executed 
query right?

That's exactly what I'm doing, but again, it doesn't do all I want, cuz it 
doesn't tell me the line of code, and I don't know where is the error, 
unless I start printing everything on error handling.
____
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re:LOCK TABLES x COMMIT/ROLLBACK

2001-02-13 Thread Christian Dechery

At 11:51 14/2/2001 +1300, Phil Daintree wrote:
>This also troubles me i have read and read the docs on this. It seems that 
>Lock tables
>prevents other threads interfering with your transaction  your inserts 
>will not be
>compromised by another thread deleting or updating data inconsistent with 
>your SQL. The
>snag for me is that all obscure input from the user and every other 
>eventuality has to be
>trapped prior to avoid sending dud SQL to MySQL, other wise the 
>inserts/updates will fail.
>The TO DO list talks about atomic inserts/updates which would solve my 
>problems ie they
>all happen or all do NOT happen. If MySQL can do this then I don't care 
>about rollback. I
>would dearly like to use the fast tables rather than compromise speed 
>using DBD tables but
>as I see it we are stuck with them or Postgres until the atomic updates 
>code is completed.
>
>Be interested to know if anyone has got atomic updates sorted.

tomorrow I'll try to compile BDB, in my Win9x... and get it to work... if 
it does REAL transaction than I can develop nicely with mysql... I'll let u 
know...

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] checkboxes and arrays

2001-02-13 Thread Christian Dechery


>$num_inputs = 5; // if you want 5 sets of checkboxes and text inputs.
>
>for ( $i = 0; $i < $num_inputs; $i++ )
> {
> echo "Cb $i name=text[$i]>\n";
> }

yeah... that can work, I think it's a little less messy than what I've 
done... I did it like this:

for each checkbox I did
echo " Cb1 ";

then I check if isset(${"asset_".$id}) in my code... it's working fine... 
but it's kinda 'dirty'... I'll try yours... thanks! :)

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] LOCK TABLES x COMMIT/ROLLBACK

2001-02-12 Thread Christian Dechery

can someone explain me how to use LOCK TABLES to subtitute transactions?

I don't seem to get how this is possible... and I really need this... I 
have a script that updates 4 tables at a time, and I have to be sure all of 
them are updated, or NONE... I can only see this possible using 
commit/rollback...

thanks...
____
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] checkboxes and arrays

2001-02-12 Thread Christian Dechery

How can I associate a list of checkboxes to a list of texfields?

if I had only several checkboxes I'd have:
Cb1
Cb2 ... etc...

but what if have:
Cb1 Cb2 http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] transactions

2001-02-11 Thread Christian Dechery

Hi,

I was reading mysql's manual, about transactions and all... and I didn't 
find what they said about 'atomic operations' being as safe as transactions.
I couldn't figure out HOW to update 5 tables at a time ENSURING that ALL 
will be update or NONE. How can this be done without transactions? With 
code? I don't think so...

can anyone clear my mind here...
I have this problem... I need to update 4 tables at once, and if something 
goes wrong I have to UNDO everything
________
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] mysql auto-increment

2001-02-11 Thread Christian Dechery

does mysql auto_increment always has to be 1 by 1, can't I set it to go 10 
by 10, or something like that?

and is there a way I can tell him to START (the first record) with a number 
or do I have to put a bogus record or even alter it's value so the next 
insertion is incremented from that...
____
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] afraid !

2001-02-11 Thread Christian Dechery

At 19:17 11/2/2001 +, you wrote:
>Hi!
>i've just joined ur mailing list!
>i used to work on asp with oracle and access!
>i'm working on windont NT but i want to publish my site at a provider that 
>has linux? do i have to change my code for that ?
>do u know any provider that accepts acces and mysql with php4?
>i'm afraid of using mysql with php cause i'm in hurry and that i 
>discovered that mysql interface is not as good and easy as of oracle and 
>access! is it true that if i want to insert data to a table i have to do 
>it from the commend line?

not really... there are many very nice Mysql clients avaliable... Mascon 
for once is very nice
and u can also put together or own PHP form to populate the tables... :)


. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] checkbocks, arrays and more

2001-02-11 Thread Christian Dechery

PLease... I need some help from u gurus on this.

I have a table of gas stations (and a whole lot other tables, for stuff 
connected to them), and I have a table with 'assets' of each of these gas 
stations (or other stuff)... so I have to make a form so when inserting the 
user can select with of these assets it has, but also, he may add a comment 
to each of the assets, example:

my table of assets contains:

coke machine
vending machine
atm
dinner
public phone

and someone is inserting a gas station there... and it has two dinners and 
3 public phones, so he would check the checkboxes referring to these and 
add a little comment to show the number... right?

but how can I pass this to the next page so I can insert in the tables?
if I only had the checkboxes, it'd be easy like:

 <== for each of them... but how can I 
add the input type text next to each of the checkboxes and make them 
referrable?
____
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] mysql default cfg

2001-02-09 Thread Christian Dechery

Isn't default config for mysql to report syntax errors on queries and stuff 
like that??... it always did, I never altered any config in mysql. And then 
today it just STOPPED reporting errors.
_____
. Christian Dechery - Webdeveloper
.. Diretor de Tecnologia @ Webstyle!
.. http://www.webstyle.com.br
.. http://www.tanamesa.com.br


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] mysql not reporting errors

2001-02-09 Thread Christian Dechery

At 15:42 9/2/2001 +0100, Dominick Vansevenant wrote:
>Try to put this immediately after the mysql_query:
>
>echo mysql_errno().": ".mysql_error()."";
>
>I think this outputs your error.

yeah, I know that... but it used to report automatically... and this is 
kinda stupid don't u think? there's no way someone can code having to stop 
at every query line of code to see if there was an mysql_error()
_____
. Christian Dechery - Webdeveloper
.. Diretor de Tecnologia @ Webstyle!
.. http://www.webstyle.com.br
.. http://www.tanamesa.com.br


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] mysql not reporting errors

2001-02-09 Thread Christian Dechery

WHy PHP is not showing SQL syntax (or any) errors?

I'm using Win98Me with Apache 1.3.12 and PHP 4.x.

it works... if I run a correct query it runs normally, but if I go like:

$query="selct nonexistingfield from nonexistingtable with all crazy syntax";
mysql_query($query);

it doesn't tell me there's an error... in fact it doesn't show anything... 
why is that?
_________
. Christian Dechery - Webdeveloper
.. Diretor de Tecnologia @ Webstyle!
.. http://www.webstyle.com.br
.. http://www.tanamesa.com.br


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




<    1   2