Re: [PHP-DB] Connecting to Oracle

2001-03-13 Thread Paul

Joe,

I have had some tough problems changing SIDs in oracle via PHP.  If your
tnsnames.ora file correctly defines the SID, you may not need to declare it
again via PHP.

if you run phpinfo(), see if these values are already defined, and then try
to connect with default values...

--

""Joe Brown"" <[EMAIL PROTECTED]> wrote in message
98loaj$m76$[EMAIL PROTECTED]">news:98loaj$m76$[EMAIL PROTECTED]...
> I'm not looking forward to this...  Due to circumstances beyond my
control,
> I will be forced into a similar configuration soon.
>
> Try putenv("ORACLE_SID=WKDS.world");
> If your sqlnet.ora does does not specify .world as the default domain,
then
> that may be the problem.
>
> Was your TNSNAMES.ORA file ftp'd from somewhere to where it is now?
>   If so, did you use the ascii or text mode option?
>
> HTH
>
> "Herbert Groot Jebbink" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hello,
> >
> > I have problems connecting with PHP to Oracle.
> >
> > - Operating system is Windows 95
> > - Apache version is 1.3.14
> > - The PHP version is 4.04pl1 (NuSphere 1.13.6)
> > - The line "extension=php_oracle.dll" is active in php.ini
> > - De Oracle Database version is 7.3.4.0.0
> > - De SQL*NET client version is 2.3.4.0.0
> > - Using the SQL PLUS 3.3.4.0.0 client on this machine works fine:
> > - The ociw32.dll file is in the path of the webserver
> >
> > The test program is:
> >
> >   >   putenv('ORACLE_HOME=c:\orawin95');
> >   putenv("ORACLE_SID=WKDS");
> >   $conn = ora_logon("hgj@wkds", "hgj");
> >  ?>
> >
> > The result is:
> >
> >  Warning: Unable to connect to ORACLE (ORA-12154: TNS:could not resolve
> >  service name) in /www/data/ontwikkel/test/php/test3.php on line 4
> >
> > I have lookup the ORA-12154 error and it talks about the tnsnames.ora
> > file, this file is located in c:\orawin95\network\admin\ and I have set
> > ORACLE_HOME to c:\orawin95, so it must find that file, the part
> > of the database in tnsnames.ora is below.
> >
> > wkds.world =
> >   (DESCRIPTION =
> > (ADDRESS_LIST =
> > (ADDRESS =
> >   (COMMUNITY = tcp.world)
> >   (PROTOCOL = TCP)
> >   (Host = rnwux1)
> >   (Port = 1521)
> > )
> > (ADDRESS =
> >   (COMMUNITY = tcp.world)
> >   (PROTOCOL = TCP)
> >   (Host = rnwux1)
> >   (Port = 1526)
> > )
> > )
> > (CONNECT_DATA = (SID = WKDS)
> > )
> >   )
> >
> >
> > Greetings, Herbert
> >
> > --
> > 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] MySQL denying access to...everything

2004-08-18 Thread Paul
Also, take care with the new password hashing:
http://dev.mysql.com/doc/mysql/en/Password_hashing.html

Paul


On Wed, 18 Aug 2004 00:56:08 -0700, Peter Ellis <[EMAIL PROTECTED]> wrote:
> This is a MySQL error on the server side - you need to make sure that
> whatever user you're signing into MySQL with has access to modify the
> database/table you're using.  I believe the GRANT keyword in MySQL is
> what you need -- look at the MySQL reference manual:
> 
> http://dev.mysql.com/doc/
> 
> Good luck!
> --
> Peter Ellis - [EMAIL PROTECTED]
> Web Design and Development Consultant
> naturalaxis | http://www.naturalaxis.com/
> 
> 
> 
> 
> On Tue, 2004-08-17 at 23:03 -0400, [EMAIL PROTECTED] wrote:
> > I finally got my PHP5 installation to support MySQL and now this. When I try
> > to edit anything on mysqlgui.exe, it just gives me this error: error in
> > database function: access denied for user @localhost...
> >
> > I don't know if this has to do with my php installation or what. If not,
> > flame me for all I care. I'm too sick of all this mess to care.
> >
> > ...somebody help...
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

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



Re: [PHP-DB] Re: Date Conversion

2004-08-18 Thread Paul
You might want to look into date conversion on the MySQL side:

http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html

Look for 

DATE_FORMAT(date,format)

Paul


On Wed, 18 Aug 2004 10:16:59 +0200, Torsten Roehr <[EMAIL PROTECTED]> wrote:
> >"Ng Hwee Hwee" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> 
> 
> >Hi all,
> >
> >can someone kindly point me to a resource that converts all kinds of
> possible date inputs into MySQL format of -MM-DD?
> >
> >example of formats to be converted includes:
> >
> >d/m/yy
> >d/m/
> >d/mm/yy
> >d/mm/yyy
> >dd/mm/yy
> >dd/mm/yyy
> >d/mmm/yy
> >d/mmm/
> >dd/mmm/yy
> >dd/mmm/
> >
> >yy   - 2 digit representation of year
> >   - ful numeric representation of year
> >m   - numeric representation of month, without leading zero
> >mm- numeric representation of month, with leading zero
> >mmm - short textual representation of month
> >d   - day of month without leading zero
> >dd - day of month with leadin zero
> >
> >thanx!
> >
> >hwee
> 
> This question belongs more to the general list, but anyway:
> 
> You can use strtotime() to convert various formats to a timestamp. Then use
> date() to convert it back to your preferred date format:
> 
> $timestamp = strtotime($inputDate);
> $isoDate   = date('Y-m-d', $timestamp);
> 
> http://de2.php.net/strtotime
> http://de2.php.net/manual/en/function.date.php
> 
> Regards, Torsten Roehr
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

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



[PHP-DB] Spaces Problem php & mysql

2002-05-01 Thread Paul

I have a form on one server which takes a name in one field, intentionally 
including spaces as a full name. That value shows up as a form variable as I 
intended when I display it on the same server. It is sent to another server 
and written to a mysql database there. At that time, only the first word in 
the field is written. When the value is returned by the same php script that 
received and wrote the database, the only thing left in the field is the 
first word. Length of the word seems to have nothing to do with this.

I've been pounding my head (and the keyboard with searches) over this. Do I 
have to take the first entry apart with string functions to get my desired 
end, which is the entire name in one field in the database?

TIA,
Paul

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




[PHP-DB] The Dreaded Oracle 8 TNS:ORA-12154 Connection Error

2001-05-04 Thread Paul

I am running PHP 4.0.4pl1 in CGI mode on Windows NT4 SP6, using Apache or IIS Web 
Server's.

I am concentrating on Apache for this problem as it is identical irrespective of the 
Web Server.

I'm using one of the simplest possible connection mechanisms ...

if ($conn=Ora_Logon("user@mydatabase","pass"))
{
echo "SUCCESS ! Connected to database\n";
Ora_Logoff($conn);
}
else
{
echo "Failed :-( Could not connect to database\n";
}

This works fine if PHP is run as an apache module but fails with the message 

"Warning: Oracle: Connection Failed: ORA-12154: TNS:could not resolve service name in 
c:\program files\apache group\apache\htdocs\ora.php on line 10"

When Apache is re-configured to run PHP as CGI (other html on the same page suce as 
phpinfo() shows up just fine).

At first I thought the Apache user may have been affecting privileges but the Apache 
"User" option doesn't work under Windows & I even tried running Apache as a service 
using the Administrator
account - no change. Have tried environment paths to ORACLE_HOME, TNS_PATH etc. etc. 
etc. all to no avail. We use sqlnet.ora with an oracle name server.

I have to use CGI as PHP4 isn't to production level for use as a Filter with IIS & 
corporate policy dictates that I must prove PHP against ASP on the existing IIS server 
before I can even attempt using
Apache.

I would greatly appreciate any construction :-) advise anyone can offer.

Regards, Paul Shortis


-- 
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] The Dreaded Oracle 8 TNS:ORA-12154 Connection Error

2001-05-07 Thread Paul

I am running PHP 4.0.4pl1 in CGI mode on Windows NT4 SP6, using Apache or IIS Web 
Server's.

I am concentrating on Apache for this problem as it is identical irrespective of the 
Web Server.

I'm using one of the simplest possible connection mechanisms ...

if ($conn=Ora_Logon("user@mydatabase","pass"))
{
echo "SUCCESS ! Connected to database\n";
Ora_Logoff($conn);
}
else
{
echo "Failed :-( Could not connect to database\n";
}

This works fine if PHP is run as an apache module but fails with the message 

"Warning: Oracle: Connection Failed: ORA-12154: TNS:could not resolve service name in 
c:\program files\apache group\apache\htdocs\ora.php on line 10"

When Apache is re-configured to run PHP as CGI (other html on the same page suce as 
phpinfo() shows up just fine).

At first I thought the Apache user may have been affecting privileges but the Apache 
"User" option doesn't work under Windows & I even tried running Apache as a service 
using the Administrator
account - no change. Have tried environment paths to ORACLE_HOME, TNS_PATH etc. etc. 
etc. all to no avail. We use sqlnet.ora with an oracle name server.

I have to use CGI as PHP4 isn't to production level for use as a Filter with IIS & 
corporate policy dictates that I must prove PHP against ASP on the existing IIS server 
before I can even attempt using
Apache.

I would greatly appreciate any construction :-) advise anyone can offer.

Regards, Paul Shortis


-- 
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] The Dreaded Oracle 8 TNS:ORA-12154 Connection Error

2001-05-09 Thread Paul

Hi Folks,

Well, thanks to a posting by Benoit Noss on 2001-01-04 I solved my problem.

Benoit's solution was to strip carriarge returns from Tnsnames.ora (remember we are 
talking Windows/DOS text files here - I would dearly love to change to a Unix box but 
our web site uses an ActiveX library that isn't available on unix).

Since we use a name server we mainly depend on Sqlnet.ora. I stripped the CR's from 
Sqlnet.ora by ftp'ing it to a unix host in ascii mode then retrieving it binary mode 
(didn't have an alternative tool at hand), re-started Apache/CGI and all was well. I 
tested with php4 as both a module and CGI and everything now works well.

You might like to strip the CR's from Tnsnames.ora as well as most Sqlnet.ora's fall 
back to Tnsnames.ora if they can't locate the service on an Oracle name server.

I tested, Oci8 connect, odbc connect and ADO. This may be of interest to Unix users 
having similar problems...many Oracle installs have two copies of Sqlnet.ora and 
Tnsnames.ora, in my case Oci8 uses the ones under ORACLE_HOME\Net80\Admin\ and odbc 
connects uses those under ORACLE_HOME\Network\Admin. This may be why stripping CR's 
from Tnsnames.ora has failed to work for some people.

On our production web server Oci AND odbc uses ORACLE_HOME\Net80\Admin\ but ADO (COM) 
uses ORACLE_HOME\Network\Admin even though the specified driver is {Oracle ODBC 
Driver} (go figure).

So a general rule of thumb on Windows servers would be to strip CR's from ALL copies 
of Sqlnet.ora and Tnsnames.ora. On unix boxes when you set the TNS_ADMIN environment 
variable before attempting an Orcale connect, ensure that it is pointing to the 
directory that actually contains Sqlnet.ora/Tnsnames.ora that your oracle client will 
be using (& make sure ORACLE_HOME is set of course).

I haven't yet figured why without stripping the CR's from the .ora files that oracle 
connects succeed when php4 is loaded as a module but fails when it is run as CGI...but 
I have noticed that some environment variables dumped using phpinfo() are different 
(such as USERPROFILE)...maybe ??? Anyway, haven't got time to delve further now, it 
can wait until I have some spare time.

Thanks to all, especially Benoit.

Paul Shortis

The following message was sent by "John Edward Molano" <[EMAIL PROTECTED]> on Wed, 9 
May 2001 15:32:54 -0500.

> Hi
> 
> I have the even error but in oracle 7.3.3, this is:
> 
> Warning: Oracle: Connection Failed: ORA-12154: TNS:no se ha podido resolver
> el nombre del servicio in
> C:\Inetpub\wwwroot\websuperII\pruebas\ConexionOracle.php on line 7
> Error conectando a la base de datos.
> 
> Do you already have the solution? if yes, please send me it.
> 
> Thanks
> 
> John Molano
> 
> 
> 
> 
> - Original Message -
> From: "Paul" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, May 07, 2001 10:30 PM
> Subject: [PHP-DB] The Dreaded Oracle 8 TNS:ORA-12154 Connection Error
> 
> 
> > I am running PHP 4.0.4pl1 in CGI mode on Windows NT4 SP6, using Apache or
> IIS Web Server's.
> >
> > I am concentrating on Apache for this problem as it is identical
> irrespective of the Web Server.
> >
> > I'm using one of the simplest possible connection mechanisms ...
> >
> > if ($conn=Ora_Logon("user@mydatabase","pass"))
> > {
> > echo "SUCCESS ! Connected to database\n";
> > Ora_Logoff($conn);
> > }
> > else
> > {
> > echo "Failed :-( Could not connect to database\n";
> > }
> >
> > This works fine if PHP is run as an apache module but fails with the
> message
> >
> > "Warning: Oracle: Connection Failed: ORA-12154: TNS:could not resolve
> service name in c:\program files\apache group\apache\htdocs\ora.php on line
> 10"
> >
> > When Apache is re-configured to run PHP as CGI (other html on the same
> page suce as phpinfo() shows up just fine).
> >
> > At first I thought the Apache user may have been affecting privileges but
> the Apache "User" option doesn't work under Windows & I even tried running
> Apache as a service using the Administrator
> > account - no change. Have tried environment paths to ORACLE_HOME, TNS_PATH
> etc. etc. etc. all to no avail. We use sqlnet.ora with an oracle name
> server.
> >
> > I have to use CGI as PHP4 isn't to production level for use as a Filter
> with IIS & corporate policy dictates that I must prove PHP against ASP on
> the existing IIS server before I can even attempt using
> > Apache.
> >
> > I would greatly appreciate any construction :-) advise anyone can offer.
> >
> > Regards, Paul Shortis
> >
> >
> > --
> > 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] commence database

2001-12-05 Thread Paul.

Hello all,
Has anyone heard about php reading the commence database? im very interested
in this one because i use commence all the time and it would be handy to do
things over the web aswell as infront of the machine... has anyone heard
anymore about it?

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] Gnarley drop-down db problem

2003-06-11 Thread Paul
I have a user maintenance script. In the address maintenance page there 
is a drop down for the country entry. First, I retrieve the address info 
from a MySQL table. Globals are off, so I initialize the variables in 
the input with $country=$_GET['country']. In the country drop down I have

>United States

and so forth for each country. This works beautifully, except that 
changes are not saved from this and sent to the database. I have, in the 
validation script (an included script), an initialization of the 
variables as $country = $_POST['country'] for later use since it makes 
for shorter coding later in the routines.

Can anybody help with ideas about how I can capture the change to the 
drop down country entry? Or, why is the original value passed instead of 
the new one? I suspect my need to initialize with the $_GET, but I can't 
figure out how to both get the value from the query string and then send 
the changed value in the drop down.

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


Re: [PHP-DB] Gnarley drop-down db problem

2003-06-11 Thread Paul
Please disregard. I found an idiotic typo in my code ;-)

Paul



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


[PHP-DB] PHP Objects and SQL Results

2010-02-12 Thread Paul

Hi all,

I'm currently having a problem correctly formatting a table within a 
while loop.  I'm using an object to store the results of a query, and 
using the while to iterate through it each row to produce the output:


$query = "SELECT * FROM foo WHERE UserID = " .$uID . " ORDER BY bar";
$result = mysql_query($query);

while($obj = mysql_fetch_object($result))
{
$obj->bar;
}

To properly format the table, I need to check the value of bar in the 
next iteration of the object (but have to do it on the current one). 
Using an array, I would do:


next($obj);
if($obj["bar"] == "something")
{
//do things
}
prev($obj);

Is there an equivalent to object?  I've tried the above method, but 
nothing happens.  I've also tried type casting it to an array, without 
success.


Is there anyway to iterate through this?

Thanks,
Paul

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



[PHP-DB] Re: [PHP] Re: [PHP-DB] Easy MySQL question

2001-01-12 Thread Paul DuBois

At 10:10 AM -0500 1/12/01, Leonard T. Harris wrote:
>What's wrong with
>
>$number=mysql_num_rows($result);
>echo "The total number of rows is $number";

Primarily that mysql_num_rows() tells you how many rows are in the
result set, which for the query in question, is 1.  The *content*
of that row is how many rows are in the table.

>
>
>- Original Message -
>From: Julie Meloni <[EMAIL PROTECTED]>
>To: Paulson, Joseph V. "Jay" <[EMAIL PROTECTED]>
>Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
>Sent: Thursday, January 11, 2001 11:17 AM
>Subject: [PHP] Re: [PHP-DB] Easy MySQL question
>
>
>>  Paulson, Joseph V. \"Jay\" wrote:
>>
>>  > Hello everyone--
>>  > I've got a easy question that I can't seem to answer for myself.  I'm
>>  > running a query in MySQL and want to know how many entries are in a
>table
>>  > and then echo that out onto a page.  I thought this would be easy but I
>>  > don't know why it's not working.  Anyway, here's what I am doing:
>>  >
>>  > (open db connection)
>>  >
>>  > $query = "SELECT count(*) FROM Movie";
>>  > $result = mysql_query($sql, $dbLink);
>>  > $myrow = mysql_result($result);
>>  > echo $myrow;
>>  >
>>
>  > $myrow = mysql_result($result,0,"count(*)");


-- 
Paul DuBois, [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] ENUM type

2001-01-15 Thread Paul DuBois

At 9:49 PM +0700 1/15/01, Cahyo S. Aji wrote:
>I don't know what is the benefit if we use ENUM type.
>can everybody explain it?

Examples:

It looks like a character column, but it's represented as an integer,
so operations on it can be quite fast.  The numeric representation
also takes less space, in most cases.

By using it, you make the legal values for a column explicit in the
column definition.

You can look up the legal values for the column from within programs.
For example, you can parse SHOW COLUMNS LIKE 'col_name' output to get
the legal enumeration values, then use them to construct a set of
radio buttons or a popup menu in a web form. That way your form always
presents exactly the legal options for the column.

You can also use the column definition when validating submitted forms
to make sure the value submitted is legal.

-- 
Paul DuBois, [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] insert in mysql

2001-01-25 Thread Paul Burney

on 1/25/01 1:12 PM, Robert ([EMAIL PROTECTED]) wrote:

> Still not working right though
> 
> if($act=="ADD"){
> $sql="INSERT INTO ecomm (ID,part) VALUES ('$sid','$spp')";
> if(! mysql_query('$sql')){echo("Unable to add
> part.");mysql_close($db);exit();}
> }

Why the single quotes around $sql.  It's a string so you shouldn't have to
quote it at all.

if (!mysql_query($sql)) {echo 'Unable to add part!'; }

++
Paul Burney
Webmaster and Internet Developer
Educational Technology Unit
Graduate School of Education and Information Studies
University of California, Los Angeles
(310) 825-8365
<[EMAIL PROTECTED]>
<http://www.gseis.ucla.edu/>
++


-- 
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] Returning a formated dat

2001-02-02 Thread Paul DuBois

At 9:13 AM + 2/2/01, Ben Cairns wrote:
>I have a date stored in a MySQL field in a format like this:
>
>For example, 02/02/2001 (Today) would be stored as:
>02022001
>
>What I need to do is to format that so that it looks like:
>02/02/2001

I assume you really have this stored as a CHAR column, because you
can't store a date as 02022001.  On that assumption, you can format
the string like this:

SELECT
 CONCAT(
 LEFT(d,2),
 "/",
 MID(d,3,2),
 "/",
 RIGHT(d,4))
FROM t;


>
>-- Ben Cairns - Head Of Technical Operations
>intasept.COM
>Tel: 01332 365333
>Fax: 01332 346010
>E-Mail: [EMAIL PROTECTED]
>Web: http://www.intasept.com
>
>"MAKING sense of
>the INFORMATION
>TECHNOLOGY age
>@ WORK.."


-- 
Paul DuBois, [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] passing object elements in urls

2001-02-06 Thread Paul Cooper

On Tue, Feb 06, 2001 at 05:46:25PM +, Darryl Friesen wrote:
> > Got a slight problem. I'm attempting to pass a number of variables from
> > one form to another. The problem occurs when one of the object elements
> > contains more than one word.
> 
> [snip]
> 
> 
> > Any idea how to pass object elements with spaces in a URL?
> 
> Try encoding the spaces as %20 (the hex value for a space).  There's
> probably a PHP function to do this for you (and one to do the reverse) -- I
> haven't looked.

Yes there are: urlencode() and urldecode()

http://www.php.net/manual/en/function.urlencode.php 
http://www.php.net/manual/en/function.urldecode.php 

Paul

> 
> You could try using a + instead of a space too.
> 
> 
> - Darryl
> 
>  --
>   Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
>   Education & Research Technology Services, http://gollum.usask.ca/
>   Department of Computing Services,
>   University of Saskatchewan
>  --
>   "Go not to the Elves for counsel, for they will say both no and yes"
> 
> 
> 
> -- 
> 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]

-- 
-
Paul Cooper |  Tel: 0121 331 7858
Senior Programmer and Database Engineer |  Fax: 0121 687 7859
UCEcom  |  mailto:[EMAIL PROTECTED]
University of Central England   |  http://www.ucecom.com
Birmingham, B4 7DX  |
-

-- 
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 client --> informix-se

2001-02-12 Thread Paul Gardiner

Hello Luigi,

I'm afraid before you're able to use the informix database it will have to
be upgraded to at least version 7.x. We have SCO Openserver 5.0.4 running
the Informix SE 7.2 with PHP4 and Apache and all works well. We too have an
NT server but would not even entertain the idea of running the web server
from there. For us the unix box is so much more reliable.

Regards,
- Paul -

- Original Message -
From: "Luigi Casiraghi" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 09, 2001 10:10 PM
Subject: [PHP-DB] php client --> informix-se


> Dear all,
>
> I have a  question for you.
>
> Given the following configuration:
>
> - One NT machine with Apache 3.14 and php4 (from www.php4.de) installed
>(the one that should act like client)
> - One Sco_SV system Release 3.2v5.0.5 with INFORMIX-SE Version 5.10.UD1
>(the server)
>
> Are my SCO-UNIX Release and INFORMIX-SE Version  suitable for use
> with PHP4 ?
>
> I would like to create php4 scripts that connect from the NT machine
> to the Informix Server, execute query, etc to diplay formatted data
> throught Apache.
>
> PHP has been configured to use the php_ifx.dll but when I execute
> a simple script with only phpinfo() to see php configuration I receive
> the following message:
>
> "can't find the dinamyc library isqlt09a.dll in the specified path"
>
> and as a consegunce
>
> "cant load php_ifx.dll..."
>
> the fact is that there isn't the file isqlt09a.dll on the NT system.
>
> what file is it ?
>
> What are the pieces I need to complete the puzzle and where can I get
> them ?
>
> a great thanks in advance to everyone that can give me an help.
>
> bye,
>
> Luigi Casiraghi
> [EMAIL PROTECTED]
> Italy
>
>
> --
> 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] Microsoft SQL Server and views

2001-02-15 Thread Paul Clements

Hi,

Sorry if this has been asked before but I've looked everywhere and not found
the answer to the question
Can you access views from mssql_query?

I seem to be getting Invalid Object Name reported back to me.

Any help would be appreciated

Thanks

Paul Clements



-- 
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] AUTO_INCREMENT

2001-03-04 Thread Paul Burney

on 3/4/01 3:58 AM, Joris Kluivers at [EMAIL PROTECTED] wrote:

> CREATE TABLE chatmessages (id tinyint(6) DEFAULT '0' NOT NULL
> AUTO_INCREMENT, message text, username varchar(100), UNIQUE id (id);

> with php.
> But after some time i get the error:
> ERROR 1062: Duplicate entry '127' for key 1
> but how can this be because i've set it to AUTO_INCREMENT.

That's the limit of the TINYINT type.  ALTER TABLE and change the type to
INT.

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] meta tag inside php / redirect / refresh

2001-03-16 Thread Paul Gardiner

Hi Marc,

Try this - untested and I'm very sleepy, but should get you closer ;o)



Refresh Test
http://www.chescolawyers.com/BB/index2.shtml\">";
?>



Regards,
- Paul -



- Original Message - 
From: "Marc Bragg" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 16, 2001 4:09 AM
Subject: [PHP-DB] meta tag inside php / redirect / refresh


> Crazy after hours of syntax. How do you insert php code so that on
> different results, 1 or 0, a different the resulting html page is
> redirected or refreshed to a dfiferent url . . . . i tried:
> 
>  content="5;URL=http://www.chescolawyers.com/BB/index2.shtml">
> ?>
> 
>  to no avail.
> 
> help
> 
> thanx
> 
> 
> 
> -- 
> 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] works on production server but not on localhost

2003-11-19 Thread Paul Ihrig
i don't have a security tab under properties when just browsing the
directory.

i only get a "Directory Security" tab when i am in the "Internet Information
Services"

there i have "Anonymous access" checked
User name IUSR_BAlgh
pass *

Allow IIS to control password checked
also Integrated Windows authentication checked.

seems funky...
i appreciate the help guys.
-paul

-Original Message-
From: J.Veenhuijsen [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 19, 2003 8:27 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] works on production server but not on localhost


Try setting security settings on directory itself eg full control for
IUSR_..

to do this right click on directory ->propertys-> security  add a user
IUSR_... and give full access

Works fine for me

Jochem



Paul Ihrig wrote:
> already tried that
> read write execute scripts.
> no go
>
>
> -Original Message-
> From: mustafa ocak [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, November 19, 2003 7:54 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] works on production server but not on localhost
>
>
>
> Settings -> Control Panel -> Administrative Tools ->Internet Services
> Manager
>
> Click the "Default Web Site" on the list, directories will be shown
> Right click the directory the files reside and Select "Properties"
>
> You can give write permission to the directory here.
>
> HTH
>
> Mustafa
>
> - Original Message -
> From: "Paul Ihrig" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, November 19, 2003 2:44 PM
> Subject: RE: [PHP-DB] works on production server but not on localhost
>
>
>
>>ok...
>>im on xp running iis win
>>i tried to figure out how to change permissions on files & did a few
>
> example
>
>>but it never seemed to work.
>>is there a free chmod tool?
>>
>>or a simple way to do it in windows?
>>
>>again, i am sure i sound noob, and am...
>>thanks for the response.
>>
>>-paul
>>
>>-Original Message-
>>From: mustafa ocak [mailto:[EMAIL PROTECTED]
>>Sent: Wednesday, November 19, 2003 7:32 AM
>>To: [EMAIL PROTECTED]
>>Subject: Re: [PHP-DB] works on production server but not on localhost
>>
>>
>>You are probably right, it looks like a permission problem.
>>What is the OS (win, Linux) of your machine?
>>
>> It's not about PHP.INI, If your operating system is Windows give write
>>permission to the directory these text files reside.
>>You can do it by using Internet Services Manager
>>
>>If it is a unix box (linux included) you can use
>>  "chmod a+rw filename"   or
>>  "chmod 771 filename"
>>
>>to give write permission on these files  to everybody.
>>Maybe you have to give write permission to the directory too, I'm not sure
>>about it.
>>
>>
>>HTH
>>
>>Mustafa
>>
>>
>>- Original Message -
>>From: "Paul Ihrig" <[EMAIL PROTECTED]>
>>To: <[EMAIL PROTECTED]>
>>Sent: Wednesday, November 19, 2003 2:16 PM
>>Subject: [PHP-DB] works on production server but not on localhost
>>
>>
>>
>>>hey guys..
>>>just getting back in to using a little php.
>>>
>>>have 2 simple hit counters that work fine on the production server.
>>>but on my localhost it throughs several errors. looks like a permissions
>>>thing?
>>>
>>>i am not sure if there is a setting in my php.ini file that needs to be
>>>tweaked.
>>>kind of blind to the errors.
>>>
>>>looks like a permissions thing?
>>>
>>>hit counter: Warning: fopen("counterlog.txt", "w") - Permission denied
>>
> in
>
>>>C:\Inetpub\wwwroot\WCBE\counter.php on line 4 Warning: fwrite():
>>
> supplied
>
>>>argument is not a valid File-Handle resource in
>>>C:\Inetpub\wwwroot\WCBE\counter.php on line 5 Warning: fclose():
>>
> supplied
>
>>>argument is not a valid File-Handle resource in
>>>C:\Inetpub\wwwroot\WCBE\counter.php on line 6 12
>>>hit counter2: 1
>>>
>>>Warning: fopen("FX_DataCounter/wcbecounter.txt", "r+") - Permission
>>
> denied
>
>>>in C:\Inetpub\wwwroot\WCBE\nav.php on line 19 Warning: fgets(): supplied
>>>argument is not a valid File-Handle resource in
>>>C:\Inetpub\wwwroot\WCBE\nav.php on line 20 Warning: Cannot send session
>>>cookie - headers already sent by (output started at

RE: [PHP-DB] works on production server but not on localhost

2003-11-19 Thread Paul Ihrig
it's ntfs

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



RE: [PHP-DB] works on production server but not on localhost :: fix

2003-11-19 Thread Paul Ihrig
how weird is this
just had to uncheck "allow anonymous access".
and keep checked "Integrated Windows authentication"

just seems a bit silly...
every thing works fine now.

thanks for the help!
will have better questions for you all in a day or so...
-paul

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



[PHP-DB] RE: Subject: Hitcounter works on production server but not on localhost

2003-11-20 Thread Paul Ihrig
hey niel.
thanks man...
thats wierd, why does it need to be full?

how would i have been able to figure that out?
appreciate it..

-Original Message-
From: Neil Smth [mailto:[EMAIL PROTECTED]
Sent: Thursday, November 20, 2003 12:53 PM
To:
Cc: [EMAIL PROTECTED]
Subject: Re: Subject: Hitcounter works on production server but not on
localhost


Its not a permissions thing. You need to ensure that you provide PHP with a
full path to the hit counter file :

countrerlog.txt is a relative path.
c:\\Inetpub\\wwwroot\\WCBE\\countrterlog.txt is a full path.

You need to do the same with the relative path to
FX_DataCounter/wcbecounter.txt as well

Cheers - Neil.

At 13:25 20/11/2003 +, you wrote:
>From: "Paul Ihrig" <[EMAIL PROTECTED]>
>Date: Wed, 19 Nov 2003 07:16:11 -0500
>Subject: works on production server but not on localhost
>
>hey guys..
>just getting back in to using a little php.
>
>have 2 simple hit counters that work fine on the production server.
>but on my localhost it throughs several errors. looks like a permissions
>thing?
>
>i am not sure if there is a setting in my php.ini file that needs to be
>tweaked.
>kind of blind to the errors.
>
>looks like a permissions thing?
>
>hit counter: Warning: fopen("counterlog.txt", "w") - Permission denied in
>C:\Inetpub\wwwroot\WCBE\counter.php on line 4 Warning: fwrite(): supplied
>argument is not a valid File-Handle resource in
>C:\Inetpub\wwwroot\WCBE\counter.php on line 5 Warning: fclose(): supplied
>argument is not a valid File-Handle resource in
>C:\Inetpub\wwwroot\WCBE\counter.php on line 6 12
>hit counter2: 1

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



[PHP-DB] Oracle/PHP Issue

2003-12-04 Thread Paul Miller
Hello,

I am having a strange issue with Oracle and PHP.  I am running PHP Version
4.3.4 on Red Hat AS 2.3 and trying to connect to Oracle 9i also on Red Hat
AS 2.3.

I compiled PHP successfully with OCI and oracle.  My script uses the
ocilogon($user, $password, $db); or ora_logon($user.'@'.$db, $password);
depending on what interface I want to use in my abstraction layer.

Note: All oracle failures (*** some error ***) are when I use the ora_logon,
ocilogon, or the ocinlogon.

Info about what works:

 - PHP can at lease partially talk to the remote Oracle DB.

 - If I give a bad username or password, PHP returns *** Oracle: Connection
Failed: ORA-01017: invalid username/password; logon denied.***  So I know
PHP is able to validate the username against the remote Oracle database.

 - If I give an unspecified TNS name, "BDB1_broken", instead of "BDB1" which
is in the tnsnames.ora file, I get the following Oracle message though PHP:
*** Oracle: Connection Failed: ORA-12154: TNS:could not resolve service name
***.  So I know that the TNS name is being verified against the remote
database.

- When I try to logon to the remote DB with SQLPlus using the same
tnsnames.ora file used by PHP, I can logon just fine.  Also, a plsql stored
procedure running off a DAD on the server works.

THE PROBLEM:
When I use the correct username, password and ORACLE_SID, I get the
following error:

*** Oracle: Connection Failed: ORA-12545: Connect failed because target host
or object does not exist ***

I have:
 - Tried specifying the DB connection in the PHP code
$DATABASE = "(DESCRIPTION =
(ADDRESS_LIST =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.2)(PORT = 1521))
)
(CONNECT_DATA =
  (SERVICE_NAME = BDB1.world)
)
 )";
 - Tried using the IP address "192.168.2.2" and the host name both in the
PHP and the tnsnames file.
 - Added apache and nobody to the oracle and the dbs groups.
 - Setting different environment vars in the PHP code
putenv("ORACLE_HOME=/opt/ora9/product/9201");
putenv("ORACLE_SID=BDB1")
 - Recompiling PHP
 - Using "BDB1" and "BDB1.PROD_DATABASE.MY_DOMAIN.COM" in the putenv and the
database name in the connection function.
 - Checked the Apache config
##ORACLE ENVIRONMENT
ORACLE_HOME=/opt/ora9/product/9201
ORACLE_BASE=/opt/ora9/
export ORACLE_HOME ORACLE_BASE
ORACLE_TERM=vt100
LD_LIBRARY_PATH=$ORACLE_HOME/lib
PATH=$ORACLE_HOME/bin:$PATH
export PATH LD_LIBRARY_PATH
ORACLE_DOC=$ORACLE_BASE/doc
ORACLE_SID=BDB1
TNS_ADMIN=/opt/ora9/product/9201/network/admin
export ORACLE_DOC ORACLE_SID TNS_ADMIN


Does anyone have any thoughts

Thanks for any help,

Paul

___
Paul Miller
System-Wise
pmillerATsystemDASHwiseDOTcom
AT = @
DASH = -
DOT = .




RE: [PHP-DB] Splitting a string by a ,

2003-12-05 Thread Paul Miller
if the emails are in a CSV file, you can also use "fgetcsv"

\n";
}
}
fclose ($handle);
?>

- Paul

-Original Message-
From: Chris Payne [mailto:[EMAIL PROTECTED]
Sent: Friday, December 05, 2003 1:23 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Splitting a string by a ,


Hi there everyone,

I'm trying to split a string into an Array by a , but I kepe getting errors.
Looking at the PHP manual, I thought it would be this way:

$keywords = preg_split(",", $email);

But it keeps saying that the , isn't an ending delimiter?

Any help would be appreciated, i'm trying to split email addresses from an
input box seperated by a ,

Thanks for any help.

Chris

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



RE: [PHP-DB] Re: Oracle/PHP Issue

2003-12-05 Thread Paul Miller
Nope, that was not it? Still giving me the *** ORA-12545: Connect failed
because target host or object does not exist *** error.

Hm

- Paul

-Original Message-
From: Justin Patrin [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 04, 2003 4:23 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: Oracle/PHP Issue


I'm using the descriptor type of connection and it looks a bit different
than yours. Try changing your CONNECT_DATA setion to:

(CONNECT_DATA = (SID = BDB1) (GLOBAL_NAME = BDB1.world))

Paul Miller wrote:

> Hello,
>
> I am having a strange issue with Oracle and PHP.  I am running PHP Version
> 4.3.4 on Red Hat AS 2.3 and trying to connect to Oracle 9i also on Red Hat
> AS 2.3.
>
> I compiled PHP successfully with OCI and oracle.  My script uses the
> ocilogon($user, $password, $db); or ora_logon($user.'@'.$db, $password);
> depending on what interface I want to use in my abstraction layer.
>
> Note: All oracle failures (*** some error ***) are when I use the
ora_logon,
> ocilogon, or the ocinlogon.
>
> Info about what works:
>
>  - PHP can at lease partially talk to the remote Oracle DB.
>
>  - If I give a bad username or password, PHP returns *** Oracle:
Connection
> Failed: ORA-01017: invalid username/password; logon denied.***  So I know
> PHP is able to validate the username against the remote Oracle database.
>
>  - If I give an unspecified TNS name, "BDB1_broken", instead of "BDB1"
which
> is in the tnsnames.ora file, I get the following Oracle message though
PHP:
> *** Oracle: Connection Failed: ORA-12154: TNS:could not resolve service
name
> ***.  So I know that the TNS name is being verified against the remote
> database.
>
> - When I try to logon to the remote DB with SQLPlus using the same
> tnsnames.ora file used by PHP, I can logon just fine.  Also, a plsql
stored
> procedure running off a DAD on the server works.
>
> THE PROBLEM:
> When I use the correct username, password and ORACLE_SID, I get the
> following error:
>
> *** Oracle: Connection Failed: ORA-12545: Connect failed because target
host
> or object does not exist ***
>
> I have:
>  - Tried specifying the DB connection in the PHP code
> $DATABASE = "(DESCRIPTION =
> (ADDRESS_LIST =
>   (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.2)(PORT = 1521))
> )
> (CONNECT_DATA =
>   (SERVICE_NAME = BDB1.world)
> )
>  )";
>  - Tried using the IP address "192.168.2.2" and the host name both in the
> PHP and the tnsnames file.
>  - Added apache and nobody to the oracle and the dbs groups.
>  - Setting different environment vars in the PHP code
> putenv("ORACLE_HOME=/opt/ora9/product/9201");
> putenv("ORACLE_SID=BDB1")
>  - Recompiling PHP
>  - Using "BDB1" and "BDB1.PROD_DATABASE.MY_DOMAIN.COM" in the putenv and
the
> database name in the connection function.
>  - Checked the Apache config
> ##ORACLE ENVIRONMENT
> ORACLE_HOME=/opt/ora9/product/9201
> ORACLE_BASE=/opt/ora9/
> export ORACLE_HOME ORACLE_BASE
> ORACLE_TERM=vt100
> LD_LIBRARY_PATH=$ORACLE_HOME/lib
> PATH=$ORACLE_HOME/bin:$PATH
> export PATH LD_LIBRARY_PATH
> ORACLE_DOC=$ORACLE_BASE/doc
> ORACLE_SID=BDB1
> TNS_ADMIN=/opt/ora9/product/9201/network/admin
> export ORACLE_DOC ORACLE_SID TNS_ADMIN
>
>
> Does anyone have any thoughts
>
> Thanks for any help,
>
> Paul
>
> ___
> Paul Miller
> System-Wise
> pmillerATsystemDASHwiseDOTcom
> AT = @
> DASH = -
> DOT = .
>
>
>

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

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



[PHP-DB] NEXTVAL Question

2003-12-11 Thread Paul Miller
Does anyone know how to make this work???

$sql = "select TEAM_SEQ.NEXTVAL as \"nextval\" from sys.dual";

I get the following error in PHP:

ociexecute(): OCIStmtExecute: ORA-00903: invalid table name

But when I use my SQL tool to hit the DB will all the same parameters, it
works just fine.

I have also tried:
$sql = "select TEAM_SEQ.NEXTVAL from sys.dual";
$sql = "select TEAM_SEQ.NEXTVAL from dual";

all with the same results.

I am running Red Hat AS, PHP 4.3, OCI8 Functions and Oracle 9i.

- Paul

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



[PHP-DB] Architecture Question - Opinion

2003-12-16 Thread Paul Miller
All,

I am considering moving to a true 3-tier structure where the web server
does not have direct access to the database server - many times a government
requirement.  I want to keep the PHP front end and use an application server
(middle tier) to handle all the DB calls and sessions.  I could use Java or
something for the middle layer, but I do not really want to.  I would like
to implement a PHP application server sitting on top of SQL Relay for
pooling and DB abstraction to reduce the need to have more expertise
necessary for implementation.  Interoperability is important, but not 100%
necessary.

With all that being said, what do you think is the best method of
communication between PHP and the application server.  Just to throw it out
there, I have thought about SOAP and XML-RPC.  I like SOAP better because it
can decrease payload a great deal by not having to use the whole struct
method and it is more complex.  But the XML-RPC functions are written in C
and the SOAP are in PHP.  PHP 5 has better object orientation and new XML
libs so the SOAP functions should run much faster, but still not native.

What are your thoughts?

- Paul




RE: [PHP-DB] Re: Architecture Question - Opinion

2003-12-16 Thread Paul Miller
That is the major issue at hand, the slow "Live" DB calls.  Is there any way
around it while maintaining the constraints listed below using another
method of standard communication.  Is the "slow" going to be unacceptable?
I used SOAP to call an off site document server and that was slow. I do not
think that is a good comparison because my two servers would be on the same
gigabit network.

I am mostly worried about the web server, app server and DB server all being
on different machines and the SOAP layer adding an unacceptable amount of
lag in the already heavy backend.

call>SOAP client call--->SOAP server translation->DB call--Data
call<-SOAP client acceptance<---SOAP server transmission<-DB response<-Base

- Paul

=

I believe people are working on a SOAP extension to PHP in C, but I
could be mistaken. I like SOAP myself, it means easy interoperability
with any language with a SOAP implementation. The downside is slow
processing. "Live" DB calls on the webserver will be fairly slow.

--
paperCrane 

-Original Message-
From: Justin Patrin [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 16, 2003 12:19 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: Architecture Question - Opinion


Paul Miller wrote:

> All,
>
> I am considering moving to a true 3-tier structure where the web
server
> does not have direct access to the database server - many times a
government
> requirement.  I want to keep the PHP front end and use an application
server
> (middle tier) to handle all the DB calls and sessions.  I could use Java
or
> something for the middle layer, but I do not really want to.  I would like
> to implement a PHP application server sitting on top of SQL Relay for
> pooling and DB abstraction to reduce the need to have more expertise
> necessary for implementation.  Interoperability is important, but not 100%
> necessary.
>
> With all that being said, what do you think is the best method of
> communication between PHP and the application server.  Just to throw it
out
> there, I have thought about SOAP and XML-RPC.  I like SOAP better because
it
> can decrease payload a great deal by not having to use the whole struct
> method and it is more complex.  But the XML-RPC functions are written in C
> and the SOAP are in PHP.  PHP 5 has better object orientation and new XML
> libs so the SOAP functions should run much faster, but still not native.
>
> What are your thoughts?
>
> - Paul
>
>
>



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

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



RE: [PHP-DB] Update problems

2004-01-20 Thread Paul Miller
You might want to use single quotes

FirstName='$fname'

$sqlupdate="UPDATE UserInfo
SET ZNum='112763', FirstName='$fname', LastName='Short', TA='00',
Building='1197', Room='112',  Div='FWO', Grp='IIM'
WHERE ZNum='112763'";

- Paul

-Original Message-
From: Peter Lovatt [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 20, 2004 5:17 PM
To: Kermit Short; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Update problems


you need quotes around the name

FirstName="$fname"

otherwise it takes the value of $fname to be  aa field name

HTH

Peter



-Original Message-
From: Kermit Short [mailto:[EMAIL PROTECTED]
Sent: 20 January 2004 22:28
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Update problems


I'm trying to update a record in a MSSQL database.  When I execute the
following code on an IIS5 webserver, I get an error message that says:

PHP Warning: odbc_do(): SQL error: [Microsoft][ODBC SQL Server Driver][SQL
Server]Invalid column name 'Tom'., SQL state S0022 in SQLExecDirect in
E:\web\phptest\dbtest.php on line 31

This is after I've submitted the name Tom in the form.  Does anyone have any
ideas?!
Thanks very much in advance!
-Kermit

Could not Connect.");
 }
 else {
  echo"Connected to Database.";
  $sqlupdate="UPDATE UserInfo
 SET ZNum='112763', FirstName=$fname, LastName='Short', TA='00',
Building='1197', Room='112',  Div='FWO', Grp='IIM'
 WHERE ZNum='112763'";
  $sqlupdresults=odbc_do($odbccon, $sqlupdate);
  $query="SELECT * FROM UserInfo WHERE ZNum=112763";
  $qresults=odbc_do($odbccon, $query);
  odbc_result_all($qresults, "border=1");
  odbc_close($odbccon);
  echo "Connection Closed.";
 }
}
else {
 ?>
 
  First Name: 
  
 
 

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

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

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



RE: [PHP-DB] Database Abstraction Layer?

2004-01-21 Thread Paul Miller
There are a couple of products out there that I am about to start testing,
starting first with:

 - SQL Relay
http://sqlrelay.sourceforge.net/
This product uses its on C interfaces to interact with DBs and different
programming languages.  It addresses a bunch of items in the PHP DB calls.
Connection pooling and load balancing.

 - Propel
http://propel.phpdb.org/
Extensive templates create the SQL definition files you need to setup your
database and the classes you need to work with your data model in your PHP
scripts. The classes for your object model are generated from a simple XML
schema and any customizations are written in plain PHP.

This will effectively that add SQL and DB dependence out of your mix.  This
is PHP5 also.

HTH

- Paul

-Original Message-
From: Muhammed Mamedov [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 21, 2004 2:31 AM
To: phpdb
Subject: [PHP-DB] Database Abstraction Layer?


Hello everybody,
What do you think is the best method to abstract php code from a specific
database?.
Make PHP code 100% database independent?..

Waitin' for your comments.
Muhammed Mamedov

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



RE: [PHP-DB] Database Abstraction Layer?

2004-01-21 Thread Paul Miller
Oh ya, one more thing, I am going to integrate SQL Relay with the PHP
abstraction layer:

http://sourceforge.net/projects/sqlalphp

to give the functions a more PHP feel to them.  Plus, I will be able to
retain DB specific calls if I want with this layer.  I have used this layer
with a great deal of success in the past.  But it was never the DB calls
that got me, it was the actually SQL.  So I am building a swappable SQL
library.  The Propel solution would effectively negate me having to do that.

- Paul

-Original Message-
From: Muhammed Mamedov [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 21, 2004 3:41 AM
To: phpdb
Subject: Re: [PHP-DB] Database Abstraction Layer?


Thanks Ricardo for your comments.

What do you think guys: ADODB or PEAR::DB ?

- Original Message -
From: "Ricardo Lopes" <[EMAIL PROTECTED]>
To: "Muhammed Mamedov" <[EMAIL PROTECTED]>
Sent: Wednesday, January 21, 2004 11:21 AM
Subject: Re: [PHP-DB] Database Abstraction Layer?


> You have ADODB and PEAR DB that both work as abstraction layer. I have
used
> ADODB and seems to me that is very good, yet i have not tested PEAR DB...
>
> To make php code 100% database independent is not very easy, depends of
what
> are you going to do with your code. Use the ADODB or PEAR functions every
> time possible, and avoid the using of sql statements in your code because
> you have to carefull design then to be database independent but that can
be
> a very difficult task.
>
> - Original Message -
> From: "Muhammed Mamedov" <[EMAIL PROTECTED]>
> To: "phpdb" <[EMAIL PROTECTED]>
> Sent: Wednesday, January 21, 2004 8:31 AM
> Subject: [PHP-DB] Database Abstraction Layer?
>
>
> Hello everybody,
> What do you think is the best method to abstract php code from a specific
> database?.
> Make PHP code 100% database independent?..
>
> Waitin' for your comments.
> Muhammed Mamedov
>
>

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

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



RE: [PHP-DB] Database Abstraction Layer?

2004-01-21 Thread Paul Miller
PEAR is great from what I hear.  The issue you are going to run into with DB
independence is not the function calls which could be handled with something
as simple as sqlalphp.  It is the SQL calls themselves.  The two options I
have found is a SQL library with unembeded SQL or the Propel solution.

Either way adds a significant time to coding and product release initially.

- Paul

-Original Message-
From: Muhammed Mamedov [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 21, 2004 10:07 AM
To: [EMAIL PROTECTED]; phpdb
Subject: Re: [PHP-DB] Database Abstraction Layer?


Hmm..
Thank you for you sql picks:)
But what do you guys think aabout Pear :: DB? Is it as effective as these
Paul's picks?

Thank you.
Muhammed Mamedov

- Original Message -
From: "Paul Miller" <[EMAIL PROTECTED]>
To: "phpdb" <[EMAIL PROTECTED]>
Sent: Wednesday, January 21, 2004 5:44 PM
Subject: RE: [PHP-DB] Database Abstraction Layer?


> There are a couple of products out there that I am about to start testing,
> starting first with:
>
>  - SQL Relay
> http://sqlrelay.sourceforge.net/
> This product uses its on C interfaces to interact with DBs and different
> programming languages.  It addresses a bunch of items in the PHP DB calls.
> Connection pooling and load balancing.
>
>  - Propel
> http://propel.phpdb.org/
> Extensive templates create the SQL definition files you need to setup your
> database and the classes you need to work with your data model in your PHP
> scripts. The classes for your object model are generated from a simple XML
> schema and any customizations are written in plain PHP.
>
> This will effectively that add SQL and DB dependence out of your mix.
This
> is PHP5 also.
>
> HTH
>
> - Paul
>
> -Original Message-
> From: Muhammed Mamedov [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, January 21, 2004 2:31 AM
> To: phpdb
> Subject: [PHP-DB] Database Abstraction Layer?
>
>
> Hello everybody,
> What do you think is the best method to abstract php code from a specific
> database?.
> Make PHP code 100% database independent?..
>
> Waitin' for your comments.
> Muhammed Mamedov
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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

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



RE: [PHP-DB] Results with ledger stripes?

2004-01-26 Thread Paul Fitz

Hi, 

You can use the modulus operator to create alternate colour rows.
A bit simpler in code ;)
See below - 



echo "DomainAverage Speed\n";

// Define count variable which is tested in loop
$count = 1;

while ($mongorow = mysql_fetch_array($mongo, MYSQL_NUM)) 
{ 
// If $count divides evenly by 2, white, if not then #efefef
$color = ($count % 2)? "#ff" : "#e4e4e4";

echo "$mongorow[0]$mongorow[1]\n";
$count++;
}
echo "";

---

// Done :)


-Original Message-
From: Ricardo Lopes [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 26, 2004 7:29 PM
To: [EMAIL PROTECTED]
Cc: PHP DB
Subject: Re: [PHP-DB] Results with ledger stripes?

I dont see what is your problem, your code do almost anything. Is you
pretend to generate the output in html as you show in the example, you
just
have to add the color property in the "td" or "tr" tag, take care with
the "
in the code. ex:

$dummy_var = 0;
$dummy_array = array("#dd", "#ff");
while ($mongorow = mysql_fetch_array($mongo, MYSQL_NUM))
{
echo "$mongorow[0]$mongorow[1]<
/tr>
\n";
$dummy_var++;
}

And thats is it. You could use css or other things, thats up to you.
Hope
thats solved.

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, January 26, 2004 1:42 AM
Subject: [PHP-DB] Results with ledger stripes?


> Hello all,
>
> I'm in the midst of creating an internet speed test system thingamabob
for
> my website.  It's basically finished...but ugly as sin.  What I'd like
to
do
> is have the results (an average of each domain tested) listed in a
nice
> pretty table with alternating background colors, kinda like a ledger.
How
> on earth do I do this?
>
> Here's what I've got thus far:
>
>  echo "Average speeds of each domain tested:";
> $mongo = @mysql_query ("SELECT
> substring_index(name,'.',-2),ROUND(AVG(speed),1) FROM `readings` GROUP
BY
> substring_index(name,'.',-2) ORDER BY substring_index(name,'.',-2)
ASC");
> echo "DomainAverage Speed\n";
> while ($mongorow = mysql_fetch_array($mongo, MYSQL_NUM)) { echo
> "$mongorow[0]$mongorow[1]\n";}
> echo "";
> ?>
>
> And I'd like it to spit out something along these lines:
> 
> domain1.com666.6 kbps
> domain2.com3000.0 kbps
> repeat until done
> 
>
> The gizmo is up and running at
> http://www.dibcomputers.com/bandwidthmeter/index.php if you care to
have a
> gander.
> Thanks a bunch,
> Dan
>
>







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

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

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



RE: [PHP-DB] Stroring files as BLOBs in MySQL?

2004-01-26 Thread Paul Miller
One thing that is not a huge issue, just something to be aware of is the
default 2mb limit in the php.ini file.  It is easily changed if you want
to upload bigger files.

- Paul

-Original Message-
From: John [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 23, 2004 10:04 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Stroring files as BLOBs in MySQL?


Whats the problems with it?? I now have an 150MB table with MIDI files
and title and authors. could i run into problems bu doing this??

--
**
Free Nokia Ringtones US
http://www.ring-tones.us
**

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

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



RE: [PHP-DB] Images stored in a db - how to get them?

2004-01-26 Thread Paul Miller
While I totally agree with Ryan, there are instances where I have found
that people do not follow best practices, namely Oracle (Oracle File
Storage) and many MySQL/PHP programs out there (OPT and Help Center
Live).  So here is some code addressing both.

You would probably need an interpreter file.  Something like image.php
and call images like image.php?ID=house.

Then in your code, you grab the blob or file info and print it out after
you set the headers like this:

=
THE DB OPTION (local file system storage):
=

=
THE FILE OPTION (local file system storage):
=



The GD library is for creating new images using specified parameters or
editing an image.

HTH

- Paul

-Original Message-
From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 26, 2004 3:28 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Images stored in a db - how to get them?


 about once a quarter this question comes up and the answer is always
the same. Don't store them in the database, just store filenames and
store the files in the filesystem. That way you just generate a link and
treat it like any other image. Then when you query the database you
would create img tags with src property set to the image. You probably
don't want to store FULL path info, just enough to find the image.

<>< Ryan

-Original Message-
From: John T. Beresford [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 26, 2004 2:23 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Images stored in a db - how to get them?

Hello All,

I am interested in storing images in a table. My question is - What is
the proper way of retrieving the images and displaying them on a web
page?

Will I need to go through the GD library and create an image from the
information stored in the table?

While PHP is not new to me, images in db's is. Specifically, when info
is returned, it's usually in the form of:

$var=$row['FieldName'];

What would I then do with the 'BLOB' information? Is that where the GD
image tools come in play?


Any URL's or small hints to point in the right direction would be 
very much appreciated.

Thanks,
John
-- 
===
John T. Beresford
Apple Certified Technical Coordinator
http://www.deewi.com/
405.760.0794

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

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

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



RE: [PHP-DB] Can anyone see what's wrong with this code?

2004-01-27 Thread Paul Miller
You probably need to specify the path in the filesize call also.  It
looks like you are just pushing the filename.

Like 

$filepath = "/home/www/nortonway/photos/$filename";
$fd = fopen($filepath, "rb"); 
$filedata = fread ($fd, filesize($filepath)); 
$zipfile -> add_file($filedata, "$filename"); 
fclose ($fd);

HTH

- Paul

-Original Message-
From: Chris Payne [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 27, 2004 12:52 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Can anyone see what's wrong with this code?


HI there Everyone,

Finally found the list address again, my computer crashed and I lost
everything, sigh.  Anyway, i'm zipping a file and it's zipping the
filename ok but not the file and I have a feeling it's something wrong
with the below, as I get an error on the filesize parameter saying no
such file, even though I know it is there.

For this example, think of $filename as having mypic.jpg stored in it
(Which it does, checked and it echoed the name), so I specified the
server path and that got rid of that error, but the filesize one is just
frustrating me, is it something simple i'm missing?  I've looked into
the PHP manual and seems it should be working.

$fd = fopen("/home/www/nortonway/photos/$filename", "rb"); $filedata =
fread ($fd, filesize($filename)); $zipfile -> add_file($filedata,
"$filename"); 
fclose ($fd);

Any help would be extremely appreciated.

Regards

Chris

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



RE: [PHP-DB] php-db globals turned off

2004-01-27 Thread Paul Miller
I love this one...

extract($_REQUEST);

but it undermines the whole reason PHP moved to the new default
parameter specification.  Be careful with you coding.  I use it, and it
makes things much like the pre 4.3.2 release without changing the ini
files.  You just have to specify the default $_server and file upload
params.  The other option is change the php.ini file for that dir or
globally.

- Paul

-Original Message-
From: Mignon Hunter [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 27, 2004 12:56 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] php-db globals turned off


How do most of you handle variables in next page after passing.

For instance.  What I have right now (very ugly) is:

$email = $_POST['emal'];
$first = $_POST['first'];
$lastl = $_POST['last'];

Then I work with $email, $first etc...

I will have to do this for many, many variables which doesnt seem very
efficient.

I tried:

foreach ($_POST as $key => $value)
$key =  $value;

but that didnt work...but I can print them out.

but even if this did work - this wouldnt handle the 2 sets of arrays I
have.

Does anybody have any snippets for this ... ???

Thanks


Mignon Hunter
Webmaster
Toshiba International Corporation
(713) 466-0277 x 3461
(800) 466-0277 x 3461

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

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



RE: [PHP-DB] php-db globals turned off

2004-01-27 Thread Paul Miller
Also, many legacy applications use the non $_POST variable definitions.
A problem that I ran into.

- Paul

-Original Message-
From: Mignon Hunter [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 27, 2004 1:47 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] php-db globals turned off


So it will be easier to use in my script on this page, where I'm
creating several query strings with the data.



Mignon Hunter
Webmaster
Toshiba International Corporation
(713) 466-0277 x 3461
(800) 466-0277 x 3461


>>> "John W. Holmes" <[EMAIL PROTECTED]> 01/28/04 01:15PM >>>
Mignon Hunter wrote:
> How do most of you handle variables in next page after passing.
> 
> For instance.  What I have right now (very ugly) is:
> 
> $email = $_POST['emal'];
> $first = $_POST['first'];
> $lastl = $_POST['last'];

Why are you recreating variables? You already have a variable 
$_POST['email'], so why do you feel the need to make $email? Now you 
have two variables to keep track of.

-- 
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ 

php|architect: The Magazine for PHP Professionals - www.phparch.com

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

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

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



RE: [PHP-DB] php-db globals turned off

2004-01-27 Thread Paul Miller
I am not 100% sure what you are doing here, so I am responding with
this...

if (is_array($_POST['prod']) {
// Value is an Array
$prod = $_POST['prod'];
}else{
// Value is not an array, but the value
// is added to the first element.
$prod[] = $_POST['prod'];
}

With extract, if $_POST['prod'] is an array, then prod will be an array
also.

- Paul


-Original Message-
From: Mignon Hunter [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 27, 2004 2:09 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] php-db globals turned off


How would you extract variables from arrays?

before I was doing

$prod[] = $_POST['prod'];
$choice[] = $_POST['choice'];

then I could iterate through $prod[], $choice[]

Mignon Hunter
Webmaster
Toshiba International Corporation
(713) 466-0277 x 3461
(800) 466-0277 x 3461


>>> "Paul Miller" <[EMAIL PROTECTED]> 01/27/04 01:06PM >>>
I love this one...

extract($_REQUEST);

but it undermines the whole reason PHP moved to the new default
parameter specification.  Be careful with you coding.  I use it, and it
makes things much like the pre 4.3.2 release without changing the ini
files.  You just have to specify the default $_server and file upload
params.  The other option is change the php.ini file for that dir or
globally.

- Paul

-Original Message-
From: Mignon Hunter [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 27, 2004 12:56 PM
To: [EMAIL PROTECTED] 
Subject: [PHP-DB] php-db globals turned off


How do most of you handle variables in next page after passing.

For instance.  What I have right now (very ugly) is:

$email = $_POST['emal'];
$first = $_POST['first'];
$lastl = $_POST['last'];

Then I work with $email, $first etc...

I will have to do this for many, many variables which doesnt seem very
efficient.

I tried:

foreach ($_POST as $key => $value)
$key =  $value;

but that didnt work...but I can print them out.

but even if this did work - this wouldnt handle the 2 sets of arrays I
have.

Does anybody have any snippets for this ... ???

Thanks


Mignon Hunter
Webmaster
Toshiba International Corporation
(713) 466-0277 x 3461
(800) 466-0277 x 3461

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

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

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

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



RE: [PHP-DB] Oracle and upper case field name

2004-01-27 Thread Paul Miller
the way I do it is with http://www.ytztech.com product SQL_AL.PHP which
has a switch that will say all values are upper or lower.  You can also
create a simple wrapper function that will do the lower conversion.
 
- Paul

-Original Message-
From: William Cheung [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 27, 2004 2:27 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Oracle and upper case field name



Hi,

When Oracle returns the result set, the field names are all in upper
case. However, I have an application that needs to work on both MSSQL
and Oracle. I don't want to keep 2 copies. One has upper case field
names and the other lower case. How could I make PHP or ADODB to work
with lower case field names even the result set is upper case?

 

William Cheung <mailto:[EMAIL PROTECTED]>  B.Sc, MCSE, MCDBA

Databyte Corp. <http://www.databyte.com/>  

 


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.567 / Virus Database: 358 - Release Date: 1/24/2004






RE: [PHP-DB] php-db globals turned off

2004-01-27 Thread Paul Miller
As mentioned in my first email, PHP and myself think turning the global
var reg off is a good thing, especially for inexperienced coders and var
definition.

$email = $_POST['email'] makes a difference is you are dealing with an
application that was built during the 90% of PHP's lifetime where reg
global vars was turned on and you want to use that application with your
server where with 4.3.2 - it is turned off.

Basically $_POST['email'] is already referred to as $email in thousands
of lines of code and instead of trying to convert them (legacy
application), you just use the extract function.

Hope that is a bit clearer.

- Paul

-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 28, 2004 2:21 PM
To: [EMAIL PROTECTED]
Cc: 'Mignon Hunter'; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] php-db globals turned off


Paul Miller wrote:
> Also, many legacy applications use the non $_POST variable 
> definitions. A problem that I ran into.

So how is saying

$email = $_POST['email']

going to help you in that case??

-- 
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals - www.phparch.com

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



RE: [PHP-DB] Inserting querydata as default value in form

2004-01-28 Thread Paul Miller
Need some quotes



Output will look like


Instead of 
\
Which it probably looks like now.

- Paul

-Original Message-
From: Georg Herland [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 28, 2004 12:05 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Inserting querydata as default value in form


Hi!

I hav made a simle page to insert update and delete data in MYSQL. I try
to put existing data into a standard form field to make editing
easyer:
 Problem is when
the text data contains a space ie "Look here". Then only the first word
show. To display both words i have to update the data to "Look_here"
witch isn't really looking good. A good suggestion, anyone?

TIA Georg :-)

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

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



[PHP-DB] Wonder Program Question

2004-01-28 Thread Paul Miller
Hi All,

Got a question for everyone. Does anyone know of a Red Hat (Fedora would
be even better) package that does the following:

 - Load Balancing
 - Proxying
 - Host Name Redirects
 - Server Heartbeat monitoring

I know IP Tables can do it with some help from some other programs, but
I am looking for one simple clean program that works a lot like my
router or expensive routers I have used in the past.  Some Foundry
routers do this already and if I cannot do it server side I am going to
consider that option.  I am just wondering if any one knows of anything.

Thanks,

Paul


Here is an example of what I want to setup.
===

All domains will have the same IP address.  I want all traffic that
comes in over port 80 on that IP address to be handled by my routing
server.  The server will send windows traffic to the windows machine and
Linux traffic to one of the Linux machines based on availability and
load.  I want the routing server to determine what traffic goes where
based on the host name (www.domain1.com or www.domain2.com).  Below is a
quick sketch.


www.domain1.com -> Linux Server (1&2) 
Domain1 will go to Linux Server1 and Linux Server2 in my backend
network.  It will be the load balanced server.

www.domain2.com -> Windows Server1
Domain2 will go to my Windows Server.  The host name will tell the
routing server to send the request to the Windows server.  The Windows
server will determine which virtual site to serve based on the proxied
host name (Domain2) and then return the correct info.

www.domain3.com -> Windows Server1
Domain3 will also go to my Windows Server.  The host name will tell the
routing server to send the request to the Windows server.  The Windows
server will determine which virtual site to serve based on the proxied
host name (Domain3) and then return the correct info.

-
www.domain1.com www.domain2.com www.domain3.com 
AB  B
||  |
-
|
|
- My Firewall --|
|
|
  -
 |   Linux Routing, Load-  |
 | balancing and Proxy Server  |
 |  which accepts all port 80  |
 | traffic |
  -
  |
  |
  ---
  A  A   B  B
  |  |   |  |
Linux  Linux  WindowsWindows 
   Server1Server2 Server1Server1
-

Thanks again if you have gotten this far,

Paul

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



RE: [PHP-DB] PHP Command Line

2004-01-29 Thread Paul Miller
php script.php %1 %2 %3 %4

And it is referenced as $argv[arg number]

... I think. To be sure, here is the link to that info:

http://www.php.net/manual/en/features.commandline.php

- Paul

-Original Message-
From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 29, 2004 4:34 PM
To: PHP-DB
Subject: [PHP-DB] PHP Command Line


Anyone know how to pass a query string to a php script when you call it
on the command line?

<>< Ryan

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

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



RE: [PHP-DB] Rules in a database

2004-02-06 Thread Paul Miller
I guess I did not pay attention that day in class, but that is cool.

- Paul

-Original Message-
From: Ignatius Reilly [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 06, 2004 9:14 AM
To: DB list PHP; John
Subject: Re: [PHP-DB] Rules in a database


A bit of algebra first:

any expression formed of atomic expressions, AND, OR and parentheses can
be reduced to a "canonical" form, by using the De Morgan laws: a AND ( b
OR c ) is equiv. to a AND b OR a AND c

So a rule can eventually be reduced to "AND" groups, joined by "OR":
a(1) AND... AND a(n) OR ... OR z(1) AND ... AND z(p)
Each "AND" group contains 1 or more rules.

Therefore, to model "input" rules:
- store atomic rules in a table
- store "AND" rule groups in a table (1-n relation to the "atomic"
table)
- store full rules in a table (1-n relation to the "AND" table)

Now you can model "output" rules likewise, and finally create a table of
associations between "input" and "output" rules

Problem is: once you've flattened your rules to the canonical form, they
can become illegible. So perhaps a hierarchical data model (XML) would
be more appropriate, for your rules would remain human-legible (and
thererfore
human-maintainable)

HTH
Ignatius
_
- Original Message -
From: "John" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 06, 2004 15:35
Subject: [PHP-DB] Rules in a database


> I work in tax and thus have to read legislation - some complex - and I

> wanted to store some of the logic in a database so that if I know 
> certain conditions were true I could look up what results this might 
> have.
>
> Thus I am thinking of having two tables - one of phrases and the other

> of how these phrases are linked together as rules.  A rule structure 
> could
be:
>
> IF A THEN B
> IF A OR A1 OR A2 THEN B
> IF A THEN B AND C
>
> I was wondering how to do this.  For instance, each rule could be one
record
> in the table.  The rules table has fields, IF and THEN. The ID field 
> is
the
> rule ID.  Assume the phrases are numbered.  One IF record could say:
> +/12/41/31/+/90/ meaning if phrases 12, 41 or 31 are true and phrase 
> +90 is
> true.  Then if I have a real situation where condition 12 is true, for

> instance, I can find it and access it using sub string functions. Does
this
> scheme seem OK?  Has anyone done anything like this before?
>
> Regards,
>
> John
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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

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



RE: [PHP-DB] compiling oracle support

2004-02-12 Thread Paul Miller
I am using OCI-8 with Oracle 9i just fine.

- Paul

-Original Message-
From: Adam Williams [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 12, 2004 9:13 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] compiling oracle support


How do I compile PHP on Unix to have oracle 9 support.  Looking at 
./configure --help and PHP's website, I see no option for oracle 9 
support.  I see --with-oci8 but that appears to only work for Oracle 8.

Any help?  Thanks!

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

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



RE: [PHP-DB] Paging large recordsets

2004-02-13 Thread Paul Miller
In no way I am trying start some long thread here.  But I have always
heard it was bad to store that much data in a session array?  I could
just be really off here and not understanding what I have read.  I know
PHP stores the sessions as text files.  The only reason I can come up
with why one should not store large amounts of data would be disk
write/read speed per user.

Can someone clarify this for me?

- Paul

-Original Message-
From: Robert Twitty [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 13, 2004 12:34 PM
To: Karen Resplendo
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Paging large recordsets


Most of the PHP solutions I have seeen require the use of session
variables.  You could create an array containing only the unique
identifiers of all the records, and then store it into a session
variable. You would then use another session variable to retain the page
size, and then include the page numbers in the "Next", "Prev", "First",
"Last" and "Absolutr" page links.  Printing is probably best done with
dynamically generated PDF instead of HTML.

-- bob

On Fri, 13 Feb 2004, Karen Resplendo wrote:

> I guess the time has come that my boss wants "Next", "Previous", 
> "First", "Last" paging for our data displays of large recordsets or 
> datasets.
>
> Any good solutons out there already? I have pieces of a few examples.
>
> Also, how to deal with printing? I would assume that the ideal page 
> size is not the ideal printed page size. oi vay!
>
> TIA
>
>
> -
> Do you Yahoo!?
> Yahoo! Finance: Get your refund fast by filing online

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

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



RE: [PHP-DB] Paging large recordsets

2004-02-13 Thread Paul Miller
One way that I have found - but never used is...

http://sqlrelay.sourceforge.net/

It can cache result sets in a file for later use.  You can then use It
does a whole bunch of other stuff too.  I really need to install this
and start working with it.

- Paul

-Original Message-
From: Robert Twitty [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 13, 2004 1:59 PM
To: Paul Miller
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Paging large recordsets


If you are not opearating in a stateless environment, then you could use
a cursor.  The web is a stateless environment, and therefore the record
set needs to be cached either to disk or memeory.  The other alternative
is to rerun the query for each page request.  Using disk space to store
query results for the purpose of paging over the web is commonly done by
search engines, and even some database engines use disk space for cursor
implementation.  I agree that using session variables for this purpose
is not ideal, but what's the alternative in PHP?  Storing only the
identifiers instead of all the data significantly lessons the impact.

I agree, it should be avoided if possible.

-- bob

On Fri, 13 Feb 2004, Paul Miller wrote:

> In no way I am trying start some long thread here.  But I have always 
> heard it was bad to store that much data in a session array?  I could 
> just be really off here and not understanding what I have read.  I 
> know PHP stores the sessions as text files.  The only reason I can 
> come up with why one should not store large amounts of data would be 
> disk write/read speed per user.
>
> Can someone clarify this for me?
>
> - Paul
>
> -Original Message-
> From: Robert Twitty [mailto:[EMAIL PROTECTED]
> Sent: Friday, February 13, 2004 12:34 PM
> To: Karen Resplendo
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Paging large recordsets
>
>
> Most of the PHP solutions I have seeen require the use of session 
> variables.  You could create an array containing only the unique 
> identifiers of all the records, and then store it into a session 
> variable. You would then use another session variable to retain the 
> page size, and then include the page numbers in the "Next", "Prev", 
> "First", "Last" and "Absolutr" page links.  Printing is probably best 
> done with dynamically generated PDF instead of HTML.
>
> -- bob
>
> On Fri, 13 Feb 2004, Karen Resplendo wrote:
>
> > I guess the time has come that my boss wants "Next", "Previous", 
> > "First", "Last" paging for our data displays of large recordsets or 
> > datasets.
> >
> > Any good solutons out there already? I have pieces of a few 
> > examples.
> >
> > Also, how to deal with printing? I would assume that the ideal page 
> > size is not the ideal printed page size. oi vay!
> >
> > TIA
> >
> >
> > -
> > Do you Yahoo!?
> > Yahoo! Finance: Get your refund fast by filing online
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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



RE: [PHP-DB] What's wrong with this query?

2004-02-26 Thread Paul Fitz


You haven't done that a thousand times - the syntax is wrong :).
You are using a combo of INSERT and UPDATE syntax there.

Try 

INSERT INTO log (term, returns, time, date, ip) VALUES ('$search',
'$arrayword',CURTIME(), CURDATE(), '$ip');

Cheers,
Paul



-Original Message-
From: Axel IS Main [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 26, 2004 7:06 PM
To: PHP-DB
Subject: [PHP-DB] What's wrong with this query?


I've just tried to do something I've done a thousand times. It does not 
work. I've checked all of the syntax, made sure the field and variable 
names are correct. No matter what I do it just doesn't work. The table 
remains empty. Here's the query:

$logit = mysql_query("INSERT INTO log SET term='$search', 
returns='$arrayword', time=CURTIME(), date=CURDATE(), ip='$ip'");

Now that doesn't look too difficult does it? Well, apparently it's 
impossible! I'm really hoping someone out there can see something that I

missed.

Nick

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

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



[PHP-DB] Connect to MySQL Database Using PHP

2004-02-28 Thread Paul Higgins
I currently connect to my database (MySQL) through PHP with the following 
lines:

$db = mysql_connect( 'host', 'userName', 'password');
mysql_select_db( "database_name", $db);
The host, userName, and password are all hard coded into the PHP document.  
I would prefer not to do this.  How can I connect to the database without 
having my sensitive information hard coded into the PHP?

Thanks,

Paul

_
Find and compare great deals on Broadband access at the MSN High-Speed 
Marketplace. http://click.atdmt.com/AVE/go/onm00200360ave/direct/01/

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


Re: [PHP-DB] Connect to MySQL Database Using PHP

2004-02-28 Thread Paul Higgins
Thanks,

I will try both suggestions.

Much appreciated!

Paul


From: Mathias Hunskår Furevik <[EMAIL PROTECTED]>
To: Paul Higgins <[EMAIL PROTECTED]>
Subject: Re: [PHP-DB] Connect to MySQL Database Using PHP
Date: Sat, 28 Feb 2004 21:51:30 +0100
You can include a file with:



$host = "host";
$Username = "username";
...
And then use: require("include.php"); in alle php documents, and then use 
$host etc in the Connect-function.

-

Mathias Furevik

På Sat, 28 Feb 2004 14:43:23 -0500, skrev Paul Higgins 
<[EMAIL PROTECTED]>:

I currently connect to my database (MySQL) through PHP with the following 
lines:

$db = mysql_connect( 'host', 'userName', 'password');
mysql_select_db( "database_name", $db);
The host, userName, and password are all hard coded into the PHP document. 
 I would prefer not to do this.  How can I connect to the database 
without having my sensitive information hard coded into the PHP?

Thanks,

Paul

_
Find and compare great deals on Broadband access at the MSN High-Speed 
Marketplace. http://click.atdmt.com/AVE/go/onm00200360ave/direct/01/



--
Sender med M2, Operas revolusjonerende e-postprogram: http://www.opera.com/
_
Find and compare great deals on Broadband access at the MSN High-Speed 
Marketplace. http://click.atdmt.com/AVE/go/onm00200360ave/direct/01/

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


RE: [PHP-DB] How to redirect after a valid login

2004-03-12 Thread Paul Miller
That means you send some output before the headers were sent.  That is a
no no.

For instance, this will not work:

http://www.yahoo.com/";);

?>

But this will

http://www.yahoo.com/";);

Echo "hello world";

?>

- Paul

-Original Message-
From: Larry Sandwick [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 12, 2004 2:25 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] How to redirect after a valid login 


What is considered to be the headers() information 

When I use the header() functions, I get an error stating that I have
already sent the headers information?



// Larry
 
 

-Original Message-
From: Larry E. Ullman [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 12, 2004 3:04 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] How to redirect after a valid login 

> Is there a way that after a execution of a Login script and validation

> of login from a MySql database to automatically redirected to run 
> another script ?

Use PHP's header() function. See the manual for syntax.

Larry

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

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

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



Re: [PHP-DB] How to redirect after a valid login

2004-03-15 Thread Paul Burney
on 2004/03/15 15:39, Larry Sandwick at [EMAIL PROTECTED] made the following
allegation:

> Here is the error I get when I use the include below:
> 
> include "MainMenu.php";
> 
> Fatal error: Cannot redeclare class db in
> /tmp/disk/home/webmaster/Files/WWW/pearDB/DB.php on line 211

As someone else mentioned, inside the MainMenu.php file, use include_once
instead of just include.  That is probably your problem.

I'll add the following additional comment for people searching for solutions
in the archive:

There is complication, however, if you are trying to use a local version of
the DB or PEAR class (Maybe all PEAR classes in general).  If you are doing
that, you'll need to make sure that your local directories are at the
beginning of the include_path.

For example, let's say I do something like this:

include_once './new-version/DB.php';

Within the DB.php associated files in the DB directory, there are calls to
'include_once DB.php'.  Those includes will use the includes path, which by
default is something like '/usr/lib/php/', not the place you included your
file from.  As far as PHP is concerned, those are different files.  Thus,
PHP first loads your DB.php and then the system version, resulting in the
error you mention above.

To get around that, I do something like this:

$file_system_location = dirname(__FILE__);

$current_includes_path = ini_get('include_path');

$new_include_path =
$file_system_location . '/includes:' .
$current_includes_path;

ini_set('include_path',$new_include_path);

Hope that helps.

Sincerely,

Paul Burney
<http://paulburney.com/>



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



RE: [PHP-DB] Automatically Refreshing png-Image'd Web Page

2004-03-19 Thread Paul Miller
I might be reading this wrong, but I do not think you should put your
meta refresh request in the png creation script.  It should be in the
html body script.

Index.php

Meta-refresh to call itself in 30 secs
Call to 


php_radio_image_creation_script.php

header("Content-type: image/png") 
Echo image content

Hopefully this sudo code is enough to get what I am trying to say.  You
might have some caching issues, but that is another issue.

- Paul

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 19, 2004 11:01 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Automatically Refreshing png-Image'd Web Page


Howdy Listers,

The Background:
I am making dynamic, color-coded, png images of the floor plan of a 
building and displaying them in a browser.  Numerous radioactivity
sensors 
throughout the building send their readings to a MySQL dB, and the web 
page queries the dB, and depending on the readings, the areas specific
to 
the sensors will appear green for normal, yellow for high but
acceptable, 
and red for critical.  All this works OK.

The Problem:
Neither the HTML nor JavaScript code I usually use for automatically 
refreshing a page has any effect if the header("Content-type:
image/png") 
necessary for displaying the png image is included. If I comment out the

header() line, the page refreshes, but the image data comes through as 
hieroglyphics.  Obviously, I need to refresh the page to get the latest 
data, and to create and display the corresponding image.

The Question:
Is there any way to automatically refresh a web page displaying a png 
image?

Thanks in advance for any thoughts/insights into how I can solve this 
problem.

dave

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



RE: [PHP-DB] ?DHTML Layers with PHP?

2004-03-19 Thread Paul Miller
This JS script is awesome.  I work with Oracle Portal and a guy modified
it to read portal hierarchies so I know it can read dynamic data with
modification.

http://www.destroydrop.com/javascripts/tree/

I believe you just have to be able to create the parent child
relationships and display them in a js include like this:




With dynamic_page.php containing links like:


I am not sure of a ready made php script that can do what you want, but
I know it can be done.

HTH
- Paul

-Original Message-
From: Galbreath, Mark A [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 19, 2004 11:04 AM
To: '[EMAIL PROTECTED]'
Subject: [PHP-DB] ?DHTML Layers with PHP?


I've been sitting here all morning wracking my brains for a way to code
a hierarchical menu tree with JavaScript from database data retrieved by
PHP, so that the child menus appear on a mouse click.  Can PHP do this
without JS?  The only JS examples I can find use static menu trees, not
dynamic data.

tia,
Mark

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

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



RE: [PHP-DB] Tree structure - how to show only current branch ??

2004-03-30 Thread Paul Miller
Ya it has - that is a great script!

-Original Message-
From: Galbreath, Mark A [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 30, 2004 7:15 AM
To: '-{ Rene Brehmer }-'; '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] Tree structure - how to show only current branch
??


Already been done:

http://www.destroydrop.com/javascripts/tree/

Mark

-Original Message-
From: -{ Rene Brehmer }- [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 30, 2004 7:50 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Tree structure - how to show only current branch ??


Ok, Tom Reed got my thinker running big time ... and I've been trying to

build an expandable and modifiable tree structure where it only displays

the branch leading to the current folder... Showing the entire tree is 
easy, but how do I change the code to only display the branch we need???

... I've never coded visual trees before, so this is new for me ...

Found several samples with google where the code relies on the structure

being fixed in the DB. What I want to create is the possibility to mode 
folders around within the tree ... literally moving branches from one
place 
to another, while retaining their content.

DB structure is simply this (I want to get rid of the level field if
it's 
at all possible to count the levels with recursive functions, but for
now 
it stays).

  folderID int(10) UNSIGNED auto-increment
  parentID  int(10) UNSIGNED
  level  tinyint(3) UNSIGNED
  name  varchar(255)

(I'm fully aware that int may be overkill, but this is for testing
purposes...)

test data:
folderID
parentID
level
name

1 0 0 parent 1
2 0 0 parent 2
3 0 0 parent 3
4 0 0 parent 4
5 0 0 parent 5
6 1 1 child of 1
7 3 1 child of 3
8 1 1 child 2 of 1
9 6 2 sub-child 1
10 6 2 sub-child 2
11 10 4 sub-sub 1
12 10 4 sub-sub 2
13 11 5 sub-sub-sub 1

Current code looks like this, the 2 subfunctions prints the branches,
the 
main function below prints the root structure...:

function count_children($parentID) {
// count number of children in folder
   $count = mysql_query("SELECT COUNT(*) AS num_children FROM folders
WHERE 
`parentID`='$parentID'");
   $numrows = mysql_fetch_array($count);

   return $numrows['num_children'];
}

function print_children($parentID) {
// print the branch of sub-folders
   $children = mysql_query("SELECT folderID,level,name FROM folders
WHERE 
`parentID`='$parentID'");

   while($child = mysql_fetch_array($children)) {
 $folderID = $child['folderID'];
 $name = $child['name'];
 $level = $child['level'];

 for ($i = 0; $i < $level; $i++) {
   echo('·');
 }
 echo("· $name\n");

 // let's find children... recursive call !!
 if (count_children($folderID) > 0) {
   print_children($folderID);
 }
   }
}

// get root parents -- main tree function
$parents = mysql_query("SELECT folderID,name FROM folders WHERE 
`parentID`='0'");

while($folder = mysql_fetch_array($parents)) {
   $folderID = $folder['folderID'];
   $name = $folder['name'];

   echo("· $name\n");

   // let's find children...
   if (count_children($folderID) > 0) {
 print_children($folderID);

   }
}


The output of all this looks like this:

. parent 1
.. child
of 1 ...
sub-child
1
...
sub-child
2
.
sub-sub
1
.. 
sub-sub-s
ub 1 .
sub-sub
2
.. child 2
of 1 .
parent 2 .
parent 3
.. 

[PHP-DB] One or Many Databases?

2004-07-31 Thread Paul Burney
Hello everyone,

I'm developing a "community system", that has things like members, roles,
events, etc.  Currently everything is in multiple tables of a single MySQL
database.  It looks something like this...

---

Communities - community_id PK, other_info
Members - member_id PK, other info
Roles - member_id FK, community_id FK
Events - event_id PK, community_id FK

---

Etc.  There are about 25 tables total.

It's been recommended to me that putting each community in it's own
databases would be better.  Something like this:

---

Communities - community_id

-

Community_id_database

Members - member_id PK, other info
Roles - member_id FK
Events - event_id PK

---

So Now I'm trying to figure out if it really would be better or not, and
that's what I'm asking for your help with.  Here are some of the pros and
cons, as I see them:


PROS:
---
Less chance of database corruption bringing down all communities
Possibility of more security
Possibility of more customization

CONS:
---
More difficult to administer
Difficult to upgrade the system
More difficult to inter-relate the communities/members
More server load (??? - Using PEAR, I think each separate database would be
a separate connection)


Would the answers to this question be any different if I were using
PostgreSQL, MSSQL or DB2?

Thank you in advance for any advice you can offer.

Sincerely,

Paul Burney
<http://paulburney.com/>

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



[PHP-DB] Connect to a ms access on a remote drive

2004-08-02 Thread Paul Kain
I am aware that theres a problem with connecting to an MS ACCESS DB on
a remote drive.

Anyoone how to do it correctly ?

Please? :(

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



[PHP-DB] RE: Assistance on Query

2005-01-17 Thread Paul Cooper
Hi People,
I would like some assistance on the following scenario.
I have to pull out all records for a particular userid (easy enough) and
then only show those entries where the follwing occurs.
These records from the table will contain either an entry in the
services_type field or the non_services_type field. What I need to do is
show only those where the number of consecutive records that contain an
entry in the non_services_type field is greater than or equal to 3
so example:-
record 1 contains an entry in non_services_type
record 2 contains an entry in services_type
record 3 contains an entry in non_services_type
record 4 contains an entry in non_services_type
record 5 contains an entry in non_services_type
record 6 contains an entry in services_type
so I would need to display records 3,4,5 only
Can anyone assist me with this?
Cheers,
Shannon
When you do your while ($row = mysql_fetch_assoc($result)) { ... } you will 
need to keep a list of consecutive records.

Try this:

$i = 0;
$j = 0;
while ($row = mysql_fetch_assoc($result)) {
   $current_string =  ( !empty($row['non_services_type']) ) ? 
'non_services_type' : 'services_type' ;

   if ($previous_string == $current_string) {
   $i++;
   if ($i >= 3) {
   $records[$j] = $row;
   $j++;
   }
   } else {
   $i = 0;
   $previous_string = $current_string;
   }
}
?>
Then simply echo $records. This may have some bugs to iron out, but this is 
a way to get the job done, please reply if you have found a better way.

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


[PHP-DB] RE: php-db Digest 16 Jan 2005 13:41:28 -0000 Issue 2777

2005-01-17 Thread Paul Cooper

From: [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: php-db Digest 16 Jan 2005 13:41:28 - Issue 2777
Date: 16 Jan 2005 13:41:28 -
php-db Digest 16 Jan 2005 13:41:28 - Issue 2777
Topics (messages 38151 through 38154):
Re: Integrating Interbase.so and PHP
38151 by: Doug Thompson
Re: MySQL db sync
38152 by: Bastien Koert
Adding Up MySQL Results
38153 by: Nathan Mealey
Assistance on Query
38154 by: Shannon Doyle
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
php-db@lists.php.net
--
<< php-db_38151.ezm >>
<< php-db_38152.ezm >>
<< php-db_38153.ezm >>
<< php-db_38154.ezm >>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] supporting multiple databases...

2005-01-30 Thread Paul Chvostek
Hiya.

I'm writing an application which needs to make SQL queries, and I'd like
to give it support for multiple database servers, starting with MySQL
and PostgreSQL.  I see that other folks have done this with a variety of
methods, and I can't see a clear winner.

Option 1 - Drop in a set of db-related functions as part of the install
procedure.  I.e. a file "db_func.php" is copied from "db_func.php-pg" or
"db_func.php-my" as part of the install procedure.  The functions
contained will return equivalent results.  This has the advantage of
leaving the installed application more streamlined, but it requires
better coordination between functions and things that call them; your
total number of db functions is multiplied by the number of databases
supported.

Option 2 - Select function behaviour based on a config variable.  That
is, the same database functions will run, but there can be if() or
switch() statements to control how the db is dealt with.  This keeps the
function list tighter, but it seems to make for less elegant and
probably less maintainable code.

Option 3 - Write relatively generic database functions, but control the
format of SELECTs and even the db connect functions called from config
variables.  This seems elegant on the surface, but make for highly
obtuse code.

Is there a preferred method of handling this issue, or does everybody
just roll their own?

-- 
  Paul Chvostek <[EMAIL PROTECTED]>
  it.canadahttp://www.it.ca/

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



Re: [PHP-DB] Sum Columns

2002-01-25 Thread Paul DuBois

At 23:19 -0600 1/25/02, [EMAIL PROTECTED] wrote:
>Hello,
>
>I've been experimenting with adding decimal columns. From the mysql docs I
>got this SELECT sum(value) FROM pets;
>
>So I did this  $result = mysql_query("SELECT sum(value) FROM pets",$db);
> $myrow = mysql_fetch_array($result);
> print "$myrow[value]";
>I also tried $myrow[sum].

You're selecting a column named "sum(value)" not "value" or "sum".
$myrow[0] should give you the value you're looking for.  Or modify your
query to add a column alias, and use the alias name:

$result = mysql_query("SELECT sum(value) AS the_sum FROM pets",$db);
 $myrow = mysql_fetch_array($result);
 print "$myrow[the_sum]";


>
>How can I get the sum displayed?
>
>Thanks in advance,
>Mike
>
>
>--
>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: [PHP] PHP and MYSQL Security`

2002-01-27 Thread Paul DuBois

At 16:59 -0800 1/27/02, Fred wrote:
>If this file has a .php extension remote users will not have access to the
>variables because the file is parsed by php and they never see the actual
>file contents when requesting the document via the web.  If you are
>concerned with users on localhost having access to the file, simply give it
>the correct permissions so that no one else has read access.

No so easy.  The server itself must have read access.  If other users on
the local host can install scripts that the server executes, any of those
scripts can read the text of your scripts.

What then? You're hosed.

>
>If you are concerned about web users having access, if, for example, the php
>parser crashed and apache tried to pass the file through without parsing,
>you can put the default server, user and pass variables in the php.ini file
>which is not in the document root for apache.  Of course, this only works if
>all of your scripts use the same server, user and password.
>
>Fred
>
>Duky Yuen <[EMAIL PROTECTED]> wrote in message
>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>>  How can I secure my username and password? In 1 of my files, it contains
>>  the following:
>>
>>  $conn = mysql_connect( "12.34.56.78", "username", "password");
>>  mysql_select_db("database",$conn);
>>
>>  What should I do, so people can't get this information?
>>
>>  Duky
>>
>
>
>
>--
>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] mySQL 4.0.2-alpha

2002-01-28 Thread Paul Stevens

Hi guys,

I'm running mySQL 3.23.43 at the mo' with PHP-GTK 0.5.0. Long and the short
of the matter is, anyone running mySQL 4.0.2-alpha in anywhere near a
production 
environment yet, and if so, how is it? My server is a Win2K Server SP2
box...so how steady are those windows binaries??? :-)

-- 
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] UPDATE query to add to a field

2002-01-28 Thread Paul DuBois

At 9:06 -0800 1/28/02, Adv. Systems Design wrote:
>hello all:
>
>I need to be able to update a field in MySQL, the catch is that I 
>have to add on to text that is already there and I have to be able 
>to do it within MySQL (phpMyAdmin). My first idea was to do:
>
>SET prod_desc = prod_desc + "more info to tack on to end"
>
>but this is a mathematical function which returns 0!

Use CONCAT().

>Any ideas?
>
>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] request and response objects?

2002-01-30 Thread Paul DuBois

At 12:30 -0600 1/30/02, Matthew Crouch wrote:
>basically a yes or no question my brother wants me to ask:
>Does PHP support these objects? If not, Can they be faked?

What, like in Java servlets/JSP pages?

-- 
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] DB Connections

2002-01-31 Thread Paul Burney

on 1/26/02 1:21 AM, jas at [EMAIL PROTECTED] appended the following bits
to my mbox:

> Ok, I am having a hard time coming up with a mysql connection class that
> simply allows me to setup a require(db_connection.inc) at the top of my php
> pages that allows a consistent connection to the mysql db and allows
> multiple queries thoughout the php page in question.  I have read a few
> tutorials on it and as of yet they all seem to go over my head.  If someone
> could give me some more insight into this area I would greatly appriciate
> it.

I don't think you really need a connection class, per se.  What you want to
do is write the connection code for the database once and then be able to
use it in all of your pages, correct.

How about this:

db_connection.php


Then in each file, at the top:


And you would call your queries like this:

$query = 'SELECT au FROM pb WHERE alchemy!="junk_science"';
$res = mysql_query($query, $dbh);

>From there you need to use the fetch_row/array functions as described in the
PHP manual.

If not using MySQL, change the "connect" call to the appropriate function.

The above assumes that you are just talking to tables in one database.  If
using more databases, put the select_db call in the individual files.

Also, if your db_connection.php file isn't in the same directory as the
files requiring it, use an absolute location or put the file in your include
path.

HTH.

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] Re: LEFT JOIN in UPDATE

2002-02-03 Thread Paul Burney

on 2/3/02 3:36 PM, Lutz Brückner at [EMAIL PROTECTED] appended the following
bits to my mbox:

>> Question is how to properly form a LEFT JOIN using
>> UPDATE... I tried:
>> 
>> UPDATE product_price LEFT JOIN temp
>> SET product_price.product_price_vdate = 1 (del flag)
>> ON product_price.product_id = temp.product_id
>> WHERE temp.product_id IS NOT NULL

> I just read http://www.mysql.com/doc/U/P/UPDATE.html once more,
> but can not find anything about mysql supporting JOIN in UPDATE
> statements.

I believe Lutz is right.  You are using PHP, right?  Any MySQL?

Some RDBMS systems provide ways of linking database table records to each
other via foreign keys and others allow you to create triggers that are
performed by the database server when certain actions happen.

MySQL does not.  They believe the application programmer should take care of
those "application" pieces.

So, if you're using MySQL, do the select statement first with the join, then
loop through the results and perform the update.

Paul





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




Re: [PHP-DB] MySQL connect

2002-02-04 Thread Paul Burney

on 2/4/02 12:54 PM, J Leonard at [EMAIL PROTECTED] appended the following
bits to my mbox:

> mysql_connect($db["host"],$db["user"],$db["password"],$db["database"]) or

The above function call only has three parameters.   The database isn't
specified in the connect call but selected later. Try:

mysql_connect($db["host"],$db["user"],$db["password"]);
mysql_select_db($db["database"])

Paul





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




[PHP-DB] Can't get left join to work

2002-02-07 Thread paul wilczynski

I've got 2 MySQL tables: Employees, and Mileage.  Mileage records trips
for
employees and there may be 0 or more Mileage rows for each Employee
row.  The Mileage table has a trip_date column. For testing purposes,
the
trip_date column in all rows is set to 2002-03-01.

There are currently 15 rows in the Employees table.

I want the result of the following select to be 15 rows (1 for each
employee, whether or not there are any rows in the Mileage table for
that
employee).  If I take the "where" clause out, I get all 15 rows
(including
a number of rows where sum(m.miles) = 0 (which is what I want).  If I
leave
the "where" clause in, however, I don't get employees with sum(m.miles)
= 0
(even though the "where" clause should include all of the Mileage rows).
(Only 3 Employees actually have corresponding rows in the Mileage table,
and I only get 3 rows back.)

select e.id,lname,sum(m.miles) from employees e
 left join mileage m on e.id=m.id
where month(m.trip_date) = 3
   and substring(year(m.trip_date),3,2) = '02'
 group by e.id;

I need to select by month/year from the Mileage table.  Any idea how the
"select" can be modified to include rows for all of the Employees?

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




Re: [PHP-DB] Can't get left join to work

2002-02-07 Thread paul wilczynski

Here are the 2 tables and selected columns from each.  Note there are only 4
employees who
have trips (3 of those employees active, 1 inactive).

If I do the following select, I only get 4 rows returned (or 3 if I say
'where active = 'A').  In addition to those, I want 1 row returned for each of
the
employees with 0 miles if there are no rows in the 'mileage' table for them.
To put
it another way, I always want the number of rows returned to be equal to the
number of
employees rows whose active_sw = 'A'.

select e.id,lname,sum(m.miles) from employees e
 left join mileage m on e.id=m.id
where month(m.trip_date) = 3
   and substring(year(m.trip_date),3,2) = '02'
 group by e.id;


CREATE TABLE IF NOT EXISTS employees (
id varchar(30) NOT NULL,
 fname  varchar(25) NOT NULL,
 lname  varchar(30) NOT NULL,
 password   varchar(12) NOT NULL,
 accum_miles_for_year   real(7,2),
 active_sw  varchar(1)  NOT NULL,
 registration   varchar(10),
 engine_sizesmallint unsigned,
fuel_reimburse_ratereal(3,2) default 0,
 PRIMARY KEY (id))

   ID  FNAME ACTIVE_SW
2SamA
33333Fred RobertA
4Paul   A
121212121George A
121212122George C.  A
121212123George A
ABCABCABCIanA
BBobA
QJoan Billy Bob A
123123124Jake   A
021021021SamA
893458009Joan H A
99996902DIanA
123412342Paul   A
138501999ShermanI


CREATE TABLE IF NOT EXISTS mileage
  (
recno   mediumint not null auto_increment,
id  varchar(30) NOT NULL,
 trip_date   date NOT NULL,
 trip_from   varchar(30) NOT NULL,
 trip_to varchar(30),
purpose varchar(30),
 miles   real(7,2) unsigned NOT NULL,
 PRIMARY KEY (recno))

  ID  TRIP_DATEMILES
138501231 2002-03-01  5200.00
ABCABCABC 2002-03-0180.00
6902D 2002-03-0113.00
6902D 2002-03-0113.00
6902D 2002-03-0180.00
6902D 2002-03-0180.00
6902D 2002-03-0113.00
6902D 2002-03-0113.00
6902D 2002-03-0113.00
6902D 2002-03-0113.00
6902D 2002-03-0113.00
6902D 2002-03-0113.00
6902D 2002-03-0113.00
6902D 2002-03-0114.00
6902D 2002-03-0140.00
6902D 2002-03-0144.00
6902D 2002-03-0144.00
6902D 2002-03-01   800.00
6902D 2002-03-01 5.00
6902D 2002-03-01   148.00
Q 2002-03-01 7.00

---

Rick Emery wrote ...

Show us your table structures and the data they contain.

It appears your WHERE clause probably acting correctly.  But without data,
we can determine that.
-Original Message-
From: paul wilczynski [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 07, 2002 11:49 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Can't get left join to work


I've got 2 MySQL tables: Employees, and Mileage.  Mileage records trips
for
employees and there may be 0 or more Mileage rows for each Employee
row.  The Mileage table has a trip_date column. For testing purposes,
the
trip_date column in all rows is set to 2002-03-01.

There are currently 15 rows in the Employees table.

I want the result of the following select to be 15 rows (1 for each
employee, whether or not there are any rows in the Mileage table for
that
employee).  If I take the "where" clause out, I get all 15 rows
(including
a number of rows where sum(m.miles) = 0 (which is what I want).  If I
leave
the "where" clause in, however, I don't get employees with sum(m.miles)
= 0
(even though the "where" clause should include all of the Mileage rows).
(Only 3 Employees actually have corresponding rows in the Mileage table,
and I only get 3 rows back.)

select e.id,lname,sum(m.miles) from employees e
 left join mileage m on e.id=m.id
where month(m.trip_date) = 3
   and substring(year(m.trip_date),3,2) = '02'
 group by e.id;

I need to select by month/year from the Mileage table.  Any idea how the
"select" can be modified to include rows for all of the Employees?



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




Re: [PHP-DB] addslashes()

2002-02-07 Thread Paul DuBois

At 16:54 -0600 2/7/02, Todd Williamsen wrote:
>Ok..
>
>i tried it out... and it almost works like I want it... weird though
>
>1. when I put in this is BLUE
>
>it prints it in like a bright green.  but if i use the RGB # then its fine.
>weird
>
>2.  if there is an apostrophe in the notes, then it will add slashes it to
>that as well
>
>so if I type blah blah blah I am going over to my friend's website later on
>and here is the address...
>
>http://friends.com>Friends
>
>it will look like
>
>friend\\\'s
>
>Friends(link)

addslashes() is for escaping values that you're going to insert into a
database.

If you're generating HTML, use htmlspecialchars() instead.

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




Re: [PHP-DB] addslashes()

2002-02-08 Thread Paul DuBois

At 9:14 -0600 2/8/02, Todd Williamsen wrote:
>So if I:
>Going in
>$Notes =  addslashes($Notes);
>
>Going Out:
>$Notes = stripslashes($Notes);
>
>wouldn't that kill the html? or no?

I have no idea.  What do you mean by "in" and "out"?
What exactly are you trying to do?  Are you generating HTML for
a Web page, storing data in a database, or are you trying to store
HTML in your database?

>"Joe Van Meer" <[EMAIL PROTECTED]> wrote in message
>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>>  Hi. addslashes() going in to db, stripslashes() coming out :)
>>   HTH Joe :)
>>
>>
>>  Todd Williamsen <[EMAIL PROTECTED]> wrote in message
>>  002601c1b033$382a4700$f6b2d83f@goofy1">news:002601c1b033$382a4700$f6b2d83f@goofy1...
>>  > Paul,
>>  >
>>  > It is being inserted into a database
>>  >
>>  > -Original Message-
>>  > From: Paul DuBois [mailto:[EMAIL PROTECTED]]
>>  > Sent: Thursday, February 07, 2002 5:41 PM
>>  > To: Todd Williamsen; [EMAIL PROTECTED]
>>  > Subject: Re: [PHP-DB] addslashes()
>>  >
>>  >
>>  > At 16:54 -0600 2/7/02, Todd Williamsen wrote:
>>  > >Ok..
>>  > >
>>  > >i tried it out... and it almost works like I want it... weird though
>>  > >
>>  > >1. when I put in this is BLUE
>>  > >
>>  > >it prints it in like a bright green.  but if i use the RGB # then its
>>  > fine.
>>  > >weird
>>  > >
>>  > >2.  if there is an apostrophe in the notes, then it will add slashes it
>>  > to
>>  > >that as well
>>  > >
>>  > >so if I type blah blah blah I am going over to my friend's website
>>  > later on
>>  > >and here is the address...
>>  > >
>>  > >http://friends.com>Friends
>>  > >
>>  > >it will look like
>>  > >
>>  > >friend\\\'s
>>  > >
>>  > >Friends(link)
>>  >
>>  > addslashes() is for escaping values that you're going to insert into a
>>  > database.
>>  >
>>  > If you're generating HTML, use htmlspecialchars() instead.
>>  >
>>  >
>>
>>
>
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


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




RE: [PHP-DB] addslashes()

2002-02-08 Thread Paul DuBois

At 9:53 -0600 2/8/02, Todd Williamsen wrote:
>Paul..
>
>Going into the database
>
>Coming out of the database
>
>Please read the whole post..  8)

I did.  It's not clear, at least to me, what you're trying to do.
You say "print" at one point and "insert into database" at another
point.

I'm pretty sure I know the solution.  What's not clear to me is
the *problem*.

Where are the data coming from?  Are you generating it within the script?
Are you receiving it as the contents of a web form?

What are you doing with that data?  Printing it?  Storing it into the
database?  Storing it into the database so that you can print it as
a Web page later?

>
>-Original Message-
>From: Paul DuBois [mailto:[EMAIL PROTECTED]]
>Sent: Friday, February 08, 2002 9:40 AM
>To: Todd Williamsen; [EMAIL PROTECTED]
>Subject: Re: [PHP-DB] addslashes()
>
>
>At 9:14 -0600 2/8/02, Todd Williamsen wrote:
>>So if I:
>>Going in
>>$Notes =  addslashes($Notes);
>>
>>Going Out:
>>$Notes = stripslashes($Notes);
>>
>>wouldn't that kill the html? or no?
>
>I have no idea.  What do you mean by "in" and "out"?
>What exactly are you trying to do?  Are you generating HTML for
>a Web page, storing data in a database, or are you trying to store
>HTML in your database?
>
>>"Joe Van Meer" <[EMAIL PROTECTED]> wrote in message
>>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>>>   Hi. addslashes() going in to db, stripslashes() coming out :)
>>>HTH Joe :)
>>>
>>>
>>>   Todd Williamsen <[EMAIL PROTECTED]> wrote in message
>>>   002601c1b033$382a4700$f6b2d83f@goofy1">news:002601c1b033$382a4700$f6b2d83f@goofy1...
>>>   > Paul,
>>>   >
>>>   > It is being inserted into a database
>>>   >
>>>   > -Original Message-
>>>   > From: Paul DuBois [mailto:[EMAIL PROTECTED]]
>>>   > Sent: Thursday, February 07, 2002 5:41 PM
>>>   > To: Todd Williamsen; [EMAIL PROTECTED]
>>>   > Subject: Re: [PHP-DB] addslashes()
>>>   >
>>>   >
>>>   > At 16:54 -0600 2/7/02, Todd Williamsen wrote:
>>>   > >Ok..
>>>   > >
>>>   > >i tried it out... and it almost works like I want it... weird
>though
>>>   > >
>>>   > >1. when I put in this is BLUE
>>>   > >
>>>   > >it prints it in like a bright green.  but if i use the RGB # then
>its
>>>   > fine.
>>>   > >weird
>>>   > >
>>>   > >2.  if there is an apostrophe in the notes, then it will add
>slashes it
>>>   > to
>>>   > >that as well
>>>   > >
>>>   > >so if I type blah blah blah I am going over to my friend's
>website
>>>   > later on
>>>   > >and here is the address...
>>>   > >
>>>   > >http://friends.com>Friends
>>>   > >
>>>   > >it will look like
>>>   > >
>>>   > >friend\\\'s
>>>   > >
>>>   > >Friends(link)
>>>   >
>>>   > addslashes() is for escaping values that you're going to insert
>into a
>>>   > database.
>>>   >
>>>   > If you're generating HTML, use htmlspecialchars() instead.
>>>   >
>>>   >
>>>
>>>
>>
>>
>>
>>--
>>PHP Database Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php


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




RE: [PHP-DB] addslashes()

2002-02-08 Thread Paul DuBois

At 10:06 -0600 2/8/02, Todd Williamsen wrote:
>Paul,
>
>Sorry for the confusion...
>
>Ok..
>
>I have an application where it organizes candidates for positions for
>HR.  There is a Notes field where they can update actions with the
>potential candidate.  Now this can be when this person has been
>contacted, conversations, or just to say this person is not available,
>etc.

I assume by this you mean you have a form-based application through
which the information is submitted.

>
>There may be a point where quotes need to be added to quote a candidate,
>or I wanted to give them the option of adding HTML tags to the field so
>that when someone looks at the person's record, that the HTML will be
>displayed.  It wasn't just the HTML that was causing problems, but the
>quotes as well.

This makes your problem basically intractable.  Sorry.

If I input: Candidate requires salary < $100K and > $75K

Then it like kinda like there's a tag there, because of the < and >

Or if I input: Candidate has a, shall we say, "checkered" past

Then the value has quotes.

Now, you want to let people put in something like:

Candidate has a, shall we say, checkered past.


Now, you can store any of those values into the database easily.   Just
use addslashes() to escape the values that are special in SQL.  When you
retrieve the values, you'll get exactly the values as shown above.

But then what do you do with them?  For the first two instances, you
need to display the <, > and " characters literally, which you might
do by converting them to HTML entities (<, <, and ") by running
the strings through htmlspecialchars() before printing them as part of the
Web page.

But for the third instance, you want to pass those same characters
through to the browser so that it interprets them as HTML markup.

How are you going to tell?


See the problem?


>
>So...
>
>If I add..
>
>Joe Blow said "blah blah blah"  the query wouldn't execute.  But if I
>did Joe Blow said, blah blah blah, it works fine.
>
>I know HTML isn't as touchy and you can actually do without the quotes,
>ie, BLAH it will still display red font.
>
>The weird thing is that I have a Job Posting section and when you update
>or edit an exsisting job and add HTML, it works fine without the
>addslashes() function, but with the Edit Candidate, it craps out...
>Weird, both are practically carbon copies of each other, database field
>is both set to "TEXT" and both queries are the same structure.
>
>I cannot figure it out
>
>If you want the URL to look at it, I will send it to you.
>
>Thanks!


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




RE: [PHP-DB] addslashes()

2002-02-08 Thread Paul DuBois

At 10:22 -0600 2/8/02, Todd Williamsen wrote:
>Paul,
>
>No kidding I see the problem, that is why I am asking how do I solve it.

By writing a content parser that is intelligent enough to recognize HTML
constructs and pass them through literally, while recognizing when your
people write other stuff containing the same characters that does not
signify HTML.  In other words, a parser that can read their minds.  Good
luck. :-)

Alternatively, tell them to signal special constructs using a syntax
that doesn't overlap HTML so that you can recognize the constructs and
transform them to HTML when you render a Web page.

Alternatively, tell them that if they want to include literal characters
like < or >, they must enter them as < or >.  In this case, you
interpret the text as HTML that's already properly escaped and you simply
display it as is with no extra conversion.

None of these are particularly attractive.  It's an ugly problem; I suspect
it has no pretty solution.

>I don't need the problem re-explained to me 8)
>
>-Original Message-
>From: Paul DuBois [mailto:[EMAIL PROTECTED]]
>Sent: Friday, February 08, 2002 10:21 AM
>To: Todd Williamsen; [EMAIL PROTECTED]
>Subject: RE: [PHP-DB] addslashes()
>
>
>At 10:06 -0600 2/8/02, Todd Williamsen wrote:
>>Paul,
>>
>>Sorry for the confusion...
>>
>>Ok..
>>
>>I have an application where it organizes candidates for positions for
>>HR.  There is a Notes field where they can update actions with the
>>potential candidate.  Now this can be when this person has been
>>contacted, conversations, or just to say this person is not available,
>>etc.
>
>I assume by this you mean you have a form-based application through
>which the information is submitted.
>
>>
>>There may be a point where quotes need to be added to quote a
>candidate,
>>or I wanted to give them the option of adding HTML tags to the field so
>>that when someone looks at the person's record, that the HTML will be
>>displayed.  It wasn't just the HTML that was causing problems, but the
>>quotes as well.
>
>This makes your problem basically intractable.  Sorry.
>
>If I input: Candidate requires salary < $100K and > $75K
>
>Then it like kinda like there's a tag there, because of the < and >
>
>Or if I input: Candidate has a, shall we say, "checkered" past
>
>Then the value has quotes.
>
>Now, you want to let people put in something like:
>
>Candidate has a, shall we say, checkered past.
>
>
>Now, you can store any of those values into the database easily.   Just
>use addslashes() to escape the values that are special in SQL.  When you
>retrieve the values, you'll get exactly the values as shown above.
>
>But then what do you do with them?  For the first two instances, you
>need to display the <, > and " characters literally, which you might
>do by converting them to HTML entities (<, <, and ") by
>running
>the strings through htmlspecialchars() before printing them as part of
>the
>Web page.
>
>But for the third instance, you want to pass those same characters
>through to the browser so that it interprets them as HTML markup.
>
>How are you going to tell?
>
>
>See the problem?
>
>
>>
>>So...
>>
>>If I add..
>>
>>Joe Blow said "blah blah blah"  the query wouldn't execute.  But if I
>>did Joe Blow said, blah blah blah, it works fine.
>>
>>I know HTML isn't as touchy and you can actually do without the quotes,
>>ie, BLAH it will still display red font.
>>
>>The weird thing is that I have a Job Posting section and when you
>update
>>or edit an exsisting job and add HTML, it works fine without the
>>addslashes() function, but with the Edit Candidate, it craps out...
>>Weird, both are practically carbon copies of each other, database field
>>is both set to "TEXT" and both queries are the same structure.
>>
>>I cannot figure it out
>>
>>If you want the URL to look at it, I will send it to you.
>>
>>Thanks!
>
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


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




RE: [PHP-DB] addslashes()

2002-02-08 Thread Paul DuBois

At 10:35 -0600 2/8/02, Todd Williamsen wrote:
>Explain this...
>
>Now I have Edit Jobs where you can do the same HTML and other SQL
>specific stuff in the Job Description, that works with no problems
>whatsoever, then I have this Edit Candidate page that is structured
>EXACTLY the same, and the Edit Candidate craps out...
>
>Why is that?  One works and the other doesn't?

Good question.  It may be that they really behave the same and you
don't know it because you're entering different kinds of information
into them and thus not triggering the bug for one of them.  Or it may
be that they're not really *exactly* the same.  You can test the first
possibility by swapping the information that you enter into the two
fields.  If the one that works now fails and the one that fails now works,
then you have two non-working fields and didn't realize it due to having
not tried a sufficient range of values.

If the one that works continues to work and the one that fails continues
to fail, then clear they're not really *exactly* the same.

>
>-Original Message-
>From: Paul DuBois [mailto:[EMAIL PROTECTED]]
>Sent: Friday, February 08, 2002 10:34 AM
>To: Todd Williamsen; [EMAIL PROTECTED]
>Subject: RE: [PHP-DB] addslashes()
>
>
>At 10:22 -0600 2/8/02, Todd Williamsen wrote:
>>Paul,
>>
>>No kidding I see the problem, that is why I am asking how do I solve
>it.
>
>By writing a content parser that is intelligent enough to recognize HTML
>constructs and pass them through literally, while recognizing when your
>people write other stuff containing the same characters that does not
>signify HTML.  In other words, a parser that can read their minds.  Good
>luck. :-)
>
>Alternatively, tell them to signal special constructs using a syntax
>that doesn't overlap HTML so that you can recognize the constructs and
>transform them to HTML when you render a Web page.
>
>Alternatively, tell them that if they want to include literal characters
>like < or >, they must enter them as < or >.  In this case, you
>interpret the text as HTML that's already properly escaped and you
>simply
>display it as is with no extra conversion.
>
>None of these are particularly attractive.  It's an ugly problem; I
>suspect
>it has no pretty solution.
>
>>I don't need the problem re-explained to me 8)
>>
>>-Original Message-
>>From: Paul DuBois [mailto:[EMAIL PROTECTED]]
>>Sent: Friday, February 08, 2002 10:21 AM
>>To: Todd Williamsen; [EMAIL PROTECTED]
>>Subject: RE: [PHP-DB] addslashes()
>>
>>
>>At 10:06 -0600 2/8/02, Todd Williamsen wrote:
>>>Paul,
>>>
>>>Sorry for the confusion...
>>>
>>>Ok..
>>>
>>>I have an application where it organizes candidates for positions for
>>>HR.  There is a Notes field where they can update actions with the
>>>potential candidate.  Now this can be when this person has been
>>>contacted, conversations, or just to say this person is not available,
>>>etc.
>>
>>I assume by this you mean you have a form-based application through
>>which the information is submitted.
>>
>>>
>>>There may be a point where quotes need to be added to quote a
>>candidate,
>>>or I wanted to give them the option of adding HTML tags to the field
>so
>>>that when someone looks at the person's record, that the HTML will be
>>>displayed.  It wasn't just the HTML that was causing problems, but the
>>>quotes as well.
>>
>>This makes your problem basically intractable.  Sorry.
>>
>>If I input: Candidate requires salary < $100K and > $75K
>>
>>Then it like kinda like there's a tag there, because of the < and >
>>
>>Or if I input: Candidate has a, shall we say, "checkered" past
>>
>>Then the value has quotes.
>>
>>Now, you want to let people put in something like:
>>
>>Candidate has a, shall we say, checkered past.
>>
>>
>>Now, you can store any of those values into the database easily.   Just
>>use addslashes() to escape the values that are special in SQL.  When
>you
>>retrieve the values, you'll get exactly the values as shown above.
>>
>>But then what do you do with them?  For the first two instances, you
>  >need to display the <, > and " characters literally, which you might
>>do by converting them to HTML entities (<, <, and ") by
>>running
>>the strings through htmlspecialchars() before printing them as part of
>>the
>>Web page.
>>
>>But for the third instance, you wa

Re: [PHP-DB] Simple Display

2002-02-08 Thread Paul DuBois

At 7:46 +1300 2/9/02, Barry Rumsey wrote:
>I am trying to do a simple fetch of the lastest add name. I have the
>following code :
>$query = "SELECT name FROM name ORDER BY name DESC LIMIT 1";
>$latename = mysql_query($query) or die("Select Failed!");
>$latename = mysql_fetch_array($latename);
>echo "Lastest Name Added:  $latename"
>
>I know I am doing something wrong as being new to php it get be confused.
>It returns : Lastest Name Added: Array
>
>Could someone please point out where i'm going wrong

You've fetched an array, and you're trying to print the array itself,
not a member of the array.

Perhaps you want:

echo "Lastest Name Added:  $latename[name]"

Or:

echo "Lastest Name Added:  $latename[0]"

I suppose you might also mean "Latest" rather than "Lastest"... :-)

>
>Thank you


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




Re: [PHP-DB] Round a float to the next highest value despite thevalue after the point

2002-02-08 Thread Paul DuBois

At 15:31 -0400 2/8/02, Renaldo De Silva wrote:
>how can I round a float to the next highest value reguardless of the value
>after the point, does anyone have any suggestion, any help would be
>apreciated.

Define "next highest value".

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




Re: [PHP-DB] Exact String replace with eregi_replace()

2002-02-08 Thread Paul Burney

on 2/8/02 9:05 PM, Desikan at [EMAIL PROTECTED] appended the following
bits to my mbox:

> Actually I want to replace "is" alone from the string and not all the
> words that contains is...
> 
> I have tried with "^".$is."$" ---> but yields nothing

This kind of question really belongs on the PHP General List, since it isn't
db related.

That said, look at the preg_replace function:

<http://www.php.net/manual/en/function.preg-replace.php>

And use the "\b" escape in your search string:

<http://www.php.net/manual/en/pcre.pattern.syntax.php>

Paul





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




Re: [PHP-DB] Maintain MySQL Transactions

2002-02-09 Thread Paul DuBois

At 2:00 +0800 2/10/02, Jason Wong wrote:
>On Sunday 10 February 2002 00:21, Miles Thompson wrote:
>>  Unless there has been a very recent development, MySQL doesn't support
>>  transactions. Use PostgreSQL, DB, etc.
>
>The v4 series of MySQL does support transactions.

MySQL has supported transactions since version 3.23.17.  At that time
BDB tables were the only transaction-capable type.  InnoDB tables were
added in version 3.23.34a.

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




Re: [PHP-DB] Problem in programming PHP with WML

2002-02-25 Thread Paul Burney

on 2/25/02 11:32 AM, ªüYam at [EMAIL PROTECTED] appended the following
bits to my mbox:

> I don't know why??That comes out a Err Msg about "Unsupported type:
> text/html" .

I've never done any WML scripting, but the error message offers a big clue.
PHP by default sends a Content-type header of text/html.  Evidently, WAP
enabled devices don't like that.

Try something like this:

Header('Content-type: text/vnd.wap.wml');

Not sure about that content type, but it was what I found on a simple google
search.

HTH.

Paul





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




Re: [PHP-DB] Upgrading from php -4.0.3

2002-02-27 Thread Paul Burney

on 2/27/02 2:51 AM, Marco Coletta at [EMAIL PROTECTED] appended the
following bits to my mbox:

> I would like to upgrade to newer version of php, ho can supply detailed
> instructions.

You can start here:

http://www.php.net/manual/en/installation.php

And if you have difficulty, post your problems to the PHP-INSTALL list.

Since this is the database list, you *should not* post those questions here.

Paul





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




Re: [PHP-DB] Question about setting up multiple relations

2002-02-28 Thread Paul Burney

on 2/28/02 2:21 AM, Monty at [EMAIL PROTECTED] appended the following bits
to my mbox:

> I have an Image table in a MySQL database that will be used to store the
> location of all images used on my site. Some images will relate to an
> Article table (article.id) and some images may relate to a Member table
> (member.id).
> 
> As it's possible that there may be an article.id that is the same as a
> member.id, I am considering adding two fields to the Image table (article_id
> and member_id) one of which will be left blank for each record, depending on
> the image's relation. For example, if "mypic.jpg" is related to article.id
> 288 in the Article table, then I would insert 288 into the article_id field
> in the Image table but leave the member_id field blank.

Personally, I'd use translation or many to many relationship tables.

You'd have five tables total:

images, articles, articles_images, members, members_images

The schema for the articles_images table would be:

record_id (primary key sequence/auto-increment)
article_id
image_id

If the RDBMS supports it, make a unique key on the combo of (article_id,
image_id).

If you're in an article, you can then get the images by doing a:

SELECT col1,col2,col3 FROM articles_images AS ai LEFT JOIN images AS i ON
ai.image_id=i.image_id WHERE article_id="CURRENT_ARTICLE_ID"

This allows you to have one source of images and allows you to have multiple
images used in an article or multiple articles using the same image.

You could then also setup a members_images in the same way.

Hope that helps.

Paul





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




Re: [PHP-DB] security

2002-03-03 Thread Paul Burney

on 3/3/02 7:39 PM, Ric Mañalac at [EMAIL PROTECTED] appended
the following bits to my mbox:

> i personally think that the developer still has
> the control in making his php code secure. but how do you
> think will this news affect php as one of the most popular
> choice for web developers?

Probably doesn't belong so much on the PHP-DB list, since databases not
involved, but since some of you on the list may not be aware

In most cases, PHP security can be controlled by the developer, but *not* in
this case.

Basically, most php security problems stem from someone not properly
checking input and being sloppy when connecting to databases, etc.

This case, however, is an actual problem in the PHP server code, not
anything you would write.  To summarize, if you have file_uploads enabled on
the server, php parses "multipart/form-data" data that is sent to the
script.

It does this for *any* file, not just the ones that have file uploads in
them.  The bug is in that code and can be used by malicious parties to do
evil things on your server.  It can be used against you even if you only
have one page on your server parsed by PHP and the hacker can find it.

The original report is here:

<http://security.e-matters.de/advisories/012002.html>

Basically you have three options:

1) Disable file_uploads, if you're not using them, in the php.ini file.
This works for PHP 4.0.3 or greater.

2) Apply the source patch to your source tree and rebuild.  Works for PHP
3.0.18, 4.06, 4.1.0 and 4.1.1.

3) Upgrade to PHP 4.1.2

You should really do this as soon as possible.  I'm sure someone will make a
Code Red type of infestation soon to exploit this bug soon.  Evidently,
there is a crude exploit circulating.

Hope that helps.

Paul




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




Re: [PHP-DB] addslashes needed for db security? Hack proving webapps

2002-03-05 Thread Paul Burney

on 3/5/02 5:35 AM, Andy at [EMAIL PROTECTED] appended the following bits
to my mbox:

> No I was reading in  a mysql book, that chars like ' are bad for db
> PHP provides the function addslashes. Is this the way to check for bad
> entries a user provides? What happens
> if a hacker tryes to delete my db entries with a input like 'delete ...

addslashes() is a good function to use on data before inputting it into a
database.  It is also good practice to pass every value as quoted.  Further,
you should use regular expressions to see if text values are really text,
and number values are really numbers, etc.

Most of the security problems I've seen with PHP and MySQL come down to
something like this, both of which can be avoided with add slashes and
quoting:

You have a "user table" that has some integer values to determine something,
say, whether to save cookies or not.  So save_cookies should have a value of
0 or 1, depending on a checkbox on a web form.  You also have a field in the
db for user_type that should be "normal" or "admin".

Let's say the query code on your page is:

$query = 'INSERT INTO my_table
SET username="' . $username . '",
save_cookies=' . $save_cookies;

If it goes as expected the query is:

'INSERT INTO my_table SET username="burney", save_cookies=1';

If a malicious user is familiar with your table structure, though, they
could pass the value of {0, user_type='admin'} for the save_cookie variable,
giving:

'INSERT INTO my_table SET username="burney", save_cookies=1,
user_type="admin"';

And now their user has admin access to the application.  There was a problem
like this with the phpBB discussion board last year.

Similar problems exist with select queries if a user can get the query:

SELECT * FROM my_table WHERE visible="yes" AND some_field LIKE "keyword";

to turn into:

SELECT * FROM my_table WHERE visible="yes" AND some_field LIKE "keyword" OR
1="1";

If keyword is a user defined field, and the value {keyword" OR 1="1} is
passed to it, the above query will result and the user will see all data in
the table.

As you can see if you addslashes, quote all values in queries, and/or use a
regular expression to remove quotes, these types of problems don't occur.

People always say that "they can pass a query including a semicolon and then
a delete statement" and delete your entire database.  With PHP and MySQL
(not sure about other RDBMS), only one command can be processed per call so
that particular attack won't work, but as you can see, the above ones could.

> Are there any good articles on the web about checking user input, securing
> webapps against hackers?

Security Focus <http://securityfocus.com/> runs something called Web App
Security that you might find interesting.

HTH.

Paul



 


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




Re: [PHP-DB] security

2002-03-05 Thread Paul Burney

on 3/4/02 11:34 PM, jas at [EMAIL PROTECTED] appended the following bits
to my mbox:

> how can you find out what the php.ini is looking like?  is there a way to
> use php to get that info.  i have used phpinfo() but i cannot see whether or
> not file_uploads is disabled

It will only show up in PHP 4.0.3 or greater.   Under the PHP Core section,
look in the Directive list for file_uploads.

The Local Value is the one for the current script.  The Master Value is the
one in the php.ini file.

If you aren't using PHP 4.0.3 or greater, you *cannot* disable file_uploads
and must upgrade to fix the problem.

HTH

Paul






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




Re: [PHP-DB] Dynamic Drop Down Box

2002-03-06 Thread Paul Burney

on 3/6/02 10:31 AM, Leotta, Natalie (NCI/IMS) at [EMAIL PROTECTED]
appended the following bits to my mbox:

> If they want two pages they wouldn't need JS though - just submit and use
> that in your second query to populate drop-down #2.  I had assumed that they
> wanted it on the same page - which is definitely cooler :-)  Good point
> though - I should have asked which way they wanted to do it.  I suppose if
> you really wanted to be able to say your site used JS you could still use it
> to set a hidden value in the form and submit it to the next page that way.

I figured I'd throw something in too.

I personally don't like the client side scripting option because it
adversely affects accessibility.  If you choose the client side option, you
should also have a non JavaScript version as well (the 2 pages mentioned
before) for site visitors that have other types of interfaces that don't
understand JavaScript or for visitors that have dynamic scripting turned off
(not a bad idea these days with all the XSS cookie stealing stuff).

That said, WebReference has a great tutorial and a bunch of code that you
can use to make the nifty related drop-down menus.  You can see the theory
and tutorial here:

<http://webreference.com/dev/menus/>

And they even have a script that'll generate the code for you here:

<http://webreference.com/js/tools/menus/>

Hope that helps.

Sincerely,

Paul Burney
http://paulburney.com/

http://security.e-matters.de/advisories/012002.html> */

?>


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




Re: [PHP-DB] Can I attach an image to a newsgroup post?

2002-03-07 Thread Paul Burney

on 3/7/02 3:34 PM, Monty at [EMAIL PROTECTED] appended the following bits
to my mbox:

> Is it possible to attach an image to a post here in order to better
> illustrate a point? If so, how?? Thanks!

Please don't upload the image (or any other attachments) to the
list/newsgroup.  It's better to place it on a public web server somewhere
and then use a link to it in your post, like this:

<http://example.com/somefolder/my_image.jpg>

Or

<http://example.com/somefolder/my_php_file.phps>

Sincerely,

Paul Burney
http://paulburney.com/

http://security.e-matters.de/advisories/012002.html> */

?>


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




Re: [PHP-DB] Looking for a good MySQL db abstraction layer

2002-03-08 Thread Paul Burney

on 3/8/02 1:04 PM, Michael Zornek at [EMAIL PROTECTED] appended the
following bits to my mbox:

> I'm looking for a good MySQL db abstraction layer. I'm just coming back to
> PHP/MySQL and rather writing my own I figured I'd try to see if any are
> already out there.
> 
> The layer should obviously have the basics, of connect, query, and close,
> and possibly some error checking and handling.

You should probably look into PEAR.  <http://pear.php.net/>  You probably
have the basic PEAR stuff if you did a source install of PHP.

They have a DB Abstraction class that is similar to Perl DBI and it appears
to be the way of the future.

<http://pear.php.net/manual/en/core.db.php>

FWIW, the author of the PHP Developers' Cookbook (Sams) did all of the
database examples using PEAR syntax.

Of course, I've not made the switch over yet so take my advice with a grain
of salt.

Hope it helps.

Sincerely,

Paul Burney
http://paulburney.com/

http://security.e-matters.de/advisories/012002.html> */

?>


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




Re: [PHP-DB] how to start and bring down mysql.server on OSX

2002-03-15 Thread Paul Burney

on 3/15/02 9:51 AM, andy at [EMAIL PROTECTED] appended the following bits
to my mbox:

> Anyhow I would like to start it automaticly at boot time. I tryed to start
> the server by typing mysql.server start, but I get an command not found. i
> gueess I am in the right dir.

Check out Marc Liyange's startup script for MySQL on OS X.

<http://www.entropy.ch/software/macosx/mysql/>

HTH.

Sincerely,

Paul Burney
http://paulburney.com/

http://security.e-matters.de/advisories/012002.html> */

?>


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




Re: [PHP-DB] https post using php

2002-03-28 Thread Paul Burney

on 3/27/02 11:45 PM, mailing list at [EMAIL PROTECTED] appended the
following bits to my mbox:

> I am attempting to POST to a https://whatever.url.com server and return
> the result from the server into the script without the user knowing using
> a php script.  I can not use CURL becuase the shared server I have hosting
> this site was not compiled -with-curl.  I downloaded HTTP_POST PHP script
> from: http://px.sklar.com/code.html?code_id=313.  Here is my code that I
> am using to call the functions:

> Reason: You're speaking plain HTTP to an SSL-enabled server port.
> Instead use the HTTPS scheme to access this URL, please.

1) Since this post is non-database related, it should be posted to the
PHP-General list.

2) That said, I don't think it's possible to do what you want without curl.
There's much more to an SSL/HTTPS connection that talking on a different
port.

Paul





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




Re: [PHP-DB] displaying info in a form

2002-03-29 Thread Paul Burney

on 3/29/02 10:54 AM, Natividad Castro at [EMAIL PROTECTED] appended the
following bits to my mbox:

> I'm trying to display data in a form, but for some reason I can display the
> entire value of every field that has more than two words in the text box.
> For example, if I want to display the name CASTRO TRUCKING, the text field
> only display the first word CASTRO.

> >

Just following up on what someone else said.  If the Name field has a quote
in it, such as <> that could also cause
problems.  

To remedy, do this:



HTH,

Paul Burney
http://burney.ws/





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




Re: [PHP-DB] using multiple checkboxes to delete from db

2002-03-30 Thread Paul Burney

on 3/30/02 6:33 PM, wesley grubbs:. at [EMAIL PROTECTED] appended the
following bits to my mbox:

> foreach($_POST["del"] as $val) {
> 
> $sql = "DELETE FROM $tablename WHERE id = $val";

Be very careful with this.  If a user spoofs the form and adds the value for
del like this:



Would make the SQL statement:

DELETE FROM table WHERE id=2 OR 1=1

Which would, of course, delete all records in the table.

To remedy that, you could quote the value in the SQL statement and pass the
addslashed $val, like this:

$sql = "DELETE FROM $tablename WHERE id='" . addslashes($val) . "'";

That is a lot harder to get around (though perhaps still possible).

Also...

on 3/30/02 8:31 PM, Hugh Bothwell at [EMAIL PROTECTED] appended the
following bits to my mbox:

> // NOTE: this assumes that 0 is never a valid id; I just
> // stuck it in to make the comma-delimiting come out right
> $query = "DELETE FROM tablename WHERE id IN ( 0";
> 
> foreach($_POST["del"] as $val)
>   $query .= ', '.$val;
> 
> $query .= ' )';

You could use implode for things like this, i.e.,

$sql = "DELETE FROM $tablename WHERE id IN ('" .
implode("','", addslashes($_POST['del'])) . "')";

That would produce something like:

DELETE FROM table WHERE id IN ('3','4','123');

Hope that helps.

Sincerely,

Paul Burney
<http://paulburney.com/>




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




Re: [PHP-DB] Updating Forms Values

2002-04-04 Thread Paul Burney

on 4/4/02 8:35 AM, [EMAIL PROTECTED] at [EMAIL PROTECTED] appended the following
bits to my mbox:

> home.php?name=Barry Zimmerman
> 
> This once you have eddited a page becomes:
> 
> home.php?name=Barry

You'll need to url encode the variable:

echo 'home.php?name=' , urlencode($username);

HTH.

Sincerely,

Paul Burney
<http://paulburney.com/>





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




Re: [PHP-DB] OS X Security Update Change to Mysql

2002-04-07 Thread Paul DuBois

At 18:09 -0600 4/7/02, Gale & Tammy Allen wrote:
>Hello,
>   I'm pretty new to MYSQL, but wanted to share this info. With the 
>most recent OS X Security update, MYSQL 4.1.2 is installed. I had 
>installed the update

MySQL 4.1.2 doesn't exist.  I think you mean PHP 4.1.2.

>prior to this security patch. Before the security patch, the PHP.INI 
>file was in the /usr/local/lib folder. After installing the security 
>update, the new Configuration File Path location became /usr/lib for 
>the PHP.INI file. I found this out due to a calculation db I've 
>created that can computate for minutes to hours depending on the 
>data entered. After installing the security update, MYSQL defaulted 
>back to 30 seconds for the max_execution_time parameter due to the 
>fact that the Configuration File Path had changed. I copied my 
>PHP.INI file to the new location and restarted my Mac. All was back 
>to normal for the max_execution_time that I had set in PHP.INI. I 
>hope this helps the OS X masses. :)


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




[PHP-DB] Upload Multiple Images

2002-04-11 Thread Brandon Paul

Hi all...kinda new to PHP and MySQL...anyhow, I have created the following
table:

CREATE TABLE images (
  id smallint(6) NOT NULL auto_increment,
  image_title varchar(75) default NULL,
  image_src varchar(150) default NULL,
  PRIMARY KEY (id)
) TYPE=MyISAM;

I have also created a form that allows me to upload one image at a time, but
I would like to be able to upload SEVERAL images at once.  Directory for
images is:

./_images/(filenames)

There are also some subdirectories.  What can I do to make it so that I can
upload all of the images in a directory (or at least more than one) without
having to type each one in and submit it?

Your help would be very much appreciated!

Thanks,

Brandon Paul



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




Re: [PHP-DB] Closing curly brackets?

2002-04-13 Thread Paul Burney

on 4/12/02 11:15 PM, Jennifer Downey at [EMAIL PROTECTED] appended the
following bits to my mbox:

> I believe it has something to do with the first while statement's closing
> curly bracket placement
> but I can't seem to get it in the right place.

Hi Jennifer,

The first thing you should do is properly indent your code.  If you do so,
you'll be sure to find the missing bracket.  Basically, for each new block,
tab out again.  It really helps to use a programmer's editor with syntax
highlighting like vim or BBEdit.  Here's an example using your code:

===

$id = $HTTP_GET_VARS["id"];

$query = "SELECT id, name, image, quantity, type FROM
{$config["prefix"]}_my_items WHERE uid={$session["uid"]} ORDER BY id";
$ret = mysql_query($query);

while($row = mysql_fetch_array($ret)) {

$iid = $row['id'];
$image = $row['image'];
$name = $row['name'];
$quantity = $row['quantity'];
$type = $row['type'];

if ($iid == $id) {

$display_block ="$name$quantity$type";
echo "$display_block";

if ($type == "food") {

//if book or weapon is present then set an option and include in
the form later
$thisoption="Feed my pet\n";

} else {

//if any other type is present then set a blank
$thisoption="";}

} // end option "if" statement

} // end id "if" statement

/* More code after this point */

} // end "while" if statement.


===

Hope that helps.

Sincerely,

Paul Burney
<http://paulburney.com/>





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




  1   2   3   4   >