RE: [PHP-DB] get the record id of the last addition in a table

2001-11-27 Thread matt stewart

$last_add = mysql_insert_id();
- thanks to Bruno Gimenes Pereti who answered this very same question when i
asked it a couple of weeks ago ;)

all the best,
  Matt


-Original Message-
From: LeTortorec, Jean-Louis [mailto:[EMAIL PROTECTED]]
Sent: 26 November 2001 22:22
To: '[EMAIL PROTECTED]'
Subject: [PHP-DB] get the record id of the last addition in a table


Hi:
 
I've created a table. The fields are "id" (auto-increment, integer),
"field1","field2),...
 
When I do "insert into mytable (field1..) values (...)", how to get in
return the value of "id"?
 
Thanks
 
 
 
Jean-Louis

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.295 / Virus Database: 159 - Release Date: 01/11/01
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.295 / Virus Database: 159 - Release Date: 01/11/01
 

-- 
PHP Database 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-DB] get the record id of the last addition in a table

2001-11-27 Thread biorn

If you don't necessarily want to know what the next id should be and just 
want it inserted for the next item added to the database, when you do the 
insert statement, use '' as the value for that field.



matt stewart <[EMAIL PROTECTED]> said:

> $last_add = mysql_insert_id();
> - thanks to Bruno Gimenes Pereti who answered this very same question when i
> asked it a couple of weeks ago ;)
> 
> all the best,
>   Matt
> 
> 
> -Original Message-
> From: LeTortorec, Jean-Louis [mailto:[EMAIL PROTECTED]]
> Sent: 26 November 2001 22:22
> To: '[EMAIL PROTECTED]'
> Subject: [PHP-DB] get the record id of the last addition in a table
> 
> 
> Hi:
>  
> I've created a table. The fields are "id" (auto-increment, integer),
> "field1","field2),...
>  
> When I do "insert into mytable (field1..) values (...)", how to get in
> return the value of "id"?
>  
> Thanks
>  
>  
>  
> Jean-Louis
> 
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.295 / Virus Database: 159 - Release Date: 01/11/01
>  
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.295 / Virus Database: 159 - Release Date: 01/11/01
>  
> 
> -- 
> PHP Database 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 Database 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-DB] problems in connecting Access database

2001-11-27 Thread Andrew Hill

Mihail,


> >$conn = odbc_connect( 'test' , ' ', ' ' );
> >
> >where test is the name of that database, then the output is smth. like
> >
> >Warning: SQL error: [Microsoft][ODBC Driver Manager] Data source name not
> >found and no default driver specified, SQL state IM002 in SQLConnect in
> >c:\inetpub\wwwroot\test.php on line 11

Miles is correct with regards to using a System DSN.
Other things that can cause that error include mispelling the DSN name, etc.
but you don't appear to be using a DSN yet.
Create one in the ODBC Administrator (the ODBC Driver Manager) using the MS
Driver for Access and you should be all set.

Best regards,
Andrew Hill
Director of Technology Evangelism
OpenLink Software  http://www.openlinksw.com
Universal Data Access & Data Integration Technology Providers




-- 
PHP Database 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-DB] gzip image files

2001-11-27 Thread Keith Whyman

I create a png dynamically - store the path in mysql.

And want to be able to offer the user a zipped version to download
Unfortunately haven't been able to get it to work up until now !
I'm sure it's something obvious but...


Open the png
$data = fopen('kunden/'.$name.'.png', "rb");
encode it
$gzdata = gzencode($data);
where to write
$fp = fopen('kunden/zip/'.$name.'.gz', "w");
write it
fwrite($fp, $gzdata);
fclose($fp);

what happens is the name gets included in the gz but written to it is only
kunden/example.png

Can anyone help ??

thanks in advance
regards
keith


-- 
PHP Database 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-DB] Newbie help with cookies/sessions

2001-11-27 Thread Kevin Ruiz

I'm new to the PHP and Mysql world and I hope I have an problem that can be
answered quickly.  It seems simple but who knows.

Whenever I try to use cookies or start a session I get the following error:

Warning: open(/Temp\sess_ba759cb3d78fadb70745ca480f1d8661, O_RDWR)
failed: m (2) in Unknown on line 0
Warning: Failed to write session data (files). Please verify that
the current setting of session.save_path is correct (/Temp) in Unknown on
line 0

I tried checking the session.save_path setting the php.ini but I'm not sure
if this has to saved to a specific directory or just a valid directory.

Any help would be greatly appreciated.

Thank you.
Kevin



-- 
PHP Database 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-DB] gzip image files

2001-11-27 Thread Andrey Hristov

Yes, it is.
the return value of fopen is a resource of type file.
var_dump($data); will show that
if you want to read the data use : fread($data,$buf);

but I think its better with file() function. The example from the docs show a better 
method:


Regards,
Andrey Hristov
IcyGEN Corporation
http://www.icygen.com
BALANCED SOLUTIONS


- Original Message - 
From: "Keith Whyman" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 27, 2001 4:23 PM
Subject: [PHP-DB] gzip image files


> I create a png dynamically - store the path in mysql.
> 
> And want to be able to offer the user a zipped version to download
> Unfortunately haven't been able to get it to work up until now !
> I'm sure it's something obvious but...
> 
> 
> Open the png
> $data = fopen('kunden/'.$name.'.png', "rb");
> encode it
> $gzdata = gzencode($data);
> where to write
> $fp = fopen('kunden/zip/'.$name.'.gz', "w");
> write it
> fwrite($fp, $gzdata);
> fclose($fp);
> 
> what happens is the name gets included in the gz but written to it is only
> kunden/example.png
> 
> Can anyone help ??
> 
> thanks in advance
> regards
> keith
> 
> 
> -- 
> PHP Database 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 Database 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-DB] Newbie help with cookies/sessions

2001-11-27 Thread Andrey Hristov

Probably you are using windows. In the php.ini there is a setting where session files 
have to be stored. The default is /tmp
which under windows is relative to the current drive where is php installed. I see 
that you changed this parameter. I think that
there is no such directory /Temp on the drive where PHP resides(create it). Check for 
that. 

Best regards,
Andrey Hristov
IcyGEN Corporation
http://www.icygen.com
BALANCED SOLUTIONS

- Original Message - 
From: "Kevin Ruiz" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 27, 2001 4:32 PM
Subject: [PHP-DB] Newbie help with cookies/sessions


> I'm new to the PHP and Mysql world and I hope I have an problem that can be
> answered quickly.  It seems simple but who knows.
> 
> Whenever I try to use cookies or start a session I get the following error:
> 
> Warning: open(/Temp\sess_ba759cb3d78fadb70745ca480f1d8661, O_RDWR)
> failed: m (2) in Unknown on line 0
> Warning: Failed to write session data (files). Please verify that
> the current setting of session.save_path is correct (/Temp) in Unknown on
> line 0
> 
> I tried checking the session.save_path setting the php.ini but I'm not sure
> if this has to saved to a specific directory or just a valid directory.
> 
> Any help would be greatly appreciated.
> 
> Thank you.
> Kevin
> 
> 
> 
> -- 
> PHP Database 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 Database 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]




Fw: [PHP-DB] gzip image files

2001-11-27 Thread Keith Whyman




yep tried that one ! :-))
it just writes 1 in the gz file ???
>
>
> > Yes, it is.
> > the return value of fopen is a resource of type file.
> > var_dump($data); will show that
> > if you want to read the data use : fread($data,$buf);
> >
> > but I think its better with file() function. The example from the docs
> show a better method:
> >  > $data = implode("", "bigfile.txt");
> > $gzdata = gzencode($data, 9);
> > $fp = fopen("bigfile.txt.gz", "w");
> > fwrite($fp, $gzdata);
> > fclose($fp);
> > ?>
> >
> > Regards,
> > Andrey Hristov
> > IcyGEN Corporation
> > http://www.icygen.com
> > BALANCED SOLUTIONS
> >
> >
> > - Original Message -
> > From: "Keith Whyman" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Tuesday, November 27, 2001 4:23 PM
> > Subject: [PHP-DB] gzip image files
> >
> >
> > > I create a png dynamically - store the path in mysql.
> > >
> > > And want to be able to offer the user a zipped version to download
> > > Unfortunately haven't been able to get it to work up until now !
> > > I'm sure it's something obvious but...
> > >
> > >
> > > Open the png
> > > $data = fopen('kunden/'.$name.'.png', "rb");
> > > encode it
> > > $gzdata = gzencode($data);
> > > where to write
> > > $fp = fopen('kunden/zip/'.$name.'.gz', "w");
> > > write it
> > > fwrite($fp, $gzdata);
> > > fclose($fp);
> > >
> > > what happens is the name gets included in the gz but written to it is
> only
> > > kunden/example.png
> > >
> > > Can anyone help ??
> > >
> > > thanks in advance
> > > regards
> > > keith
> > >
> > >
> > > --
> > > PHP Database 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 Database 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 Database 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-DB] gzip image files

2001-11-27 Thread Keith Whyman

and if i use

$filename = 'kunden/'.$name.'.png';
$data = fopen($filename, "r");
$contents = fread($data, filesize($filename));
fclose($data);
$gzdata = gzencode($data);
$fp = fopen('kunden/zip/'.$name.'.gz', "w");
fwrite($fp, $gzdata);
fclose($fp);

it writes in the gz file this
Resource id #3



> Yes, it is.
> the return value of fopen is a resource of type file.
> var_dump($data); will show that
> if you want to read the data use : fread($data,$buf);
>
> but I think its better with file() function. The example from the docs
show a better method:
>  $data = implode("", "bigfile.txt");
> $gzdata = gzencode($data, 9);
> $fp = fopen("bigfile.txt.gz", "w");
> fwrite($fp, $gzdata);
> fclose($fp);
> ?>
>
> Regards,
> Andrey Hristov
> IcyGEN Corporation
> http://www.icygen.com
> BALANCED SOLUTIONS
>
>
> - Original Message -
> From: "Keith Whyman" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, November 27, 2001 4:23 PM
> Subject: [PHP-DB] gzip image files
>
>
> > I create a png dynamically - store the path in mysql.
> >
> > And want to be able to offer the user a zipped version to download
> > Unfortunately haven't been able to get it to work up until now !
> > I'm sure it's something obvious but...
> >
> >
> > Open the png
> > $data = fopen('kunden/'.$name.'.png', "rb");
> > encode it
> > $gzdata = gzencode($data);
> > where to write
> > $fp = fopen('kunden/zip/'.$name.'.gz', "w");
> > write it
> > fwrite($fp, $gzdata);
> > fclose($fp);
> >
> > what happens is the name gets included in the gz but written to it is
only
> > kunden/example.png
> >
> > Can anyone help ??
> >
> > thanks in advance
> > regards
> > keith
> >
> >
> > --
> > PHP Database 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 Database 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 Database 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-DB] What software do I need in order to access Oracle database on an NT server from my unix machine?

2001-11-27 Thread lallous

Hello.

I have a unix box which doesn't have anything related to Oracle installed on
it.

Now I have another remote machine: NT w/ Oracle Server 8.

What software/Libraries do i need to install on my linux box in order to
access Oracle database on that NT machine?

Thanks.







-- 
PHP Database 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-DB] gzip image files

2001-11-27 Thread Andrey Hristov

Of course it will
$filename = 'kunden/'.$name.'.png';
$data = fopen($filename, "r");
$contents = fread($data, filesize($filename));
fclose($data);
// ok so far so good
$gzdata = gzencode($data);
// here is the error, instead of $data use $contents 
$fp = fopen('kunden/zip/'.$name.'.gz', "w");
fwrite($fp, $gzdata);
fclose($fp);
// this is ok

Regards,
Andrey Hristov
IcyGEN Corporation
http://www.icygen.com
BALANCED SOLUTIONS


- Original Message - 
From: "Keith Whyman" <[EMAIL PROTECTED]>
To: "Andrey Hristov" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, November 27, 2001 5:06 PM
Subject: Re: [PHP-DB] gzip image files


> and if i use
> 
> $filename = 'kunden/'.$name.'.png';
> $data = fopen($filename, "r");
> $contents = fread($data, filesize($filename));
> fclose($data);
> $gzdata = gzencode($data);
> $fp = fopen('kunden/zip/'.$name.'.gz', "w");
> fwrite($fp, $gzdata);
> fclose($fp);
> 
> it writes in the gz file this
> Resource id #3
> 
> 
> 
> > Yes, it is.
> > the return value of fopen is a resource of type file.
> > var_dump($data); will show that
> > if you want to read the data use : fread($data,$buf);
> >
> > but I think its better with file() function. The example from the docs
> show a better method:
> >  > $data = implode("", "bigfile.txt");
> > $gzdata = gzencode($data, 9);
> > $fp = fopen("bigfile.txt.gz", "w");
> > fwrite($fp, $gzdata);
> > fclose($fp);
> > ?>
> >
> > Regards,
> > Andrey Hristov
> > IcyGEN Corporation
> > http://www.icygen.com
> > BALANCED SOLUTIONS
> >
> >
> > - Original Message -
> > From: "Keith Whyman" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Tuesday, November 27, 2001 4:23 PM
> > Subject: [PHP-DB] gzip image files
> >
> >
> > > I create a png dynamically - store the path in mysql.
> > >
> > > And want to be able to offer the user a zipped version to download
> > > Unfortunately haven't been able to get it to work up until now !
> > > I'm sure it's something obvious but...
> > >
> > >
> > > Open the png
> > > $data = fopen('kunden/'.$name.'.png', "rb");
> > > encode it
> > > $gzdata = gzencode($data);
> > > where to write
> > > $fp = fopen('kunden/zip/'.$name.'.gz', "w");
> > > write it
> > > fwrite($fp, $gzdata);
> > > fclose($fp);
> > >
> > > what happens is the name gets included in the gz but written to it is
> only
> > > kunden/example.png
> > >
> > > Can anyone help ??
> > >
> > > thanks in advance
> > > regards
> > > keith
> > >
> > >
> > > --
> > > PHP Database 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 Database 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 Database 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-DB] gzip image files

2001-11-27 Thread Keith Whyman

ha it works !
thanks !
now just one last question :-))
how can i name my png in the gz file so that it ends with .png ?
i thought this would work
fwrite($fp, $gzdata.'.png');
but it doesn't ! :-(



> Of course it will
> $filename = 'kunden/'.$name.'.png';
> $data = fopen($filename, "r");
> $contents = fread($data, filesize($filename));
> fclose($data);
> // ok so far so good
> $gzdata = gzencode($data);
> // here is the error, instead of $data use $contents
> $fp = fopen('kunden/zip/'.$name.'.gz', "w");
> fwrite($fp, $gzdata);
> fclose($fp);
> // this is ok
>
> Regards,
> Andrey Hristov
> IcyGEN Corporation
> http://www.icygen.com
> BALANCED SOLUTIONS
>
>
> - Original Message -
> From: "Keith Whyman" <[EMAIL PROTECTED]>
> To: "Andrey Hristov" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Tuesday, November 27, 2001 5:06 PM
> Subject: Re: [PHP-DB] gzip image files
>
>
> > and if i use
> >
> > $filename = 'kunden/'.$name.'.png';
> > $data = fopen($filename, "r");
> > $contents = fread($data, filesize($filename));
> > fclose($data);
> > $gzdata = gzencode($data);
> > $fp = fopen('kunden/zip/'.$name.'.gz', "w");
> > fwrite($fp, $gzdata);
> > fclose($fp);
> >
> > it writes in the gz file this
> > Resource id #3
> >
> >
> >
> > > Yes, it is.
> > > the return value of fopen is a resource of type file.
> > > var_dump($data); will show that
> > > if you want to read the data use : fread($data,$buf);
> > >
> > > but I think its better with file() function. The example from the docs
> > show a better method:
> > >  > > $data = implode("", "bigfile.txt");
> > > $gzdata = gzencode($data, 9);
> > > $fp = fopen("bigfile.txt.gz", "w");
> > > fwrite($fp, $gzdata);
> > > fclose($fp);
> > > ?>
> > >
> > > Regards,
> > > Andrey Hristov
> > > IcyGEN Corporation
> > > http://www.icygen.com
> > > BALANCED SOLUTIONS
> > >
> > >
> > > - Original Message -
> > > From: "Keith Whyman" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Tuesday, November 27, 2001 4:23 PM
> > > Subject: [PHP-DB] gzip image files
> > >
> > >
> > > > I create a png dynamically - store the path in mysql.
> > > >
> > > > And want to be able to offer the user a zipped version to download
> > > > Unfortunately haven't been able to get it to work up until now !
> > > > I'm sure it's something obvious but...
> > > >
> > > >
> > > > Open the png
> > > > $data = fopen('kunden/'.$name.'.png', "rb");
> > > > encode it
> > > > $gzdata = gzencode($data);
> > > > where to write
> > > > $fp = fopen('kunden/zip/'.$name.'.gz', "w");
> > > > write it
> > > > fwrite($fp, $gzdata);
> > > > fclose($fp);
> > > >
> > > > what happens is the name gets included in the gz but written to it
is
> > only
> > > > kunden/example.png
> > > >
> > > > Can anyone help ??
> > > >
> > > > thanks in advance
> > > > regards
> > > > keith
> > > >
> > > >
> > > > --
> > > > PHP Database 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 Database 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 Database 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-DB] [PHP] Coding methods (was RE: [PHP-DB] gzip image files)

2001-11-27 Thread Andrey Hristov

When you use "" the parser scans the string for variables. When ' is used it is not 
parsed. So you know what $variable to put,
concatenate the strings with the variable(s). I think it's a faster method. IMO, yes 
it seems ugly, but I want to be faster not so
readable as a novel.

Regards,
Andrey Hristov

- Original Message -
From: "Boget, Chris" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, November 27, 2001 5:28 PM
Subject: [PHP] Coding methods (was RE: [PHP-DB] gzip image files)


> > $filename = 'kunden/'.$name.'.png';
>
> I see this all the time and I'm curious:  what takes more
> computing power (granted, either would be incredibly little
> I'm sure, just curious which requires more work by PHP)?
>
> this:
>
> $filename = "this " . $varname . " that";
>
> or this:
>
> $filename = "this $varname that";
>
> I would think the latter example but am not sure.
>
> Another question, but this is more about personal style:
>
> I almost always use the latter method in my coding practices.  It
> looks cleaner and, IMO, is easier to follow especially when there
> are a number of variables involved.  For those that use the former
> method, why do you?  I'm not trying to be judgemental, just curious
> why people do what they do.  In asking, I may actually learn some-
> thing. :p
>
> Chris
>



-- 
PHP Database 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-DB] Coding methods (was RE: [PHP-DB] gzip image files)

2001-11-27 Thread Russ Michell

I use the former method when concatenating say a complex SQL query thru a loop or 
loops, and me 
being the person I am like to keep things standard and consistant so I use the same 
method when I 
wish to concatenate simpler strings.

Russ

On Tue, 27 Nov 2001 09:28:37 -0600 "Boget, Chris" <[EMAIL PROTECTED]> wrote:

> > $filename = 'kunden/'.$name.'.png';
> 
> I see this all the time and I'm curious:  what takes more
> computing power (granted, either would be incredibly little
> I'm sure, just curious which requires more work by PHP)?
> 
> this:
> 
> $filename = "this " . $varname . " that";
> 
> or this:
> 
> $filename = "this $varname that";
> 
> I would think the latter example but am not sure.
> 
> Another question, but this is more about personal style:
> 
> I almost always use the latter method in my coding practices.  It 
> looks cleaner and, IMO, is easier to follow especially when there 
> are a number of variables involved.  For those that use the former 
> method, why do you?  I'm not trying to be judgemental, just curious
> why people do what they do.  In asking, I may actually learn some-
> thing. :p
> 
> Chris

#---#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  Room 1C 'The Eastings' East Road, Cambridge
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam

  www.theruss.com

#---#


-- 
PHP Database 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-DB] PHP accessing MySQL

2001-11-27 Thread Jonathan Duncan

OK, I have found some more time to work on my PHP project.  The problem is
indicated in the following line:

$tables = mysql_list_tables($db_names[$db_num]) or die("Couldn't list
databases.");

I took the variable $db_num and replaced it with a value of 1 as follows:

$tables = mysql_list_tables($db_names[1]) or die("Couldn't list
databases.");

The output gave me the following results:

The value of db_list is:
mysql
test
twignud
The value of dbs is: Resource id #2
The value of db_num is: 3

If I replace $db_num with a value of 0, 2 or 3 I get "Couldn't list
databases."

Any ideas anyone?  Julie?  Miles?  Could this have anything to do with mysql
user permission?

Thanks,
jkd


""Jonathan Duncan"" <[EMAIL PROTECTED]> wrote in message
9eekpb$s41$[EMAIL PROTECTED]">news:9eekpb$s41$[EMAIL PROTECTED]...
> YES!!  I just had a feeling the book was wrong.  That did get rid of the
> error.  However, it did not completely solve my issue.  Now when I run the
> script I just get the message "Couldn't list databases."  This just
happens
> to be the die message for the same line of code that I have been looking
at:
>
>$tables = mysql_list_tables($db_names[$db_num]) or die("Couldn't list
> databases.");
>
> It is almost as if it is not being able to even list the tables from the
> databases.  I am working right now on just listing the tables of a
database
> to see what happens.
>
> Thank you,
> jkd
>
>
> "Julie Meloni" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I believe you want to look at this page:
> > http://www.thickbook.com/books/phpfe_errata.phtml
> >
> >
> >
> > --
> > ++
> > | Julie Meloni ([EMAIL PROTECTED]) |
> > ||
> > | "PHP Essentials" and "PHP Fast & Easy" |
> > |   http://www.thickbook.com |
> > ++
> >
> >
> > --
> > PHP Database 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 Database 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 Database 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-DB] Problem with SQL query on several tables

2001-11-27 Thread Rosen

Hi,
I'm trying to execute SQL query:
"select * from f1,f2,f3 order by datestamp"

MySQL returns me an error:
"1052 - Column: 'datestamp' in order clause is ambigious"

The tables f1,f2,f3 have some structure.
The field "datestamp" is type datetime.

Why I can't order query on 'datestamp' ?

Thanks,
Rosen



-- 
PHP Database 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-DB] gzip image files

2001-11-27 Thread Andrey Hristov

This writes 'png' at the end of file so the file will be corrupted for every 
compressor. If you want to name is foo.bar.gz.png
then:

$fp = fopen('kunden/zip/'.substr($name,0,-4).'.gz'.'.png', "w+");
not sure but the substr() have to remove .png from the filename.

Regards,
Andrey

- Original Message - 
From: "Keith Whyman" <[EMAIL PROTECTED]>
To: "Andrey Hristov" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, November 27, 2001 5:30 PM
Subject: Re: [PHP-DB] gzip image files



> ha it works !
> thanks !
> now just one last question :-))
> how can i name my png in the gz file so that it ends with .png ?
> i thought this would work
> fwrite($fp, $gzdata.'.png');
> but it doesn't ! :-(
> 
> 
> 
> > Of course it will
> > $filename = 'kunden/'.$name.'.png';
> > $data = fopen($filename, "r");
> > $contents = fread($data, filesize($filename));
> > fclose($data);
> > // ok so far so good
> > $gzdata = gzencode($data);
> > // here is the error, instead of $data use $contents
> > $fp = fopen('kunden/zip/'.$name.'.gz', "w");
> > fwrite($fp, $gzdata);
> > fclose($fp);
> > // this is ok
> >
> > Regards,
> > Andrey Hristov
> > IcyGEN Corporation
> > http://www.icygen.com
> > BALANCED SOLUTIONS
> >
> >
> > - Original Message -
> > From: "Keith Whyman" <[EMAIL PROTECTED]>
> > To: "Andrey Hristov" <[EMAIL PROTECTED]>
> > Cc: <[EMAIL PROTECTED]>
> > Sent: Tuesday, November 27, 2001 5:06 PM
> > Subject: Re: [PHP-DB] gzip image files
> >
> >
> > > and if i use
> > >
> > > $filename = 'kunden/'.$name.'.png';
> > > $data = fopen($filename, "r");
> > > $contents = fread($data, filesize($filename));
> > > fclose($data);
> > > $gzdata = gzencode($data);
> > > $fp = fopen('kunden/zip/'.$name.'.gz', "w");
> > > fwrite($fp, $gzdata);
> > > fclose($fp);
> > >
> > > it writes in the gz file this
> > > Resource id #3
> > >
> > >
> > >
> > > > Yes, it is.
> > > > the return value of fopen is a resource of type file.
> > > > var_dump($data); will show that
> > > > if you want to read the data use : fread($data,$buf);
> > > >
> > > > but I think its better with file() function. The example from the docs
> > > show a better method:
> > > >  > > > $data = implode("", "bigfile.txt");
> > > > $gzdata = gzencode($data, 9);
> > > > $fp = fopen("bigfile.txt.gz", "w");
> > > > fwrite($fp, $gzdata);
> > > > fclose($fp);
> > > > ?>
> > > >
> > > > Regards,
> > > > Andrey Hristov
> > > > IcyGEN Corporation
> > > > http://www.icygen.com
> > > > BALANCED SOLUTIONS
> > > >
> > > >
> > > > - Original Message -
> > > > From: "Keith Whyman" <[EMAIL PROTECTED]>
> > > > To: <[EMAIL PROTECTED]>
> > > > Sent: Tuesday, November 27, 2001 4:23 PM
> > > > Subject: [PHP-DB] gzip image files
> > > >
> > > >
> > > > > I create a png dynamically - store the path in mysql.
> > > > >
> > > > > And want to be able to offer the user a zipped version to download
> > > > > Unfortunately haven't been able to get it to work up until now !
> > > > > I'm sure it's something obvious but...
> > > > >
> > > > >
> > > > > Open the png
> > > > > $data = fopen('kunden/'.$name.'.png', "rb");
> > > > > encode it
> > > > > $gzdata = gzencode($data);
> > > > > where to write
> > > > > $fp = fopen('kunden/zip/'.$name.'.gz', "w");
> > > > > write it
> > > > > fwrite($fp, $gzdata);
> > > > > fclose($fp);
> > > > >
> > > > > what happens is the name gets included in the gz but written to it
> is
> > > only
> > > > > kunden/example.png
> > > > >
> > > > > Can anyone help ??
> > > > >
> > > > > thanks in advance
> > > > > regards
> > > > > keith
> > > > >
> > > > >
> > > > > --
> > > > > PHP Database 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 Database 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 Database 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 Database 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-DB] Problem with SQL query on several tables

2001-11-27 Thread Andrey Hristov

Mysql says that in the join there are some columns with namer datestamp so you have to 
choose by which you want to order.
Think about making LEFT JOIN.
select * from f1 LEFT JOIN f2 ON f1.some_field=f2.some_field LEFT JOIN f3 ON 
f2.some_field=f3.some_field roder by f1.datestamp;

Regards,
Andrey Hristov
IcyGEN Corporation
http://www.icygen.com
BALANCED SOLUTIONS


- Original Message - 
From: "Rosen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 27, 2001 5:34 PM
Subject: [PHP-DB] Problem with SQL query on several tables


> Hi,
> I'm trying to execute SQL query:
> "select * from f1,f2,f3 order by datestamp"
> 
> MySQL returns me an error:
> "1052 - Column: 'datestamp' in order clause is ambigious"
> 
> The tables f1,f2,f3 have some structure.
> The field "datestamp" is type datetime.
> 
> Why I can't order query on 'datestamp' ?
> 
> Thanks,
> Rosen
> 
> 
> 
> -- 
> PHP Database 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 Database 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-DB] inserting mysql data using php array???

2001-11-27 Thread Ubaidul Khan

Hi

I am running Apache 1.3.20 with MySQL 3.23.41, and PHP 4.0.6, on Linux Mandrake 8.1.  
I am trying to access a MySQL database from a PHP script.  I have a html form, that 
takes input in an array (ie. name[0], name[1], name[2], name[3], these fields 
represent first_name, middle_initial, last_name, and suffix in the database).  What I 
would really like to do is, take this array of data and insert each element in the 
corresponding column, in the database.  Is it possible to insert each element of the 
array into the database, using an array, instead of typing out each value?  

--
Thanks



Re: [PHP-DB] Problem with SQL query on several tables

2001-11-27 Thread Rosen

Thanks,
but I want wo JOIN data from three tables and then to order
all data by "datestamp".

Can I Do It ?

Thanks,
Rosen



Andrey Hristov wrote in message <071401c17759$f5873c80$0b01a8c0@ANDreY>...
>Mysql says that in the join there are some columns with namer datestamp so
you have to choose by which you want to order.
>Think about making LEFT JOIN.
>select * from f1 LEFT JOIN f2 ON f1.some_field=f2.some_field LEFT JOIN f3
ON f2.some_field=f3.some_field roder by f1.datestamp;
>
>Regards,
>Andrey Hristov
>IcyGEN Corporation
>http://www.icygen.com
>BALANCED SOLUTIONS
>
>
>- Original Message -
>From: "Rosen" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Tuesday, November 27, 2001 5:34 PM
>Subject: [PHP-DB] Problem with SQL query on several tables
>
>
>> Hi,
>> I'm trying to execute SQL query:
>> "select * from f1,f2,f3 order by datestamp"
>>
>> MySQL returns me an error:
>> "1052 - Column: 'datestamp' in order clause is ambigious"
>>
>> The tables f1,f2,f3 have some structure.
>> The field "datestamp" is type datetime.
>>
>> Why I can't order query on 'datestamp' ?
>>
>> Thanks,
>> Rosen
>>
>>
>>
>> --
>> PHP Database 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 Database 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-DB] Re: What software do I need in order to access Oracle database on an NT server from my unix machine?

2001-11-27 Thread Philippe Saladin

AFAIK, you need to install the oracle 8 client for linux onto your machine.
Unfortunately, it can't be downloaded alone. you need the entire "Oracle 8
database release for Linux", available at www.oracle.com

Hope I'm not wrong. Please correct me there's an error
Regards,
Philippe

"Lallous" <[EMAIL PROTECTED]> a écrit dans le message news:
[EMAIL PROTECTED]
> Hello.
>
> I have a unix box which doesn't have anything related to Oracle installed
on
> it.
>
> Now I have another remote machine: NT w/ Oracle Server 8.
>
> What software/Libraries do i need to install on my linux box in order to
> access Oracle database on that NT machine?
>
> Thanks.
>
>
>
>
>
>



-- 
PHP Database 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-DB] ?? If Table Exists, Drop Table, then Create Table ??

2001-11-27 Thread MrBaseball34

Table Creation Script from SQL Server...

if exists (select * from dbo.sysobjects where id = 
   object_id(N'[dbo].[Orders]') and 
   OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Orders]
GO

CREATE TABLE [dbo].[Orders] (
[OrderID] [int] IDENTITY (1, 1) NOT NULL,
   .
   .
   .
   .
);
GO

Is there anything like the first line from mySQL?
I need to check if a table exists and drop it if it 
does so it can be recreated. I do not have access to
any admin facilities on my host so I need to be able
to do this in a script I can modify.


-- 
PHP Database 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-DB] Re: What software do I need in order to access Oracle database on an NT server from my unix machine?

2001-11-27 Thread Andrew Hill

You may also accomplish this via ODBC - download and link against iODBC per
the HOWTO at www.iodbc.org.
For free trial drivers, I suggest the Multi-Tier ODBC Drivers from
www.openlinksw.com

If you run into problems, free support is available at
http://www.openlinksw.com/support/suppindx.htm

Best regards,
Andrew Hill
Director of Technology Evangelism
OpenLink Software  http://www.openlinksw.com
Universal Data Access & Data Integration Technology Providers

> -Original Message-
> From: Philippe Saladin [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, November 27, 2001 11:19 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Re: What software do I need in order to access Oracle
> database on an NT server from my unix machine?
>
>
> AFAIK, you need to install the oracle 8 client for linux onto
> your machine.
> Unfortunately, it can't be downloaded alone. you need the entire "Oracle 8
> database release for Linux", available at www.oracle.com
>
> Hope I'm not wrong. Please correct me there's an error
> Regards,
> Philippe
>
> "Lallous" <[EMAIL PROTECTED]> a écrit dans le message news:
> [EMAIL PROTECTED]
> > Hello.
> >
> > I have a unix box which doesn't have anything related to Oracle
> installed
> on
> > it.
> >
> > Now I have another remote machine: NT w/ Oracle Server 8.
> >
> > What software/Libraries do i need to install on my linux box in order to
> > access Oracle database on that NT machine?
> >
> > Thanks.
> >
> >
> >
> >
> >
> >
>
>
>
> --
> PHP Database 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 Database 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-DB] table prefixing

2001-11-27 Thread Ruben Vermeersch

i wanna make a table prefix code, normally i would just change all the
querys, but since this site is already built and it's quite big i can't do
every query again.

i have a function named db_query(), it does my mysql querys and some error
reporting, now i wanna add regex's (or something else if that would work
better) to it to prefix every table name supplied to it. Can somebody help?

this is what i tought: table names only come after FROM or in a table.field
expression, maybe it helps???

Thanks already, Ruben





-- 
PHP Database 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-DB] Re: Table Locking...

2001-11-27 Thread John Lim

Hi Ashley,

Insert records into a table with a primary key that you define,
not an autoincrement field. When 2 people try to insert a record
with the same primary key, one will fail, the other will succeed.

The one that fails will poll the database until the other record
successfully completes the insert.

Regards, John

Ashley M. Kirchner <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> (PHP-DB folks, ignore this top question - unless you want to answer)
>
> Which type of DB/Table provides table locking while a process is
> altering data?  I don't care for locking while using SELECTs, but I do
> need locking when something's being INSERTed or UPDATEd, so I won't get
> two processes trying to do the same darned thing at the same time.
>
>
>
> (MySQL folks, ignore this bottom question - unless you want to
> answer)
>
> I'm somewhat lost on how to do the following:
>
> I'm trying to go through a table and check for a particular
> information.  If it doesn't exist, then go ahead and issue an INSERT
> with the relevant data.  The next time another process comes along,
> it'll obviously find the information and issue an UPDATE instead.  But,
> what happens if I get two processes running at the same time, trying to
> find information that does not exist yet?
>
> If both issue a SELECT and find the information not there, both will
> try to issue an INSERT, where really I want one of those processes to
> wait for the first one to finish doing whatever it needs to do, prior to
> continuing.  (all of this is being done in PHP by the way).  Does anyone
> have any suggestions for this scenario (or am I just blowing smoke out
> my arse and there's something else, internally, that I'm not aware of?)
> When (and how) to issue some sort of "wait" state for one process while
> the other's finishing what it needs to do, then restart the second
> process (which should re-check for existing information, and not blindly
> issue another INSERT right after the first one).
>
> --
> W | I haven't lost my mind; it's backed up on tape somewhere.
>   +
>   Ashley M. Kirchner    .   303.442.6410 x130
>   IT Director / SysAdmin / WebSmith . 800.441.3873 x130
>   Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave. #6
>   http://www.pcraft.com . .  ..   Boulder, CO 80303, U.S.A.
>
>



-- 
PHP Database 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-DB] oracle connection drop hangs app

2001-11-27 Thread Christophe VG

Hi,

While writing an app that regularly checks an oracle database for new
entries I run into problems when the database server suddenly goes
offline (the network connection can't be trusted).

The call right after such a connection loss just hangs the application.

Here is a little example to illustrate ...



Running it results in a nice collection of "OK"'s and a hangup when I
disconnect the network. Plugging the network back in resumes the series
of "OK"'s after a while ... But the desired behaviour ( "DOWN" ) won't
appear.

Did anyone of you encountered a similar situation ? How did you solve
this ? ... Any ideas are good, since I'm a bit stuck and any lead might
help to a probably very simple solution (that I just can see rigth now)

Thanks in advance,

Christophe VG


-- 
PHP Database 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-DB] Re: ?? If Table Exists, Drop Table, then Create Table ??

2001-11-27 Thread MrBaseball34

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 

> Is there anything like the first line from mySQL?
> I need to check if a table exists and drop it if it 
> does so it can be recreated. I do not have access to
> any admin facilities on my host so I need to be able
> to do this in a script I can modify.
> 
Found it...
'In MySQL Version 3.22 or later, you can use the keywords IF EXISTS to 
 prevent an error from occurring for tables that don't exist.'

DROP TABLE [IF EXISTS] tbl_name [, tbl_name,...] [RESTRICT | CASCADE]

-- 
PHP Database 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-DB] Problem with SQL query on several tables

2001-11-27 Thread Indioblanco

It sounds to me like what you're trying to do is APPEND data from three 
similarly structured tables into one entity ordered by a column common 
to all 3 tables called "datestamp". If I'm mistaken, then please ignore 
all of the following:

Approach #1 (mysql)
Create a temporary table with the columns you need to process, indexed 
by "datestamp", and append the data from the 3 tables-- then query the 
temp table.

Approach #2 (php)
Create an associative array (hash table) in php then append the data 
from the 3 tables, order as desired, and process.

Which you choose would depend on which you find simpler-- the mysql 
approach would probably take a more time, but be easier to reuse on 
successive pages.

ib

Rosen wrote:

> Thanks,
> but I want wo JOIN data from three tables and then to order
> all data by "datestamp".
> 
> Can I Do It ?
> 
> Thanks,
> Rosen
> 
> 
> 
> Andrey Hristov wrote in message <071401c17759$f5873c80$0b01a8c0@ANDreY>...
> 
>> Mysql says that in the join there are some columns with namer datestamp so
> 
> you have to choose by which you want to order.
> 
>> Think about making LEFT JOIN.
>> select * from f1 LEFT JOIN f2 ON f1.some_field=f2.some_field LEFT JOIN f3
> 
> ON f2.some_field=f3.some_field roder by f1.datestamp;
> 
>> Regards,
>> Andrey Hristov
>> IcyGEN Corporation
>> http://www.icygen.com
>> BALANCED SOLUTIONS
>> 
>> 
>> - Original Message -
>> From: "Rosen" <[EMAIL PROTECTED]>
>> To: <[EMAIL PROTECTED]>
>> Sent: Tuesday, November 27, 2001 5:34 PM
>> Subject: [PHP-DB] Problem with SQL query on several tables
>> 
>> 
>>> Hi,
>>> I'm trying to execute SQL query:
>>> "select * from f1,f2,f3 order by datestamp"
>>> 
>>> MySQL returns me an error:
>>> "1052 - Column: 'datestamp' in order clause is ambigious"
>>> 
>>> The tables f1,f2,f3 have some structure.
>>> The field "datestamp" is type datetime.
>>> 
>>> Why I can't order query on 'datestamp' ?
>>> 
>>> Thanks,
>>> Rosen
>>> 
>>> 
>>> 
>>> --
>>> PHP Database 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 Database 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-DB] Oracle, PHP4, BSD

2001-11-27 Thread B. PERRINE

le jeu 08-11-2001 à 23:52, D. Witten a écrit :
> These are pretty basic questions, but I would appreciate help:
> 
> I need to access Oracle (already running on a separate server) via PHP4 from
> a FreeBSD Server.
> 
> 1) Can this be done?
> (if so...)
I don't think so. But if the BSD can run linux prog, then you may try to
install oracle (client part) on your server via the oracle java
installer : OUI. It come with oracle.
> 2) Where do I find instructions?
technet.oracle.com product : 8i, some howto exists.
> 3) Where do I get php_oci8
with php
> 4) Do I HAVE to install code from Oracle (the Oracle client, etc) on my
> server?
> (if so,,,)
see 1)
> 5) Where do I get that client software?
> 
> Thanks
> 
> Dave Witten
> 
> 
> 
> -- 
> PHP Database 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 Database 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-DB] Oracle, PHP4, BSD

2001-11-27 Thread Andrew Hill

Dave,

This is easily accomplished via ODBC.
Check out the PHP ODBC HOWTO's at www.iodbc.org, and let me know if you have
further questions.

Best regards,
Andrew Hill
Director of Technology Evangelism
OpenLink Software  http://www.openlinksw.com
Universal Data Access & Data Integration Technology Providers

> -Original Message-
> From: B. PERRINE [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, November 27, 2001 2:20 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Oracle, PHP4, BSD
>
>
> le jeu 08-11-2001 à 23:52, D. Witten a écrit :
> > These are pretty basic questions, but I would appreciate help:
> >
> > I need to access Oracle (already running on a separate server)
> via PHP4 from
> > a FreeBSD Server.
> >
> > 1) Can this be done?
> > (if so...)
> I don't think so. But if the BSD can run linux prog, then you may try to
> install oracle (client part) on your server via the oracle java
> installer : OUI. It come with oracle.
> > 2) Where do I find instructions?
> technet.oracle.com product : 8i, some howto exists.
> > 3) Where do I get php_oci8
> with php
> > 4) Do I HAVE to install code from Oracle (the Oracle client, etc) on my
> > server?
> > (if so,,,)
> see 1)
> > 5) Where do I get that client software?
> >
> > Thanks
> >
> > Dave Witten
> >
> >
> >
> > --
> > PHP Database 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 Database 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 Database 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-DB] Configure with Postgres/MySQL of different machine

2001-11-27 Thread Joe Nelson

I'm trying to configure php so that it will have support for both MySQL
and Postgres.  Normally that would not be a problem, however, both MySQL
and Postgres will be on a different machine.  How can I configure PHP to
use the servers on the other machine?  Everything I've seen shows how to
do it when it's all on one machine.

This is what I ran:
./configure \
--enable-track-vars \
--with-gd \
--with-mysql \
--with-pgsql \
--with-apxs=/usr/sbin/apxs
--with-config-file-path=/etc

Any help or pointers would be appreciated.  Thanks.

Joe


-- 
PHP Database 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-DB] Re: What software do I need in order to access Oracledatabase on an NT server from my unix machine?

2001-11-27 Thread B. PERRINE

le mar 27-11-2001 à 17:19, Philippe Saladin a écrit :
> AFAIK, you need to install the oracle 8 client for linux onto your machine.
> Unfortunately, it can't be downloaded alone. you need the entire "Oracle 8
> database release for Linux", available at www.oracle.com
> 
> Hope I'm not wrong. Please correct me there's an error
> Regards,
> Philippe

I confirm.
B.


--
PHP Database 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-DB] Problem with Oracle connection

2001-11-27 Thread B. PERRINE

le ven 23-11-2001 à 02:18, Jonathan B. Bayer a écrit :
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Hello php-db,
> 
> We have a RedHat 7.1 server with a stock install.  I recompiled PHP from
> the source RPM in order to add oracle support.
> 
> It mostly works, but we are having a problem where it apparently
> randomly loses the connection to the database.  It is an oracle database
> which is on the local network;  another system (a Sun) doesn't have this
> problem, so that rules out the database.
> 
> Does anybody have any experience with this happening?
> 
> 
> Thanks in advance.
> 
> 
> JBB

I guess you are using php-4.0.6, I met this problem on a Debian with
this PHP version.
B.


--
PHP Database 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-DB] Problem with SQL query on several tables

2001-11-27 Thread Matt Williams


> > Thanks,
> > but I want wo JOIN data from three tables and then to order
> > all data by "datestamp".

There must be more than one column called datestamp, this is why mysql is
telling you it's ambiguous.
So you need to tell it which table's datestamp column you wish to use.
for example your new query could be:

select * from f1,f2,f3 order by f1.datestamp

Also, presumably all the tables have a column which relates to one of the
other columns in some way?

If so, and I can't reason the point in doing it if there is not, maybe you
should look at the JOIN syntax from the mysql manual. If nothing else it
will give you a better understanding of joining tables and the problems you
may face.

M:

> > Can I Do It ?
> >
> > Thanks,
> > Rosen
> >
> >
> >
> > Andrey Hristov wrote in message
> <071401c17759$f5873c80$0b01a8c0@ANDreY>...
> >
> >> Mysql says that in the join there are some columns with namer
> datestamp so
> >
> > you have to choose by which you want to order.
> >
> >> Think about making LEFT JOIN.
> >> select * from f1 LEFT JOIN f2 ON f1.some_field=f2.some_field
> LEFT JOIN f3
> >
> > ON f2.some_field=f3.some_field roder by f1.datestamp;
> >
> >> Regards,
> >> Andrey Hristov
> >> IcyGEN Corporation
> >> http://www.icygen.com
> >> BALANCED SOLUTIONS
> >>
> >>
> >> - Original Message -
> >> From: "Rosen" <[EMAIL PROTECTED]>
> >> To: <[EMAIL PROTECTED]>
> >> Sent: Tuesday, November 27, 2001 5:34 PM
> >> Subject: [PHP-DB] Problem with SQL query on several tables
> >>
> >>
> >>> Hi,
> >>> I'm trying to execute SQL query:
> >>> "select * from f1,f2,f3 order by datestamp"
> >>>
> >>> MySQL returns me an error:
> >>> "1052 - Column: 'datestamp' in order clause is ambigious"
> >>>
> >>> The tables f1,f2,f3 have some structure.
> >>> The field "datestamp" is type datetime.
> >>>
> >>> Why I can't order query on 'datestamp' ?
> >>>
> >>> Thanks,
> >>> Rosen
> >>>
> >>>
> >>>
> >>> --
> >>> PHP Database 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 Database 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 Database 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-DB] Storing JPEG's in MySQL -- Is it possible?

2001-11-27 Thread PaulC

Hi,

I've wrote a bit of code to upload a file, and store it in a MySQL
"longblob" field.
If I upload a GIF, and store it in MySQL I am able to retrieve it fine using
a PHP script.

However, a JPEG uploads, but cannot be retrieved successfully.
(I get a broken image symbol in IE)

Does anybody know why this is???

Thanks,
Paul



-- 
PHP Database 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-DB] Oracle 8i and PHP 4.

2001-11-27 Thread Daniel Romero

Is it possible to have nested transactions in PHP and Oracle 8i by using Oci8 dll ?

Thanx, Daniel



Re: [PHP-DB] Storing JPEG's in MySQL -- Is it possible?

2001-11-27 Thread CK Raju

Please show your script, so that we can answer you better.
CK Raju

On Tuesday 27 November 2001 16:37, PaulC wrote:
> Hi,
>
> I've wrote a bit of code to upload a file, and store it in a MySQL
> "longblob" field.
> If I upload a GIF, and store it in MySQL I am able to retrieve it fine
> using a PHP script.
>
> However, a JPEG uploads, but cannot be retrieved successfully.
> (I get a broken image symbol in IE)
>
> Does anybody know why this is???
>
> Thanks,
> Paul

-- 
PHP Database 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-DB] Configure with Postgres/MySQL of different machine

2001-11-27 Thread Grant Johnson

The different machine has nothing to do with the config, and everything 
to do with the connect.  It is in the connect string that you specify 
which machine for PHP to connect to Postgres.

Joe Nelson wrote:

>I'm trying to configure php so that it will have support for both MySQL
>and Postgres.  Normally that would not be a problem, however, both MySQL
>and Postgres will be on a different machine.  How can I configure PHP to
>use the servers on the other machine?  Everything I've seen shows how to
>do it when it's all on one machine.
>
>This is what I ran:
>./configure \
>--enable-track-vars \
>--with-gd \
>--with-mysql \
>--with-pgsql \
>--with-apxs=/usr/sbin/apxs
>--with-config-file-path=/etc
>
>Any help or pointers would be appreciated.  Thanks.
>
>Joe
>
>



-- 
PHP Database 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-DB] query to check valid emails

2001-11-27 Thread Noah Spitzer-Williams

what's the LIKE query to see if an email address is valid?

For example, in PHP it's something like
if
(eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}$",$
email,$check)) {
echo "valid";
}


i want to sort through rows in a db and look for invalid email addresses

so like, select * from tbl where email like "???"

Thanks!

- Noah


--
TradeMyTraffic! Banner Exchange
http://www.trademytraffic.com





-- 
PHP Database 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-DB] Re: [PEAR-DEV] Re: Common DB Abstraction Layer: Re: [PEAR-DEV]Adoption of Metabase

2001-11-27 Thread Manuel Lemos

"Stig S. Bakken" wrote:
> 
> Joao Prado Maia wrote:
> >
> > On Wed, 21 Nov 2001, Martin Jansen wrote:
> >
> > > On Wed, 21 Nov 2001 09:19:44 -0500 (EST), Joao Prado Maia wrote:
> > >
> > > >If PEAR::DB is not abstracting the database what is the purpose of such a
> > > >library ?
> > >
> > > To ease the life of lot's of programmers.
> > >
> >
> > I probably used a bad choice of words. What I really meant was: What is
> > the objective of PEAR::DB as a database abstraction library ? To abstract
> > as much as possible like Metabase already does, or to provide a unified
> > API to databases and leave the implementation related to database specific
> > to the user himself ?
> >
> > It's okay to choose the latter, but I believe we should have a unique
> > position on something like this, so we know what we are working for. A
> > statement like this will be very helpful when people come to the mailing
> > list saying that PEAR::DB doesn't abstract LOB's or any other exotic
> > feature, as we can just reply "that's not our objective".
> >
> > Anyway, I think this is a good discussion.
> 
> PEAR DB's objective was to provide a common API.  This is why I did not
> choose Metabase for PEAR in the first place, IMHO it was too huge and

After almost two years PEAR-DB is still catching up with Metabase
features, for instance, sequences, limits in select queries, etc... When
PEAR-DB catches up on the current Metabase features it will not be
smaller than Metabase. The difference is that it will take even a longer
while to catch up than it already took today.

What is worse is that it is under-documented and subject of permanent
API changes. Take for instance, the recent changes on the way to specify
limits to select queries. First, they decide that setting the query
limits should be coupled actual query execution. Then they realize that
setting the limits of prepared queries have to be done before executing
the query. So, the latest solution is doing exactly as it is done with
Metabase!

If this already like this with limits in select queries, I can imagine
how it will be like when somebody finally decides that PEAR-DB needs an
interface for handling BLOBs. I guess it will be something like
everybody jumping in with their own ideais on how to store and retrieve
data from BLOBs, leading to several incompatible versions of the API
functions to do that.

You have to admit that this is silly. The real problem is that this
experimental character of PEAR-DB is annoying to most users because they
do not have a stable API to rely on, nor do they have an expectation on
when PEAR-DB API will ever be stable and properly documented. So for a
lot of people, PEAR-DB is as good as non-existing.

My proposal to wrap PEAR-DB around Metabase is exactly to address this
current PEAR-DB deficiencies and stop the PHP bad fame of lacking of a
database abstraction layer. Metabase API is stable and througly
documented. Metabase manual not only documents the features and the
functions, but also has a pedagogical approach because it explains
clearly with some detail complex concepts like prepared queries,
transctions, blobs, etc...

Regards,
Manuel Lemos

-- 
PHP Database 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-DB] inserting mysql data using php array???

2001-11-27 Thread justin gruenberg

meaning

INSERT INTO table (first_name,middle_name,last_name,suffix)
VALUES($an_array)

no.  that is not possible.

you do actually have to write it out..

INSERT INTO table (first_name,middle_name,last_name,suffix)
VALUES('$name[0]', '$name[1]', '$name[2]', $name[3])



I dont understand why you have these in arrays if they are only simple text
inputs.  it'd be much easier to understand your code visually if you had the
name of each field actually descriptive of the content in it.  It is also
not valid html to have [ ]'s in the name parameter, I believe.


- Original Message -
From: "Ubaidul Khan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 27, 2001 9:45 AM
Subject: [PHP-DB] inserting mysql data using php array???


Hi

I am running Apache 1.3.20 with MySQL 3.23.41, and PHP 4.0.6, on Linux
Mandrake 8.1.  I am trying to access a MySQL database from a PHP script.  I
have a html form, that takes input in an array (ie. name[0], name[1],
name[2], name[3], these fields represent first_name, middle_initial,
last_name, and suffix in the database).  What I would really like to do is,
take this array of data and insert each element in the corresponding column,
in the database.  Is it possible to insert each element of the array into
the database, using an array, instead of typing out each value?

--
Thanks



-- 
PHP Database 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-DB] inserting mysql data using php array???

2001-11-27 Thread Jonathan Hilgeman

I actually have an easy way to do INSERTs like this.

First I create the array:

$MyArray["field"] = value;
$MyArray["name"] = "Jonathan";
$MyArray["age"] = 123;
$MyArray["email"] = $email_address;

and then I define this function somewhere in a function library:

 function Array2Query($dbArray)
 {
foreach($dbArray as $dbField => $dbValue)
{
$dbQuery .= "$dbField='$dbValue',";
}

$dbQuery = substr($dbQuery,0,strlen($dbQuery)-1);
 
return $dbQuery;
 }

and then I just create the query:

$Query = "INSERT INTO table SET " . Array2Query($MyArray);
$Result = mysql_query($Query);

Hope it helps.

- Jonathan


-Original Message-
From: justin gruenberg [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 27, 2001 2:59 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] inserting mysql data using php array???


meaning

INSERT INTO table (first_name,middle_name,last_name,suffix)
VALUES($an_array)

no.  that is not possible.

you do actually have to write it out..

INSERT INTO table (first_name,middle_name,last_name,suffix)
VALUES('$name[0]', '$name[1]', '$name[2]', $name[3])



I dont understand why you have these in arrays if they are only simple text
inputs.  it'd be much easier to understand your code visually if you had the
name of each field actually descriptive of the content in it.  It is also
not valid html to have [ ]'s in the name parameter, I believe.


- Original Message -
From: "Ubaidul Khan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 27, 2001 9:45 AM
Subject: [PHP-DB] inserting mysql data using php array???


Hi

I am running Apache 1.3.20 with MySQL 3.23.41, and PHP 4.0.6, on Linux
Mandrake 8.1.  I am trying to access a MySQL database from a PHP script.  I
have a html form, that takes input in an array (ie. name[0], name[1],
name[2], name[3], these fields represent first_name, middle_initial,
last_name, and suffix in the database).  What I would really like to do is,
take this array of data and insert each element in the corresponding column,
in the database.  Is it possible to insert each element of the array into
the database, using an array, instead of typing out each value?

--
Thanks



-- 
PHP Database 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 Database 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-DB] Re: Common DB Abstraction Layer:

2001-11-27 Thread Manuel Lemos

Hello,

"Tomas V.V.Cox" wrote:
> 
> Manuel Lemos wrote:
> >
> > Hello,
> >
> > John Lim wrote:
> > > Each designer has a different point of view, like Tomas has
> > > written a really excellent oci8 "select limit" emulation, but looking
> > > at the code, it's so complicated that i decided not to incorporate it
> > > in ADODB because I value simplicity. I know Tomas' code works
> > > in theory, and its really impressive that you even considered UNIONs,
> > > Tomas, but I just like "simple" code that I can keep in my head.
> >
> > But it does not work with computed columns like those that apply
> > functions (COUNT, SUM, SUBSTRING, etc...). The code assumes that you are
> > actually selecting only real table fields. I think it also does not work
> > with columns with table name prefixes.
> 
> That's partially true. But it's a common practise to use column aliases
> in conyunction with functions (and a must for assoc fetchs) and this is
> supported by the code I wrote, for ex:
> 
> select count(field) as count from foo;

That would work, but you require people to change their queries. I guess
that does not work as general practice because.



> Also if Oracle name a sum(foo) column as "sum" will be trivial to add
> it.
> 
> Any way I said it later, a real SQL parser will be the solution. Stig
> came with the idea time ago and nowadays it will help a lot in many
> other cases.

I think that for Oracle there is a better solution that does not require
Oracle to fully run queries that may return millions of rows, when you
just want to return the first. That solution is to use server side
cursors.

Regards,
Manuel Lemos

-- 
PHP Database 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-DB] PHP & Oracle (oci8)

2001-11-27 Thread Jonathan B. Bayer

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hello php-db,

We have a RedHat Linux 7.1 system running PHP 4.0.4.  It connects to an
oracle database which is sitting behind a firewall.  When a persistent
connection is opened from apache, it apparently times out over the
firewall and gets disconnected.  For various reasons the firewall can't
be changed to eliminate this timeout.

For some reason there is a problem in that PHP doesn't recognize that
the connection is down and merrily continues working until it gets a
database error.

Restarting apache solves the problem temporarily, but it always
reappears.

I also tried php 4.0.6 with no difference in the result.

Does anybody have any ideas?

On an related note, in the changelog for 4.1 it mentions about a fix for
a differnet database problem.  Has anybody back-ported this fix, and if
so, where would I find it?


Thanks in advance.


JBB

 Jonathan B. Bayer  mailto:[EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (MingW32)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAjwEJfoACgkQxQhxe/20cF4laQCgzsTgodmvs4Dc2CmHsg9ADKRs
U0kAnAuPl041oWQ4SgwleCXQEtbBBo3t
=nksA
-END PGP SIGNATURE-


-- 
PHP Database 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-DB] date format question

2001-11-27 Thread Matt Nigh

hi,
i'm wondering if anyone could help me in formatting a date so it is 5 hours ahead of 
the server time.
here's the code i'm using but it doesn't seem to work:

$date = date("F dS, Y g:i:s A", 
mktime(date("g")+5,date("i"),date("s"),date("m"),date("d"),date("Y")) );

i've already looked in the manual and around the net for stuff, but wasn't able to 
find anything for what i needed.
if anyone could help out, i'd appreciate it.

thanks,


Matt



RE: [PHP-DB] date format question

2001-11-27 Thread Beau Lebens

try "H" as your hour format (date("H")+5)

although out of interest, at 9:51am, using either "g" or "H" gives me 2:51
pm

HTH

/beau

// -Original Message-
// From: Matt Nigh [mailto:[EMAIL PROTECTED]]
// Sent: Wednesday, 28 November 2001 9:48 AM
// To: php-db
// Subject: [PHP-DB] date format question
// 
// 
// hi,
// i'm wondering if anyone could help me in formatting a date 
// so it is 5 hours ahead of the server time.
// here's the code i'm using but it doesn't seem to work:
// 
// $date = date("F dS, Y g:i:s A", 
// mktime(date("g")+5,date("i"),date("s"),date("m"),date("d"),da
// te("Y")) );
// 
// i've already looked in the manual and around the net for 
// stuff, but wasn't able to find anything for what i needed.
// if anyone could help out, i'd appreciate it.
// 
// thanks,
// 
// 
// Matt
// 

-- 
PHP Database 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-DB] Oracle row limit support

2001-11-27 Thread Tomas V.V.Cox

Manuel Lemos wrote:
> 
> > >
> > > But it does not work with computed columns like those that apply
> > > functions (COUNT, SUM, SUBSTRING, etc...). The code assumes that you are
> > > actually selecting only real table fields. I think it also does not work
> > > with columns with table name prefixes.
> >
> > That's partially true. But it's a common practise to use column aliases
> > in conyunction with functions (and a must for assoc fetchs) and this is
> > supported by the code I wrote, for ex:
> >
> > select count(field) as count from foo;
> 
> That would work, but you require people to change their queries. I guess
> that does not work as general practice because.
> 
> > Also if Oracle name a sum(foo) column as "sum" will be trivial to add
> > it.

I ran a query without the column alias and seems that Oracle names that
column with the entire name for ex: "sum(foo)". If that is true the
support could be completed.

I'll try it when get some free time or if some kind guy could send the
output of this:

$db = DB::connect("oci8://...");
print_r($db->getRow("select count(somefield) from table",
DB_FETCHMODE_ASSOC));

here, would be so great :-)


Tomas V.V.Cox

-- 
PHP Database 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-DB] Re: Table Locking...

2001-11-27 Thread Benjamin Pflugmann

Hi.

Please stop cross-posting and use the appropriate forum.

On Wed, Nov 21, 2001 at 03:27:23PM -0700, [EMAIL PROTECTED] wrote:
> 
> (PHP-DB folks, ignore this top question - unless you want to answer)
> 
> Which type of DB/Table provides table locking while a process is
> altering data?

ISAM and MyISAM. BDB has page locking. InnoDB has row locking.

>  I don't care for locking while using SELECTs, but I do
> need locking when something's being INSERTed or UPDATEd, so I won't get
> two processes trying to do the same darned thing at the same time.

Well, the above was about implicit locking. If you use LOCK TABLE, you
will always get the whole table locked, I think.

> (MySQL folks, ignore this bottom question - unless you want to
> answer)
>
> I'm trying to go through a table and check for a particular
> information.  If it doesn't exist, then go ahead and issue an INSERT
> with the relevant data.  The next time another process comes along,
> it'll obviously find the information and issue an UPDATE instead.  But,
> what happens if I get two processes running at the same time, trying to
> find information that does not exist yet?

You will get concurrency problems.

More serious answer: There are several solutions to this problem. One
is the beforementioned LOCK TABLE.

> If both issue a SELECT and find the information not there, both will
> try to issue an INSERT, where really I want one of those processes to
> wait for the first one to finish doing whatever it needs to do, prior to
> continuing.  (all of this is being done in PHP by the way).  Does anyone
> have any suggestions for this scenario (or am I just blowing smoke out
> my arse and there's something else, internally, that I'm not aware of?)

No. You have to program your application to take care of this. How
should MySQL know that are want to issue a INSERT after the SELECT?

> When (and how) to issue some sort of "wait" state for one process while
> the other's finishing what it needs to do, then restart the second
> process (which should re-check for existing information, and not blindly
> issue another INSERT right after the first one).

Another method is assure uniqueness via keys and to simply issue the
INSERT and retry with an UPDATE if the INSERT failed (because the row
already existed). In this case you don't need LOCK TABLE.

Bye,

Benjamin.

-- 
[EMAIL PROTECTED]

-- 
PHP Database 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-DB] Coding methods (was RE: [PHP-DB] gzip image files)

2001-11-27 Thread Boget, Chris

> $filename = 'kunden/'.$name.'.png';

I see this all the time and I'm curious:  what takes more
computing power (granted, either would be incredibly little
I'm sure, just curious which requires more work by PHP)?

this:

$filename = "this " . $varname . " that";

or this:

$filename = "this $varname that";

I would think the latter example but am not sure.

Another question, but this is more about personal style:

I almost always use the latter method in my coding practices.  It 
looks cleaner and, IMO, is easier to follow especially when there 
are a number of variables involved.  For those that use the former 
method, why do you?  I'm not trying to be judgemental, just curious
why people do what they do.  In asking, I may actually learn some-
thing. :p

Chris



[PHP-DB] RE: [PHP] Coding methods (was RE: [PHP-DB] gzip image files)

2001-11-27 Thread Jon Haworth

I use the latter style, because otherwise my syntax highlighting doesn't
kick in.

$filename = "this $varname that";   # $filename is in blue, the
rest is in green

$filename = "this". $varname. "that";   # $filename and $varname are in
blue, the rest is in green

I've done it so much now it's burned into a finger macro, takes 0.01
seconds longer to type (approx)

Cheers
Jon



-Original Message-
From: Boget, Chris [mailto:[EMAIL PROTECTED]]
Sent: 27 November 2001 15:29
To: [EMAIL PROTECTED]; '[EMAIL PROTECTED]'
Subject: [PHP] Coding methods (was RE: [PHP-DB] gzip image files)


> $filename = 'kunden/'.$name.'.png';

I see this all the time and I'm curious:  what takes more
computing power (granted, either would be incredibly little
I'm sure, just curious which requires more work by PHP)?

this:

$filename = "this " . $varname . " that";

or this:

$filename = "this $varname that";

I would think the latter example but am not sure.

Another question, but this is more about personal style:

I almost always use the latter method in my coding practices.  It 
looks cleaner and, IMO, is easier to follow especially when there 
are a number of variables involved.  For those that use the former 
method, why do you?  I'm not trying to be judgemental, just curious
why people do what they do.  In asking, I may actually learn some-
thing. :p

Chris



**
'The information included in this Email is of a confidential nature and is 
intended only for the addressee. If you are not the intended addressee, 
any disclosure, copying or distribution by you is prohibited and may be 
unlawful. Disclosure to any party other than the addressee, whether 
inadvertent or otherwise is not intended to waive privilege or confidentiality'

**

-- 
PHP Database 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]