RE: [PHP-DB] File Downloads

2010-05-28 Thread Adam Schroeder
Hi Karl --

It depends -- you could track the download logs in a database and limit based 
on IP.

So your steps would be:

1) User visits PHP script

2) If the user has not downloaded the file before and if the number of 
downloads is less than 150 then allow them to download.

3) PHP script grabs user's IP address from $_SERVER['REMOTE_ADDR'].

4) When the script's copy function completes, register the user's IP address in 
a database.  You can later check against this to verify they have not 
downloaded the file.

Using IP addresses for this type of control come with problems... but depending 
on the importance of the content -- it should be good.

Adam
 

-Original Message-
From: Karl DeSaulniers [mailto:k...@designdrumm.com] 
Sent: Friday, May 28, 2010 2:36 PM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] File Downloads


On May 28, 2010, at 4:33 PM, Karl DeSaulniers wrote:

>
> On May 28, 2010, at 4:18 PM, Adam Schroeder wrote:
>
>> Hi Karl --
>>
>> You can store the file contents outside of the web tree and use  
>> PHP to "read" the contents.  This allows you to place access  
>> control restrictions in the PHP script.
>>
>> This post talks about doing something similar with images.   
>> Obviously, if you have a music track... you'll need to adjust the  
>> mime type accordingly.
>>
>> http://stackoverflow.com/questions/258365/php-link-to-image-file- 
>> outside-default-web-directory/258380#258380
>>
>> Good luck.
>>
>> Adam
>>
>>
>> -Original Message-
>> From: Karl DeSaulniers [mailto:k...@designdrumm.com]
>> Sent: Friday, May 28, 2010 1:39 PM
>> To: php-db@lists.php.net
>> Subject: [PHP-DB] File Downloads
>>
>> Hello,
>> How can I go about restricting the number of downloads of a file on
>> my server?
>> For Eg: if I want a music track to only be able to be downloaded by
>> 150 people and thats it.. ever,
>> how can I go about doing this?
>>
>> Much obliged,
>>
>> Karl DeSaulniers
>> Design Drumm
>> http://designdrumm.com
>>
>>
>
> Very Nice. Good link.
> I think this is the route I may go.
> Seems a bit more secure if the php script gains access to the file  
> through the .htaccess files set-up.
>
> Thanks Adam.
>
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com
>
>
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

But how do I tetect if a file has been downloaded by multiple people  
and in the process stop someone who has downloaded it once to not be  
able to do again?
THX

Karl DeSaulniers
Design Drumm
http://designdrumm.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



RE: [PHP-DB] File Downloads

2010-05-28 Thread Adam Schroeder
Hi Karl --

You can store the file contents outside of the web tree and use PHP to "read" 
the contents.  This allows you to place access control restrictions in the PHP 
script.

This post talks about doing something similar with images.  Obviously, if you 
have a music track... you'll need to adjust the mime type accordingly.

http://stackoverflow.com/questions/258365/php-link-to-image-file-outside-default-web-directory/258380#258380

Good luck.

Adam


-Original Message-
From: Karl DeSaulniers [mailto:k...@designdrumm.com] 
Sent: Friday, May 28, 2010 1:39 PM
To: php-db@lists.php.net
Subject: [PHP-DB] File Downloads

Hello,
How can I go about restricting the number of downloads of a file on  
my server?
For Eg: if I want a music track to only be able to be downloaded by  
150 people and thats it.. ever,
how can I go about doing this?

Much obliged,

Karl DeSaulniers
Design Drumm
http://designdrumm.com



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



RE: [PHP-DB] RE: Help for a beginner

2009-12-23 Thread Adam Sonzogni
Barry,

You sir saved the day, the very last item on that page was the ticket, I 
disabled IPV6 but never thought to removed the localhost entry for ipv6 in 
hosts...

That said I google'd dozens of times with a variety of keyword combinations all 
including iis7 and PHP,  and not once did that page pop up :(



The default installation of Windows Vista, Windows 7 and Windows Server 2008 
adds a line to the Windows/System32/drivers/etc/hosts which causes network 
functions (database connect functions too, like mysql_connect) to timeout when 
connecting to "localhost".  To resolve this problem, remove the entry from the 
hosts file:
::1 localhost

or connect using the IP address, 127.0.0.1 or another domain name.

This behavior change is due to IPv6 being enabled by default in Vista or other 
recent Windows version.




From: Barry Stear [mailto:bst...@gmail.com]
Sent: Wednesday, December 23, 2009 1:54 PM
To: Adam Sonzogni; PHP DB Posts
Subject: Re: [PHP-DB] RE: Help for a beginner

I apologize I do see that you tried using phpmyadmin and received the FastCGI 
error.

This might help you : http://www.php.net/manual/en/install.windows.iis7.php   . 
Let me know what happens after you try those steps.. I am hoping for the best..


On Wed, Dec 23, 2009 at 9:21 AM, Adam Sonzogni 
mailto:asonzo...@setfocus.com>> wrote:
If you read the thread I useda php page totest mysql connectivity after 
phpmyadmin did not work...

At this point I am willing to pay someone to troubleshoot this as I am baffled 
there is no definitive troubleshooting documentation for Windows installs.


From: Barry Stear [mailto:bst...@gmail.com<mailto:bst...@gmail.com>]
Sent: Wednesday, December 23, 2009 12:04 PM
To: Adam Sonzogni
Cc: PHP DB Posts

Subject: Re: [PHP-DB] RE: Help for a beginner

Well I am not familiar with ASP.  You might want to check to make sure that you 
didn't make any typos in your mysql_test.php page. I would suggest seeing if 
you can connect through phpMyAdmin. That might give you a better idea of where 
the problem lies.
On Wed, Dec 23, 2009 at 8:31 AM, Adam Sonzogni 
mailto:asonzo...@setfocus.com>> wrote:
Barry,

Yes this is all installed ona single system.

The code was in the original message

  <%
  set conn=Server.CreateObject("ADODB.Connection")
  conn.ConnectionString="Driver={mySQL};Server=localhost;Database=test;User 
Id=root;Password=youwish"
  conn.open
  Response.write("Connected")
  conn.close
  %>

So line 4 is:   conn.open


Thanks,
Adam

-Original Message-
From: Barry Stear [mailto:bst...@gmail.com<mailto:bst...@gmail.com>]
Sent: Wednesday, December 23, 2009 11:28 AM
To: PHP DB Posts
Subject: Re: [PHP-DB] RE: Help for a beginner

Adam,

What is at Line 4 in your test.asp? The error you provided said that there
was a problem where it could not find the default driver to use.

Also when you get the connection failed you were trying to connect to MYSQL
from the system running MYSQL correct?

On Wed, Dec 23, 2009 at 7:50 AM, Adam Sonzogni 
mailto:asonzo...@setfocus.com>>wrote:

> Giff,
>
> Not sure what you mean, and I suspect this is because of my confusion
> around PMA (as mentioned originally) SO let me elaborate...
>
>
>
> In my config.inc.php I changed pma to root and the pma password to the root
> password for mysql
> When I browse to the phpmyadmin page I neter root and the root password for
> mysql
>
> Thanks,
> Adam
>
> -Original Message-
> From: Giff Hammar 
> [mailto:gham...@sv-phoenix.com<mailto:gham...@sv-phoenix.com>]
> Sent: Wednesday, December 23, 2009 10:41 AM
> To: php-db@lists.php.net<mailto:php-db@lists.php.net>
>  Subject: Re: [PHP-DB] RE: Help for a beginner
>
> It looks like you are not connecting because of a user name/password
> combination. Typically, Windows does not use root as a valid login as do
> most other operating systems. Try using your login information to see if
> you can connect to mySQL using the GUI. I suspect you'll succeed. The
> other option would be to use the mySQL admin user name and password. One
> of those should work.
>
> Once you can connect to your database with the GUI, you can then use PHP
> to call the mySQL database connect strings and manipulate your data as
> necessary. The DBD/DBI is a more generic solution that allows you to use
> a standard coding structure in PHP (or perl) and easily change databases
> underneath. For a small implementation, this isn't necessary. There are
> other database abstraction layers that perform the same function.
>
> Giff
>
> On Wed, 2009-12-23 at 20:46 +0530, Chaitanya Yanamadala wrote:
> > why dont u install the xampp
> >
> > On Wed, Dec 23, 2009 at 8:38 PM, Adam Sonzogni 
> > mailto:asonzo...@setfocus.com>
> >wrote:
>

RE: [PHP-DB] RE: Help for a beginner

2009-12-23 Thread Adam Sonzogni
If you read the thread I useda php page totest mysql connectivity after 
phpmyadmin did not work...

At this point I am willing to pay someone to troubleshoot this as I am baffled 
there is no definitive troubleshooting documentation for Windows installs.


From: Barry Stear [mailto:bst...@gmail.com]
Sent: Wednesday, December 23, 2009 12:04 PM
To: Adam Sonzogni
Cc: PHP DB Posts
Subject: Re: [PHP-DB] RE: Help for a beginner

Well I am not familiar with ASP.  You might want to check to make sure that you 
didn't make any typos in your mysql_test.php page. I would suggest seeing if 
you can connect through phpMyAdmin. That might give you a better idea of where 
the problem lies.

On Wed, Dec 23, 2009 at 8:31 AM, Adam Sonzogni 
mailto:asonzo...@setfocus.com>> wrote:
Barry,

Yes this is all installed ona single system.

The code was in the original message

  <%
  set conn=Server.CreateObject("ADODB.Connection")
  conn.ConnectionString="Driver={mySQL};Server=localhost;Database=test;User 
Id=root;Password=youwish"
  conn.open
  Response.write("Connected")
  conn.close
  %>


So line 4 is:   conn.open


Thanks,
Adam

-Original Message-
From: Barry Stear [mailto:bst...@gmail.com<mailto:bst...@gmail.com>]
Sent: Wednesday, December 23, 2009 11:28 AM
To: PHP DB Posts
Subject: Re: [PHP-DB] RE: Help for a beginner

Adam,

What is at Line 4 in your test.asp? The error you provided said that there
was a problem where it could not find the default driver to use.

Also when you get the connection failed you were trying to connect to MYSQL
from the system running MYSQL correct?

On Wed, Dec 23, 2009 at 7:50 AM, Adam Sonzogni 
mailto:asonzo...@setfocus.com>>wrote:

> Giff,
>
> Not sure what you mean, and I suspect this is because of my confusion
> around PMA (as mentioned originally) SO let me elaborate...
>
>
>
> In my config.inc.php I changed pma to root and the pma password to the root
> password for mysql
> When I browse to the phpmyadmin page I neter root and the root password for
> mysql
>
> Thanks,
> Adam
>
> -Original Message-
> From: Giff Hammar 
> [mailto:gham...@sv-phoenix.com<mailto:gham...@sv-phoenix.com>]
> Sent: Wednesday, December 23, 2009 10:41 AM
> To: php-db@lists.php.net<mailto:php-db@lists.php.net>
>  Subject: Re: [PHP-DB] RE: Help for a beginner
>
> It looks like you are not connecting because of a user name/password
> combination. Typically, Windows does not use root as a valid login as do
> most other operating systems. Try using your login information to see if
> you can connect to mySQL using the GUI. I suspect you'll succeed. The
> other option would be to use the mySQL admin user name and password. One
> of those should work.
>
> Once you can connect to your database with the GUI, you can then use PHP
> to call the mySQL database connect strings and manipulate your data as
> necessary. The DBD/DBI is a more generic solution that allows you to use
> a standard coding structure in PHP (or perl) and easily change databases
> underneath. For a small implementation, this isn't necessary. There are
> other database abstraction layers that perform the same function.
>
> Giff
>
> On Wed, 2009-12-23 at 20:46 +0530, Chaitanya Yanamadala wrote:
> > why dont u install the xampp
> >
> > On Wed, Dec 23, 2009 at 8:38 PM, Adam Sonzogni 
> > mailto:asonzo...@setfocus.com>
> >wrote:
> >
> > > Mr. Brookhouse,
> > >
> > > Thanks for the quick reply. I am guessing it is not relevant to my case
> > > because I am not using PERL. I cannot find anything that says PHP
> requires
> > > PERL so I suspect Iam ok in this regard.
> > >
> > > Thank You,
> > > Adam
> > >
> > >
> > > -Original Message-
> > > From: Edward Brookhouse 
> > > [mailto:eb...@healthydirections.com<mailto:eb...@healthydirections.com>]
> > > Sent: Wednesday, December 23, 2009 9:59 AM
> > > To: Adam Sonzogni; php-db@lists.php.net<mailto:php-db@lists.php.net>
> > > Subject: RE: Help for a beginner
> > >
> > > Just a guess, as I have not tried a full stack in windows, but in any
> unix
> > > if you are connecting php and mysql, you need something in the middle
> like
> > > DBD::mysql
> > >
> > > See if this helps: http://forums.mysql.com/read.php?51,189692,189856
> > >
> > >
> > > -Original Message-
> > > From: Adam Sonzogni 
> > > [mailto:asonzo...@setfocus.com<mailto:asonzo...@setfocus.com>]
> > > Sent: Wednesday, December 23, 2009 9:52 AM
> > > To: php-db@lists.php.net<mailto:php-db@lists.php

RE: [PHP-DB] RE: Help for a beginner

2009-12-23 Thread Adam Sonzogni
Barry,

Yes this is all installed ona single system.

The code was in the original message

   <%
   set conn=Server.CreateObject("ADODB.Connection")
   conn.ConnectionString="Driver={mySQL};Server=localhost;Database=test;User 
Id=root;Password=youwish"
   conn.open
   Response.write("Connected")
   conn.close
   %>



So line 4 is:   conn.open


Thanks,
Adam

-Original Message-
From: Barry Stear [mailto:bst...@gmail.com] 
Sent: Wednesday, December 23, 2009 11:28 AM
To: PHP DB Posts
Subject: Re: [PHP-DB] RE: Help for a beginner

Adam,

What is at Line 4 in your test.asp? The error you provided said that there
was a problem where it could not find the default driver to use.

Also when you get the connection failed you were trying to connect to MYSQL
from the system running MYSQL correct?

On Wed, Dec 23, 2009 at 7:50 AM, Adam Sonzogni wrote:

> Giff,
>
> Not sure what you mean, and I suspect this is because of my confusion
> around PMA (as mentioned originally) SO let me elaborate...
>
>
>
> In my config.inc.php I changed pma to root and the pma password to the root
> password for mysql
> When I browse to the phpmyadmin page I neter root and the root password for
> mysql
>
> Thanks,
> Adam
>
> -Original Message-
> From: Giff Hammar [mailto:gham...@sv-phoenix.com]
> Sent: Wednesday, December 23, 2009 10:41 AM
> To: php-db@lists.php.net
>  Subject: Re: [PHP-DB] RE: Help for a beginner
>
> It looks like you are not connecting because of a user name/password
> combination. Typically, Windows does not use root as a valid login as do
> most other operating systems. Try using your login information to see if
> you can connect to mySQL using the GUI. I suspect you'll succeed. The
> other option would be to use the mySQL admin user name and password. One
> of those should work.
>
> Once you can connect to your database with the GUI, you can then use PHP
> to call the mySQL database connect strings and manipulate your data as
> necessary. The DBD/DBI is a more generic solution that allows you to use
> a standard coding structure in PHP (or perl) and easily change databases
> underneath. For a small implementation, this isn't necessary. There are
> other database abstraction layers that perform the same function.
>
> Giff
>
> On Wed, 2009-12-23 at 20:46 +0530, Chaitanya Yanamadala wrote:
> > why dont u install the xampp
> >
> > On Wed, Dec 23, 2009 at 8:38 PM, Adam Sonzogni  >wrote:
> >
> > > Mr. Brookhouse,
> > >
> > > Thanks for the quick reply. I am guessing it is not relevant to my case
> > > because I am not using PERL. I cannot find anything that says PHP
> requires
> > > PERL so I suspect Iam ok in this regard.
> > >
> > > Thank You,
> > > Adam
> > >
> > >
> > > -Original Message-
> > > From: Edward Brookhouse [mailto:eb...@healthydirections.com]
> > > Sent: Wednesday, December 23, 2009 9:59 AM
> > > To: Adam Sonzogni; php-db@lists.php.net
> > > Subject: RE: Help for a beginner
> > >
> > > Just a guess, as I have not tried a full stack in windows, but in any
> unix
> > > if you are connecting php and mysql, you need something in the middle
> like
> > > DBD::mysql
> > >
> > > See if this helps: http://forums.mysql.com/read.php?51,189692,189856
> > >
> > >
> > > -Original Message-
> > > From: Adam Sonzogni [mailto:asonzo...@setfocus.com]
> > > Sent: Wednesday, December 23, 2009 9:52 AM
> > > To: php-db@lists.php.net
> > > Subject: [PHP-DB] Help for a beginner
> > >
> > > Hi everyone, first thank you for ALL help and the understanding that I
> am
> > > new to PHP and MySQL. This is a long email and for that I apologize but
> I am
> > > trying to provide as much detail as possible. If this is the wrong list
> to
> > > ask for help, kindly direct me to the proper authority.
> > >
> > > I am trying to learn and I have built the following environment.
> > >
> > > Windows Server 2008 Standard 32bit service Pack 2 with IIS7
> > > mysql-essential-5.1.41-win32
> > > php-5.3.1-nts-Win32-VC9-x86.msi
> > > phpMyAdmin-3.2.4-english.zip
> > >
> > >
> > > I followed the steps as detailed below (I already had IIS7 and CGI
> > > installed)
> > >
> > >
> > > 1. Install CGI & PHP
> > >
> http://www.trainsignaltraining.com/iis-7-install-fastcgi-php/2008-09-04/
> > >
> > > 2. Install MySQL
> > >   http://www.trainsignaltraining.com/ins

RE: [PHP-DB] RE: Help for a beginner

2009-12-23 Thread Adam Sonzogni
Giff,

Not sure what you mean, and I suspect this is because of my confusion around 
PMA (as mentioned originally) SO let me elaborate...



In my config.inc.php I changed pma to root and the pma password to the root 
password for mysql
When I browse to the phpmyadmin page I neter root and the root password for 
mysql

Thanks,
Adam

-Original Message-
From: Giff Hammar [mailto:gham...@sv-phoenix.com] 
Sent: Wednesday, December 23, 2009 10:41 AM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] RE: Help for a beginner

It looks like you are not connecting because of a user name/password
combination. Typically, Windows does not use root as a valid login as do
most other operating systems. Try using your login information to see if
you can connect to mySQL using the GUI. I suspect you'll succeed. The
other option would be to use the mySQL admin user name and password. One
of those should work.

Once you can connect to your database with the GUI, you can then use PHP
to call the mySQL database connect strings and manipulate your data as
necessary. The DBD/DBI is a more generic solution that allows you to use
a standard coding structure in PHP (or perl) and easily change databases
underneath. For a small implementation, this isn't necessary. There are
other database abstraction layers that perform the same function.

Giff

On Wed, 2009-12-23 at 20:46 +0530, Chaitanya Yanamadala wrote:
> why dont u install the xampp
> 
> On Wed, Dec 23, 2009 at 8:38 PM, Adam Sonzogni wrote:
> 
> > Mr. Brookhouse,
> >
> > Thanks for the quick reply. I am guessing it is not relevant to my case
> > because I am not using PERL. I cannot find anything that says PHP requires
> > PERL so I suspect Iam ok in this regard.
> >
> > Thank You,
> > Adam
> >
> >
> > -Original Message-
> > From: Edward Brookhouse [mailto:eb...@healthydirections.com]
> > Sent: Wednesday, December 23, 2009 9:59 AM
> > To: Adam Sonzogni; php-db@lists.php.net
> > Subject: RE: Help for a beginner
> >
> > Just a guess, as I have not tried a full stack in windows, but in any unix
> > if you are connecting php and mysql, you need something in the middle like
> > DBD::mysql
> >
> > See if this helps: http://forums.mysql.com/read.php?51,189692,189856
> >
> >
> > -Original Message-
> > From: Adam Sonzogni [mailto:asonzo...@setfocus.com]
> > Sent: Wednesday, December 23, 2009 9:52 AM
> > To: php-db@lists.php.net
> > Subject: [PHP-DB] Help for a beginner
> >
> > Hi everyone, first thank you for ALL help and the understanding that I am
> > new to PHP and MySQL. This is a long email and for that I apologize but I am
> > trying to provide as much detail as possible. If this is the wrong list to
> > ask for help, kindly direct me to the proper authority.
> >
> > I am trying to learn and I have built the following environment.
> >
> > Windows Server 2008 Standard 32bit service Pack 2 with IIS7
> > mysql-essential-5.1.41-win32
> > php-5.3.1-nts-Win32-VC9-x86.msi
> > phpMyAdmin-3.2.4-english.zip
> >
> >
> > I followed the steps as detailed below (I already had IIS7 and CGI
> > installed)
> >
> >
> > 1. Install CGI & PHP
> >   http://www.trainsignaltraining.com/iis-7-install-fastcgi-php/2008-09-04/
> >
> > 2. Install MySQL
> >   http://www.trainsignaltraining.com/install-mysql-on-iis7/2008-09-10/
> >
> > 3. Install PHPMyAdmin
> >
> > http://www.trainsignaltraining.com/install-phpmyadmin-on-iis7-and-server-2008/2008-09-16/
> >
> >
> > After I completed the installations
> > 1. If I navigate to the PHP directory and type php -info it spews a ton of
> > data at me
> >   AND
> >   I created info.php which contains: 
> >   When I browse this, it correctly produces a page with all the info about
> > my PHP server. Although I do not understand much of it I believe this
> > confirms PHP is working correctly with IIS
> >
> > 2. I open the MySQL CLI and perform the commands outlined in Step 23 at
> > this page
> >   http://www.bicubica.com/apache-php-mysql/index.php
> >   This returns the expected results, confirming MySQL is working
> >
> > 3. PHP is configured to work with php_mysql.dll as per the steps in the
> > trainsignal links above so I begin!
> > I go to the phpmyadmin page, enter root and my password and after a long
> > time I get a FastCGI error. I am not ready to believe it because, in classic
> > MS form, it has several VERY different potential causes, and I have covered
> > all of those. Plus the error code is 0x which is like saying
> > nothing... I sta

RE: [PHP-DB] RE: Help for a beginner

2009-12-23 Thread Adam Sonzogni
Chaitanya,

Apache is not an option for us, and IIS is serving PHP without issue, so I 
would prefer to resolve my connectivity issue.

Thanks,
Adam

From: Chaitanya Yanamadala [mailto:dr.virus.in...@gmail.com]
Sent: Wednesday, December 23, 2009 10:17 AM
To: Adam Sonzogni
Cc: Edward Brookhouse; php-db@lists.php.net
Subject: Re: [PHP-DB] RE: Help for a beginner

why dont u install the xampp
On Wed, Dec 23, 2009 at 8:38 PM, Adam Sonzogni 
mailto:asonzo...@setfocus.com>> wrote:
Mr. Brookhouse,

Thanks for the quick reply. I am guessing it is not relevant to my case because 
I am not using PERL. I cannot find anything that says PHP requires PERL so I 
suspect Iam ok in this regard.

Thank You,
Adam


-Original Message-
From: Edward Brookhouse 
[mailto:eb...@healthydirections.com<mailto:eb...@healthydirections.com>]
Sent: Wednesday, December 23, 2009 9:59 AM
To: Adam Sonzogni; php-db@lists.php.net<mailto:php-db@lists.php.net>
Subject: RE: Help for a beginner

Just a guess, as I have not tried a full stack in windows, but in any unix if 
you are connecting php and mysql, you need something in the middle like 
DBD::mysql

See if this helps: http://forums.mysql.com/read.php?51,189692,189856


-Original Message-
From: Adam Sonzogni 
[mailto:asonzo...@setfocus.com<mailto:asonzo...@setfocus.com>]
Sent: Wednesday, December 23, 2009 9:52 AM
To: php-db@lists.php.net<mailto:php-db@lists.php.net>
Subject: [PHP-DB] Help for a beginner

Hi everyone, first thank you for ALL help and the understanding that I am new 
to PHP and MySQL. This is a long email and for that I apologize but I am trying 
to provide as much detail as possible. If this is the wrong list to ask for 
help, kindly direct me to the proper authority.

I am trying to learn and I have built the following environment.

Windows Server 2008 Standard 32bit service Pack 2 with IIS7
mysql-essential-5.1.41-win32
php-5.3.1-nts-Win32-VC9-x86.msi
phpMyAdmin-3.2.4-english.zip


I followed the steps as detailed below (I already had IIS7 and CGI installed)


1. Install CGI & PHP
  http://www.trainsignaltraining.com/iis-7-install-fastcgi-php/2008-09-04/

2. Install MySQL
  http://www.trainsignaltraining.com/install-mysql-on-iis7/2008-09-10/

3. Install PHPMyAdmin
  
http://www.trainsignaltraining.com/install-phpmyadmin-on-iis7-and-server-2008/2008-09-16/


After I completed the installations
1. If I navigate to the PHP directory and type php -info it spews a ton of data 
at me
  AND
  I created info.php which contains: 
  When I browse this, it correctly produces a page with all the info about my 
PHP server. Although I do not understand much of it I believe this confirms PHP 
is working correctly with IIS

2. I open the MySQL CLI and perform the commands outlined in Step 23 at this 
page
  http://www.bicubica.com/apache-php-mysql/index.php
  This returns the expected results, confirming MySQL is working

3. PHP is configured to work with php_mysql.dll as per the steps in the 
trainsignal links above so I begin!
I go to the phpmyadmin page, enter root and my password and after a long time I 
get a FastCGI error. I am not ready to believe it because, in classic MS form, 
it has several VERY different potential causes, and I have covered all of 
those. Plus the error code is 0x which is like saying nothing... I 
start thinking maybe it is not connecting to the mYSQL server right, the 
instructions re: pma and the password made no sense to me so I fiddle with that 
with no change.


  I  write the mysql_test.php page in step 5 of 
http://www.bicubica.com/apache-php-mysql/index.php
  This fails with: A connection attempt failed because the connected party did 
not properly respond after a period of time, or established connection failed 
because connected host has failed to respond.

  Because the PHP failed I try with ASP...
  <%
  set conn=Server.CreateObject("ADODB.Connection")
  conn.ConnectionString="Driver={mySQL};Server=localhost;Database=test;User 
Id=root;Password=youwish"
  conn.open
  Response.write("Connected")
  conn.close
  %>

  This returns:
  Microsoft OLE DB Provider for ODBC Drivers error '80004005'
  [Microsoft][ODBC Driver Manager] Data source name not found and no 
default driver specified
  /test.asp, line 4

I believe I have established MySQL is working, but for some reason it appears 
that it cannot be "reached" This IS on the same server so firewall should not 
be an issue, PLUS I confirmed the installer did create a hole. I turn off the 
MS firewall to be safe, no change I try a "repair" of MySQL, I uninstall, 
reboot and reinstall with no change.

NOTE: at several points I have tried iisreset and/or rebooting the system with 
no change.

I start to research the matter and my mind is now unglued. I found something 
referencing using mcrypt with PHPMyAdmin to speed it up and wondered if maybe 
the long del

[PHP-DB] RE: Help for a beginner

2009-12-23 Thread Adam Sonzogni
Mr. Brookhouse,

Thanks for the quick reply. I am guessing it is not relevant to my case because 
I am not using PERL. I cannot find anything that says PHP requires PERL so I 
suspect Iam ok in this regard.

Thank You,
Adam


-Original Message-
From: Edward Brookhouse [mailto:eb...@healthydirections.com] 
Sent: Wednesday, December 23, 2009 9:59 AM
To: Adam Sonzogni; php-db@lists.php.net
Subject: RE: Help for a beginner

Just a guess, as I have not tried a full stack in windows, but in any unix if 
you are connecting php and mysql, you need something in the middle like 
DBD::mysql

See if this helps: http://forums.mysql.com/read.php?51,189692,189856


-Original Message-
From: Adam Sonzogni [mailto:asonzo...@setfocus.com] 
Sent: Wednesday, December 23, 2009 9:52 AM
To: php-db@lists.php.net
Subject: [PHP-DB] Help for a beginner

Hi everyone, first thank you for ALL help and the understanding that I am new 
to PHP and MySQL. This is a long email and for that I apologize but I am trying 
to provide as much detail as possible. If this is the wrong list to ask for 
help, kindly direct me to the proper authority.

I am trying to learn and I have built the following environment.

Windows Server 2008 Standard 32bit service Pack 2 with IIS7
mysql-essential-5.1.41-win32
php-5.3.1-nts-Win32-VC9-x86.msi
phpMyAdmin-3.2.4-english.zip


I followed the steps as detailed below (I already had IIS7 and CGI installed)


1. Install CGI & PHP
   http://www.trainsignaltraining.com/iis-7-install-fastcgi-php/2008-09-04/

2. Install MySQL
   http://www.trainsignaltraining.com/install-mysql-on-iis7/2008-09-10/
   
3. Install PHPMyAdmin
   
http://www.trainsignaltraining.com/install-phpmyadmin-on-iis7-and-server-2008/2008-09-16/


After I completed the installations
1. If I navigate to the PHP directory and type php -info it spews a ton of data 
at me
   AND
   I created info.php which contains: 
   When I browse this, it correctly produces a page with all the info about my 
PHP server. Although I do not understand much of it I believe this confirms PHP 
is working correctly with IIS

2. I open the MySQL CLI and perform the commands outlined in Step 23 at this 
page
   http://www.bicubica.com/apache-php-mysql/index.php
   This returns the expected results, confirming MySQL is working

3. PHP is configured to work with php_mysql.dll as per the steps in the 
trainsignal links above so I begin!
I go to the phpmyadmin page, enter root and my password and after a long time I 
get a FastCGI error. I am not ready to believe it because, in classic MS form, 
it has several VERY different potential causes, and I have covered all of 
those. Plus the error code is 0x which is like saying nothing... I 
start thinking maybe it is not connecting to the mYSQL server right, the 
instructions re: pma and the password made no sense to me so I fiddle with that 
with no change.


   I  write the mysql_test.php page in step 5 of 
http://www.bicubica.com/apache-php-mysql/index.php
   This fails with: A connection attempt failed because the connected party did 
not properly respond after a period of time, or established connection failed 
because connected host has failed to respond.

   Because the PHP failed I try with ASP...
   <%
   set conn=Server.CreateObject("ADODB.Connection")
   conn.ConnectionString="Driver={mySQL};Server=localhost;Database=test;User 
Id=root;Password=youwish"
   conn.open
   Response.write("Connected")
   conn.close
   %>

   This returns:
   Microsoft OLE DB Provider for ODBC Drivers error '80004005' 
   [Microsoft][ODBC Driver Manager] Data source name not found and no 
default driver specified 
   /test.asp, line 4

I believe I have established MySQL is working, but for some reason it appears 
that it cannot be "reached" This IS on the same server so firewall should not 
be an issue, PLUS I confirmed the installer did create a hole. I turn off the 
MS firewall to be safe, no change I try a "repair" of MySQL, I uninstall, 
reboot and reinstall with no change.

NOTE: at several points I have tried iisreset and/or rebooting the system with 
no change.

I start to research the matter and my mind is now unglued. I found something 
referencing using mcrypt with PHPMyAdmin to speed it up and wondered if maybe 
the long delay before the FastCGI error could be resolved so I tracked down the 
dll, put it in my ext directory and changed my php.ini to reflect this -- file 
found at http://files.edin.dk/php/win32/mcrypt/

I found quite a bit about using libmysql.dll but there was no such file in my 
install, I pulled down the .zip package and that also did not contain it, I 
eventually found it in a 5.2.x archive but that does not seem to have helped. I 
have tried enabling: only mysql, mysql AND mysqli, and only mysqli. None of 
this seems to have done anything to change my situation.

Again, I apologize for the lengthy messag

[PHP-DB] Help for a beginner

2009-12-23 Thread Adam Sonzogni
Hi everyone, first thank you for ALL help and the understanding that I am new 
to PHP and MySQL. This is a long email and for that I apologize but I am trying 
to provide as much detail as possible. If this is the wrong list to ask for 
help, kindly direct me to the proper authority.

I am trying to learn and I have built the following environment.

Windows Server 2008 Standard 32bit service Pack 2 with IIS7
mysql-essential-5.1.41-win32
php-5.3.1-nts-Win32-VC9-x86.msi
phpMyAdmin-3.2.4-english.zip


I followed the steps as detailed below (I already had IIS7 and CGI installed)


1. Install CGI & PHP
   http://www.trainsignaltraining.com/iis-7-install-fastcgi-php/2008-09-04/

2. Install MySQL
   http://www.trainsignaltraining.com/install-mysql-on-iis7/2008-09-10/
   
3. Install PHPMyAdmin
   
http://www.trainsignaltraining.com/install-phpmyadmin-on-iis7-and-server-2008/2008-09-16/


After I completed the installations
1. If I navigate to the PHP directory and type php -info it spews a ton of data 
at me
   AND
   I created info.php which contains: 
   When I browse this, it correctly produces a page with all the info about my 
PHP server. Although I do not understand much of it I believe this confirms PHP 
is working correctly with IIS

2. I open the MySQL CLI and perform the commands outlined in Step 23 at this 
page
   http://www.bicubica.com/apache-php-mysql/index.php
   This returns the expected results, confirming MySQL is working

3. PHP is configured to work with php_mysql.dll as per the steps in the 
trainsignal links above so I begin!
I go to the phpmyadmin page, enter root and my password and after a long time I 
get a FastCGI error. I am not ready to believe it because, in classic MS form, 
it has several VERY different potential causes, and I have covered all of 
those. Plus the error code is 0x which is like saying nothing... I 
start thinking maybe it is not connecting to the mYSQL server right, the 
instructions re: pma and the password made no sense to me so I fiddle with that 
with no change.


   I  write the mysql_test.php page in step 5 of 
http://www.bicubica.com/apache-php-mysql/index.php
   This fails with: A connection attempt failed because the connected party did 
not properly respond after a period of time, or established connection failed 
because connected host has failed to respond.

   Because the PHP failed I try with ASP...
   <%
   set conn=Server.CreateObject("ADODB.Connection")
   conn.ConnectionString="Driver={mySQL};Server=localhost;Database=test;User 
Id=root;Password=youwish"
   conn.open
   Response.write("Connected")
   conn.close
   %>

   This returns:
   Microsoft OLE DB Provider for ODBC Drivers error '80004005' 
   [Microsoft][ODBC Driver Manager] Data source name not found and no 
default driver specified 
   /test.asp, line 4

I believe I have established MySQL is working, but for some reason it appears 
that it cannot be "reached" This IS on the same server so firewall should not 
be an issue, PLUS I confirmed the installer did create a hole. I turn off the 
MS firewall to be safe, no change I try a "repair" of MySQL, I uninstall, 
reboot and reinstall with no change.

NOTE: at several points I have tried iisreset and/or rebooting the system with 
no change.

I start to research the matter and my mind is now unglued. I found something 
referencing using mcrypt with PHPMyAdmin to speed it up and wondered if maybe 
the long delay before the FastCGI error could be resolved so I tracked down the 
dll, put it in my ext directory and changed my php.ini to reflect this -- file 
found at http://files.edin.dk/php/win32/mcrypt/

I found quite a bit about using libmysql.dll but there was no such file in my 
install, I pulled down the .zip package and that also did not contain it, I 
eventually found it in a 5.2.x archive but that does not seem to have helped. I 
have tried enabling: only mysql, mysql AND mysqli, and only mysqli. None of 
this seems to have done anything to change my situation.

Again, I apologize for the lengthy message, I hope I have accurately described 
my issue in the right amount of detail.

Thank You!
Adam Sonzogni




   

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



RE: [PHP-DB] Retrieving Image Location in MySQL

2009-03-02 Thread Fortuno, Adam
Matya,

Ha, ha, ha! Thank you good friend. I did say I didn't try the code :-)

AF> Please note, I haven't tried this. It just seems plausible.

I apologize if I confused anyone. I just meant to show how the parameter could 
help retrieve a picture. I wasn't too concerned with the particulars. Hopefully 
the concept is sound. If not, please do flame my note so no one attempts it.

Be Well,
A-

-Original Message-
From: Mattyasovszky Janos [mailto:m...@matya.hu] 
Sent: Monday, March 02, 2009 9:29 AM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Retrieving Image Location in MySQL

Fortuno, Adam írta:

>   //Write a query to pull out the picture's path
>   $sql = "SELECT path FROM Image WHERE ID = %s";
>   mysql_real_escape_string($value);

Sorry, but this won't work, since you don't map the value of the escaped 
$value to the %s, lets say with sprintf()...

Regards,
Matya

-- 
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] Retrieving Image Location in MySQL

2009-03-02 Thread Fortuno, Adam
Sashi,

This (likely) means you have a some generic page (i.e., picture.php)
that displays some picture. The picture it displays depends on the
parameter passed when the page is called (i.e., 123).



Sashi's Test Page


", $row['firstname']);
}

//Clean up
mysql_free_result($output);

?>



Please note, I haven't tried this. It just seems plausible.

Good luck.

A-

-Original Message-
From: Sashikanth Gurram [mailto:sashi...@vt.edu] 
Sent: Sunday, March 01, 2009 10:27 PM
To: php-db@lists.php.net
Subject: [PHP-DB] Retrieving Image Location in MySQL

Dear All,

I am trying to retrieve the location of a image (not the image, just the

location of the image) stored on MySQL database, using PHP to display it

in my browser. One of the users has been kind enough to provide me with 
an example code as to how to do it. He asked me to use / /in the html code. I understood the part of 
/picture.php? /which tells us that the php code used to retrieve the 
image is located in the file picture.php (If what I have understood is 
correct). But I did not quite understand the second part /&qry=123 /. 
What does this mean? Of what use is this second part? Does the variable 
&qry has something assigned to it in the picture.php code? I would 
greatly appreciate it if any one of you can answer my questions.

Thanks,
Sashi

-- 
~
~
Sashikanth Gurram
Graduate Research Assistant
Department of Civil and Environmental Engineering
Virginia Tech
Blacksburg, VA 24060, USA


-- 
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: session variable in select query showing picture from database

2009-02-12 Thread Fortuno, Adam
Mika,

Echo out the dynamically created SQL statement ie., $query = "SELECT *
FROM MyTable WHERE ID = ${ID}"; ECHO $query;" Let us see what is
actually being passed.

P.S. I couldn't agree more with the poster that said, don't pass user
input directly to a SQL statement.

-Original Message-
From: Mika Jaaksi [mailto:mika.jaa...@gmail.com] 
Sent: Thursday, February 12, 2009 5:02 PM
To: php-db@lists.php.net
Subject: [PHP-DB] Re: session variable in select query showing picture
from database

*Answer to Rick:

in your code below it looks like you're simply hard-coding your
"$band_id" value (as "11") -- so of course it's going to work.

*Yes, I did that because one of you helpers asked me to try that.

I'll try to be clearer on whom I'm answering to...

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



RE: [PHP-DB] Re: session variable in select query showing picture from database

2009-02-12 Thread Fortuno, Adam
Mika,

Put the dollar sign (i.e., $) outside the curly brace.

$query="SELECT * FROM pic_upload WHERE band_id='${band_id}'";

A-

-Original Message-
From: Mika Jaaksi [mailto:mika.jaa...@gmail.com] 
Sent: Thursday, February 12, 2009 12:27 PM
To: php-db@lists.php.net
Subject: [PHP-DB] Re: session variable in select query showing picture
from database

Still fighting with it...

So, these work:

$query="SELECT * FROM pic_upload;
$query="SELECT * FROM pic_upload WHERE band_id=11";
picture is shown on the other page

but when adding variable into query it doesn't show the picture on the
other
page
$query="SELECT * FROM pic_upload WHERE band_id='{$band_id}'";

I'm out of ideas at the moment...

ps. forget what I said about the weird markings...


2009/2/12 Mika Jaaksi 

> I'm trying to show picture from database. Everything works until I add
> variable into where part of the query.
>
> It works with plain number. example ...WHERE id=11... ...picture is
shown
> on the page.
>
> Here's the code that retrieves the picture. show_pic.php
>
>  function db_connect($host='', $user='',
> $password='', $db='')
> {
> mysql_connect($host, $user, $password) or die('I cannot connect to db:
' .
> mysql_error());
> mysql_select_db($db);
> }
> db_connect();
> $band_id = $_SESSION['session_var'];
> $query="SELECT * FROM pic_upload WHERE band_id=$band_id";
> $result=mysql_query($query);
> while($row = mysql_fetch_array($result))
> {
> $bytes = $row['pic_content'];
> }
> header("Content-type: image/jpeg");
> print $bytes;
>
>
> exit ();
> mysql_close();
> ?>
>
>
> other page that shows the picture
>
>  echo "";
> ?>
>
> Any help would be appreciated...

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



RE: [PHP-DB] MySQL Conditional Trigger

2008-12-08 Thread Fortuno, Adam
All,

Chris makes a good point i.e., "unknown compared to anything is
unknown". His comment made me want to clarify my earlier note. In my
earlier example, I wasn't suggesting that-that logic be coded in the
database. I was assuming it would be in the page:



I tested this, and it worked. Here is why, PHP (like pretty much every
other language) silently casts a NULL to false: 

"When converting to boolean, the following values are considered FALSE:

 - the boolean FALSE itself 
 - the integer 0 (zero) 
 - the float 0.0 (zero) 
 - the empty string, and the string "0" 
 - an array with zero elements 
 - an object with zero member variables (PHP 4 only)
 - the special type NULL (including unset variables)" ("Booleans",
php.net, 05 Dec. 2008).

If you were going to code it in the database, I'd suggest something like
this:

--Using T-SQL here...
DECLARE @TestNullValue SMALLDATETIME

SET @TestNullValue = NULL

If (@TestNullValue Is Null) 
 PRINT 'Evaluates to true!';
ELSE
 PRINT 'Evaluates to false!';

In either case, this should have the same net result.

Be Well,
A-

-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 08, 2008 5:10 PM
To: OKi98
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] MySQL Conditional Trigger


> anything compared to NULL is always false

Actually it's null.

mysql> select false = null;
+--+
| false = null |
+--+
| NULL |
+--+
1 row in set (0.01 sec)

mysql> select 1 = null;
+--+
| 1 = null |
+--+
| NULL |
+--+
1 row in set (0.00 sec)

mysql> select 2 = null;
+--+
| 2 = null |
+--+
| NULL |
+--+
1 row in set (0.00 sec)


unknown compared to anything is unknown.

-- 
Postgresql & php tutorials
http://www.designmagick.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



RE: [PHP-DB] MySQL Conditional Trigger

2008-12-08 Thread Fortuno, Adam
Dee,

If all you're trying to code is that a value of NULL equates to FALSE
and a date value (whatever date value) equates to true, you can use
something like this:

If ($MyVariable) {
//... true path blah...
} else {
//... false path blah...
}

You can use this because NULL equates to false. If you prefer something
more concise, try the following:

$MyVariable ? //True : //False

I'm not a PHP guy so take this with a grain of salt. If I'm full of it,
don't hesitate to correct me.

A-

-Original Message-
From: OKi98 [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 08, 2008 4:33 PM
To: Dee Ayy
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] MySQL Conditional Trigger

 Original Message  
Subject: [PHP-DB] MySQL Conditional Trigger
From: Dee Ayy <[EMAIL PROTECTED]>
To: php-db@lists.php.net
Date: 31.10.2008 17:09
> I don't think my trigger likes a comparison with a variable which is
> NULL.  The docs seem to have a few interesting variations on playing
> with NULL and I was hoping someone would just throw me a fish so I
> don't have to try every permutation (possibly using CASE, IFNULL,
> etc.).
>
> If my ShipDate (which is a date datatype which can be NULL) changes to
> a non-null value, I want my IF statement to evaluate to TRUE.
> IF NULL changes to aDate : TRUE
> IF aDate changes to aDifferentDate : TRUE
> IF anyDate changes to NULL : FALSE
>
> In my trigger I have:
> ...
> IF OLD.ShipDate != NEW.ShipDate AND NEW.ShipDate IS NOT NULL THEN
> ...
>
> Which only works when ShipDate was not NULL to begin with.
> I suppose it evaluates the following to FALSE
> IF NULL != '2008-10-31' AND '2008-10-31' IS NOT NULL THEN
> (not liking the "NULL != '2008-10-31'" part)
>
> Please give me the correct syntax.
> TIA
>
>   
anything compared to NULL is always false
NULL = NULL (NULL included) =>  false
NULL != anything (NULL included) => false
that's why IS NULL exists

I would go this way:

IF NVL(OLD.ShipDate, -1) != NVL(NEW.ShipDate, -1) THEN




-- 
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: MS SQL error...I've come a long way to get this far

2008-12-08 Thread Fortuno, Adam
Fred,

If you're using integrated security (e.g., a domain account such as
"domain\bob"), you won't supply a password. However, the "sa" account is
a SQL login (v.s. a domain login). In that case, it would make sense
that you supply a password. See the following page for some code to
connect using integrated security:

http://msdn.microsoft.com/en-us/library/cc296205(SQL.90).aspx

See the following page for some code to connect using a SQL login:

http://msdn.microsoft.com/en-us/library/cc296182(SQL.90).aspx

If you're curious if this is even an authentication/permissions issue,
try to login using a domain login. The login event will be recorded in
the `Event Viewer`. If you're attempt isn't recorded, you've got a
communication problem with the server instance. If it is recorded,
you'll be able to tell what the problem is authenticating.

Good luck, and let us know how it turns out.

A-


-Original Message-
From: Fred Silsbee [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 08, 2008 3:30 PM
To: php-db@lists.php.net
Subject: [PHP-DB] Re: MS SQL error...I've come a long way to get this
far

I was just thinking about something I've never understood completely!

mssql_connect($server, 'sa', 'PW'); presumes the server doesn't have all
the permissions in spite of the fact that it has the password.

The password I gave is the XP Prof login PW.

Maybe some other PW. 


--- On Mon, 12/8/08, Fred Silsbee <[EMAIL PROTECTED]> wrote:

> From: Fred Silsbee <[EMAIL PROTECTED]>
> Subject: MS SQL error...I've come a long way to get this far
> To: php-db@lists.php.net
> Date: Monday, December 8, 2008, 7:13 PM
> many changes to php.ini to get this far..whew!
> 
> PHP 5.2.7 just got jerked out from underneathe me (I
> have't replaced it since this is a simple script)
> 
> phpinfo works!
> 
>  // Server in the this format:
> \ or 
> // , when using a non default
> port number
> $server = 'LANDON\SQLEXPRESS';
> 
> $link = mssql_connect($server, 'sa', 'PW');
>   < line 6
> 
> if(!$link)
> {
> die('Something went wrong while connecting to
> MSSQL');
> }
> ?>
> 
> 
> Warning: mssql_connect() [function.mssql-connect]: Unable
> to connect to server: LANDON\SQLEXPRESS in
> C:\Inetpub\wwwroot\trymssql.php on line 6
> Something went wrong while connecting to MSSQL


  


-- 
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:database tables relations advice

2008-11-27 Thread Fortuno, Adam
Mr. Froasty,

>From your note, it sounds like you want to use foreign keys; as Daniel
pointed out. I think an example would be helpful here. The subject of
foreign keys is bigger than a bread box so I'll just touch on the pieces
I think you'll find helpful. There is all sorts of literature scattered
about the web if you want to know more. Let's start with a fictional
case:

I work for a company with multiple departments each of which have one or
more employees. I would like a relational data structure to capture
departmental and employee information as well as preserve the
relationship between the two.

Make sense?

I create two tables: `Department` and `Employee`. Each table has a
primary key (as you illustrated in your example), which is unique per
record. I add a column in Employee that holds the primary key
of the employee's associated department. I then create a
relation between the two tables to indicate there is a relationship.

--Create the Department table
CREATE TABLE Department (
IDDepartment INT NOT NULL AUTO_INCREMENT, 
Name VARCHAR(35),
PRIMARY KEY (IDDepartment)
) ENGINE = InnoDB;

--Create the Employee table and simultaneously the 
--relation to Department
CREATE TABLE Employee (
IDEmployee INT NOT NULL AUTO_INCREMENT, 
idDepartment INT NOT NULL,
Name VARCHAR(35),
PRIMARY KEY (IDEmployee),
INDEX IDX_idDepartment (idDepartment),
FOREIGN KEY (idDepartment) REFERENCES Department(idDepartment) 
 ON DELETE CASCADE
 ON UPDATE CASCADE
) ENGINE = InnoDB;

MySQL can do all of this provided you're using the InnoDB storage
engine. MySQL's documentation has some helpful information on the
subject - see link below.

http://dev.mysql.com/doc/refman/5.0/en/ansi-diff-foreign-keys.html

With me so far?

A few points specific to MySQL:

(1) Whatever field you chose as your foreign key, needs an index.
(2) You can add foreign keys after a table has been created using an
ALTER statement.
(3) The option ON DELETE CASCADE means that whenever the parent record
(i.e., the department) is deleted the related employees will be deleted
too.
(4) The option ON UPDATE CASCADE means that whenver the parent's key
record (i.e., the department) is updated the related foreign key record
will be updated too.
(5) There are options other than ON UPDATE and ON DELETE. Give'm a look.

Good luck, and welcome to the DB development club.

Cheers,
Adam

-Original Message-
From: mrfroasty [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 27, 2008 5:19 AM
To: php-db@lists.php.net
Subject: [PHP-DB] re:database tables relations advice

I am quite new to database designs, I have a problem in my design...I
can actually feel it, but I am not quite sure if there is a feature in
mysql or I have to solve it with programming.

Example:
CREATE TABLE A (
user_id int(16) NOT NULL auto_increment,
..other datas
PRIMARY KEY (user_id)
   );

CREATE TABLE B (
user_id int(16) NOT NULL auto_increment,
..other datas
PRIMARY KEY (contact_id)
);

Question:
How can I declare that the user_id in my 1st table is related to user_id
in the 2nd table...actually I prefer to have it exactly the same user_id
in both tablesI think if those 2 entries are the same it will be
great, but I am not sure how to achieve this.

P:S
-Ofcourse I know that I can extract it from TABLE A and save it in TABLE
Bbut is that a way to go???Because this issue arise in couple of
tables in my data structure that I am tending to use in my
application(web).
-I also know that its possible to  make just 1 big table with lots of
columnsbut I read its not a good database design...

->>>>>please advice, running out of ideas :-(

Thanks..


-- 
Extra details:
OSS:Gentoo Linux-2.6.25-r8
profile:x86
Hardware:msi geforce 8600GT asus p5k-se
location:/home/muhsin
language(s):C/C++,VB,VHDL,bash
Typo:40WPM
url:http://mambo-tech.net


-- 
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] Unable to Login to Oracle 9i-R2 Database Using PHP 5.2.5

2008-11-26 Thread Fortuno, Adam
Chris/Rick/Neil,

I put together a test page (test.php) with content .
When the page is displayed, I don't see anything related to OCI8. To
Rick's point, the module isn't being uploaded. I believe I know why it
isn't loading. I don't believe the ISAPI PHP module is loading the right
PHP.ini (ini) file. When I run php at the CLI, it loads the ini in the
same directory as PHP's executable (c:\php\) i.e., it loads
c:\php\php.ini. 

C:\>php --ini
Configuration File (php.ini) Path: C:\WINDOWS
Loaded Configuration File: C:\PHP\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:  (none)

When I look at the php information displayed by my test page, it looks
like php is looking for an ini-file in the C:\Windows\ directory.

Configuration File (php.ini) Path -> C:\WINDOWS
Loaded Configuration File -> (none)

This gets better. When process the page on the CLI (e.g., php -f
), it processes without an issue. As stated before, it (the same
page) fails when processed thru IIS.

I need to do some more work to get this fixed, but your comments were a
big help. Thanks! 

A-

-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 24, 2008 5:54 PM
To: Fortuno, Adam
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] Unable to Login to Oracle 9i-R2 Database Using PHP
5.2.5


> Rick, when I delve into the php_info() shmaz, I see this snipet - see
> below. I'm not sure if I should be looking for something else or not.

Try doing this from a web page. Maybe it has a different php.ini or 
something.

Anything in the IIS error log (probably goes to the windows logs) ?

-- 
Postgresql & php tutorials
http://www.designmagick.com/


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



RE: [PHP-DB] Unable to Login to Oracle 9i-R2 Database Using PHP 5.2.5

2008-11-24 Thread Fortuno, Adam
Chris/Rick,

Thank you both for the notes. I sincerely appreciate the help.

Chris, I've got a "php_oci8.dll" file sitting in my extensions directory
(C:\php\ext) - see below.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=-=-=-=
 Console Output
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=-=-=-=

C:\PHP\ext>dir
Volume in drive C has no label.
Volume Serial Number is 84DF-21C4

Directory of C:\PHP\ext

11/24/2008  02:59 PM  .
11/24/2008  02:59 PM  ..
11/08/2007  11:23 PM41,019 php_crack.dll
11/08/2007  11:23 PM28,732 php_ntuser.dll
11/08/2007  11:23 PM   102,458 php_oci8.dll
  3 File(s)172,209 bytes
  2 Dir(s)  40,158,838,784 bytes free

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=-=-=-=

As best I can tell, I've correctly set my extensions directory
(C:\php\ext) and I've called the oci8 DLL correctly - see below.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=-=-=-=
 php.ini Snipet
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=-=-=-=

C:\PHP\ext>type ..\php.ini | grep -in php_oci
1293:[PHP_OCI8]
1294:extension=php_oci8.dll

C:\PHP\ext>type ..\php.ini | grep -in \\ext
536:extension_dir ="C:\PHP\ext"

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=-=-=-=

Let me know if I've mucked that up.

Rick, when I delve into the php_info() shmaz, I see this snipet - see
below. I'm not sure if I should be looking for something else or not.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=-=-=-=
 PHP information
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=-=-=-=

C:\PHP\ext>php -i

...stuff...

oci8

OCI8 Support => enabled
Version => 1.2.4
Revision => $Revision: 1.269.2.16.2.38 $
Active Persistent Connections => 0
Active Connections => 0
Temporary Lob support => enabled
Collections support => enabled

Directive => Local Value => Master Value
oci8.default_prefetch => 10 => 10
oci8.max_persistent => -1 => -1
oci8.old_oci_close_semantics => 0 => 0
oci8.persistent_timeout => -1 => -1
oci8.ping_interval => 60 => 60
oci8.privileged_connect => Off => Off
oci8.statement_cache_size => 20 => 20

...other stuff...

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=-=-=-=

If I take the page that is generating the error and move it to my Redhat
box running PHP 5.0.2, I have no problem. If I use it locally, I get the
error. 

What am I missing here?

Cheers,
A-


-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 24, 2008 4:56 PM
To: Fortuno, Adam
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] Unable to Login to Oracle 9i-R2 Database Using PHP
5.2.5


> //Return the database connection
> OCILogon($username, $passwd, $db);
> 
> I receive an error stating, "Fatal error: Call to undefined function
> OCILogon() in C:\Documents and Settings\afortuno\My
> Documents\Dev\DBAIntranet\ghr_resources\transaction_report\adam.php on
> line 7"



> The error message couldn't be more vague, and I'm not experienced
enough
> with Oracle, IIS, or PHP to know where to turn for more insight. Any
> help would be appreciated.

The error is pretty clear.

You're trying to call a function that doesn't exist.

Tracing it backwards, the php_oci.dll (or php_oci8.dll) isn't being
loaded.

Search for oci8 here: http://pecl4win.php.net/

and grab the dll file.

There are some notes 
http://www.php.net/manual/en/install.windows.extensions.php about how to

install this.

-- 
Postgresql & php tutorials
http://www.designmagick.com/


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



[PHP-DB] Unable to Login to Oracle 9i-R2 Database Using PHP 5.2.5

2008-11-24 Thread Fortuno, Adam
All:

I'm running PHP in ISAPI mode with IIS accessing (or attempting to
access) an Oracle 9i database on a RedHat box. Here are the versions of
everything:

Web Server: IIS v5.1
PHP: 5.2.5
Database: ORACLE v9i-R2

I am attempting to load a page with the following code:

//Database credentials
$username = "MyUser";
$passwd = "MyPassword";
$db="DBName";

//Return the database connection
OCILogon($username, $passwd, $db);

I receive an error stating, "Fatal error: Call to undefined function
OCILogon() in C:\Documents and Settings\afortuno\My
Documents\Dev\DBAIntranet\ghr_resources\transaction_report\adam.php on
line 7"

I'm able to use SQL Plus to login to the database I'm interested in.
This gives me the impression that my credentials are not the problem;
however, the plumbing between PHP and Oracle is the culprit. 

I initially had problems loading the OCI extension DLL. I resolved the
issue by installing the Oracle 10g instant client. Here are the steps I
followed as part of that process:

(1) Download Oracle Instant Client Package Basic (v10.2.0.4) for Win32

http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/
winsoft.html

(2) Unzip the contents downloaded zip-file.
(3) Move the folder to the "C:\Oracle" directory.
(4) Add the new folder (C:\oracle\ora102ic) to the PATH.
(5) Restart IIS (e.g., C:\> iisreset).

The error message couldn't be more vague, and I'm not experienced enough
with Oracle, IIS, or PHP to know where to turn for more insight. Any
help would be appreciated.

Cheers,
Adam


Re: [PHP-DB] SQLite security

2004-08-20 Thread Adam Q
You can use Mcrypt, OpenSSL or any other crypographic provider to 
encrypt
the information however for your application to be able to access the
information you would also have to store the encryption key, reducing 
the
protection offered.
Any PHP MySQL connection script has the DB password in it somewhere so 
this is not an issue I think.
phpMyAdmin allows you to put the password into a config file...
But you can't download a MySQL database by typing in a URL.

I think encryption for SQLite is essential for PHP. It makes it almost 
useless in a webscripting language.
Suppose you wanted to create an open source, easily portable, file 
based guestbook in PHP. I would never use SQLLite under the current 
circumstances... Although I would love to. It seems like the perfect 
solution.

But the database needs a password otherwise it is just too much of 
a security risk.

SQLite is intended for applications that need a database but don't 
need a
full fledged solution such as PostgreSQL
I can't think of one (1) web based application where I would recommend 
SQLite - if I can't specify a password for access.
Maybe for PHP-GTK, but that is not web based (and PHP is used a great 
deal for web scripting).

Remember regardless of the database you use if you are using a shared
hosting provider it is possible othere hosting clients will be able to
access your database regardless of the engine you use.
Shared hosting vulnerabilities have nothing to do with SQLite security.
phpMyAdmin seems to be a popular choice for MySQL admin and I reckon 
there must be a few people who use it in shared hosting situations.

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


[PHP-DB] SQLite security

2004-08-16 Thread Adam Q
I would like to use an SQLite DB for the prefs for an open source PHP 
project, but I can't find any way to be sure the DB file is going to be 
secure... Is it possible to encrypt a SQLite DB file?

With the current setup, if I include a .htaccess for the DB dir, this 
will only work for Apache - not IIS.
I know I can include a warning about how important it is to place the 
files outside the HTTP directory tree and .htaccess files are good, but 
it is just too easy to download an SQLite DB... I can't really see any 
PHP use that would be OK for this really.
if I put the db file "SQLITE.DB" into /www/db
Anybody can d/l it by typing
http://myserver.com/db/SQLITE.DB

I though I might even be able to prevent d/l by naming the DB file with 
a "." at the start but it makes do difference.

... and if the project is open source it is just too much of a security 
risk as everybody knows where the file is going to be on a default 
installation.

Otherwise I'm stuck with the standard PHP prefs file "confing.inc.php" 
(- which is safe from prying eyes):

if (defined("correct_entry_point")) {
my_pref[1] = "lots of good stuff";
}
?>

But updating this on pref changes is no fun compared to SQLite

Please somebody tell me I'm wrong,
Cheers,
Adam
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] oracle error ORA-12154

2004-07-16 Thread Adam Williams
yeah I got it to work, i had to do putenv() with my oracle home dir and 
then my scripts started working.  thanks

Peter Beckman wrote:
The biggest problem with oci8 is having these four variables set:
$ORACLE_SID=SOMESID
$ORACLE_HOME=/home/beckman/oracle
$ORACLE_BASE=/home/beckman/oracle
$TNS_ADMIN=/home/beckman/oracle/network/admin
If those aren't set, then things won't work.
Please confirm that those environment variables are set in Apache or
whatever web server you are using.  If they aren't, oci8 won't work.
Beckman
On Fri, 16 Jul 2004, Adam Williams wrote:
 

Hi, I'm trying to connect to an oracle 9.20 database using:
$conn = OCILOGON("dah50","dah50","zed2.aleph0");
but I get the error ORA-12154
Searching on google says my listener.ora or tnsnames.ora may have
problems, but I think mine are correct.  Can someone take a look and see
if they are ok?  Also, I can connect to the database from the command
line:
ORACLE>>sqlplus dah50/[EMAIL PROTECTED]
SQL*Plus: Release 9.2.0.3.0 - Production on Fri Jul 16 11:58:49 2004
Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.3.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.3.0 - Production
so I'm not really sure what is going on.  below are my tnsnames.ora and
listener.ora:
tnsnames.ora

zed2.aleph0=(description=
   (address=
   (protocol=ipc)
   (key=aleph0))
   (address=
   (protocol=tcp)
   (host=zed2.mdah.state.ms.us)
   (port=1521))
   (connect_data=(service_name=aleph0)(server=DEDICATED)))

listener.ora

listener=(description=
   (address_list=
   (address =
   (protocol = ipc)
   (key = extproc))
   (address=
   (protocol=ipc)
   (key=aleph0))
   (address=
   (protocol=tcp)
   (host=zed2.mdah.state.ms.us)
   (port=1521))
   )
  )
sid_list_listener=(sid_list=
   (sid_desc=
   (global_name=aleph0)
   (sid_name=aleph0)
   (oracle_home=/exlibris/app/oracle/product/920)
   )
   (sid_desc =
   (sid_name = extproc)
   (oracle_home=/exlibris/app/oracle/product/920)
   (program = extproc)
   )
 )
startup_wait_time_listener=0
connect_timeout_listener=20
trace_level_listener=off

and when I start the listener I get no errors.
ORACLE>>lsnrctl stop ; lsnrctl start
LSNRCTL for Linux: Version 9.2.0.3.0 - Production on 16-JUL-2004 12:07:11
Copyright (c) 1991, 2002, Oracle Corporation.  All rights reserved.
Connecting to (DESCRIPTION=(address=(protocol=ipc)(key=extproc)))
The command completed successfully
LSNRCTL for Linux: Version 9.2.0.3.0 - Production on 16-JUL-2004 12:07:11
Copyright (c) 1991, 2002, Oracle Corporation.  All rights reserved.
Starting /exlibris/app/oracle/product/920/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 9.2.0.3.0 - Production
System parameter file is
/exlibris/app/oracle/product/920/network/admin/listener.ora
Log messages written to
/exlibris/app/oracle/product/920/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=aleph0)))
Listening on:
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=zed2.mdah.state.ms.us)(PORT=1521)))
Connecting to (DESCRIPTION=(address=(protocol=ipc)(key=extproc)))
STATUS of the LISTENER

Alias LISTENER
Version   TNSLSNR for Linux: Version 9.2.0.3.0 -
Production
Start Date16-JUL-2004 12:07:11
Uptime0 days 0 hr. 0 min. 0 sec
Trace Level   off
Security  OFF
SNMP  OFF
Listener Parameter File
/exlibris/app/oracle/product/920/network/admin/listener.ora
Listener Log File
/exlibris/app/oracle/product/920/network/log/listener.log
Listening Endpoints Summary...
 (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))
 (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=aleph0)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=zed2.mdah.state.ms.us)(PORT=1521)))
Services Summary...
Service "aleph0" has 1 instance(s).
 Instance "aleph0", status UNKNOWN, has 1 handler(s) for this service...
Service "extproc" has 1 instance(s).
 Instance "extproc", status UNKNOWN, has 1 handler(s) for this

[PHP-DB] oracle error ORA-12154

2004-07-16 Thread Adam Williams
Hi, I'm trying to connect to an oracle 9.20 database using:

$conn = OCILOGON("dah50","dah50","zed2.aleph0");

but I get the error ORA-12154

Searching on google says my listener.ora or tnsnames.ora may have 
problems, but I think mine are correct.  Can someone take a look and see 
if they are ok?  Also, I can connect to the database from the command 
line:

ORACLE>>sqlplus dah50/[EMAIL PROTECTED]

SQL*Plus: Release 9.2.0.3.0 - Production on Fri Jul 16 11:58:49 2004

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.3.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.3.0 - Production


so I'm not really sure what is going on.  below are my tnsnames.ora and 
listener.ora:


tnsnames.ora


zed2.aleph0=(description=
(address=
(protocol=ipc)
(key=aleph0))
(address=
(protocol=tcp)
(host=zed2.mdah.state.ms.us)
(port=1521))
(connect_data=(service_name=aleph0)(server=DEDICATED)))



listener.ora


listener=(description=
(address_list=
(address =
(protocol = ipc)
(key = extproc))
(address=
(protocol=ipc)
(key=aleph0))
(address=
(protocol=tcp)
(host=zed2.mdah.state.ms.us)
(port=1521))
)
   )

sid_list_listener=(sid_list=
(sid_desc=
(global_name=aleph0)
(sid_name=aleph0)
(oracle_home=/exlibris/app/oracle/product/920)
)
(sid_desc =
(sid_name = extproc)
(oracle_home=/exlibris/app/oracle/product/920)
(program = extproc)
)
  )
startup_wait_time_listener=0
connect_timeout_listener=20
trace_level_listener=off




and when I start the listener I get no errors.

ORACLE>>lsnrctl stop ; lsnrctl start

LSNRCTL for Linux: Version 9.2.0.3.0 - Production on 16-JUL-2004 12:07:11

Copyright (c) 1991, 2002, Oracle Corporation.  All rights reserved.

Connecting to (DESCRIPTION=(address=(protocol=ipc)(key=extproc)))
The command completed successfully

LSNRCTL for Linux: Version 9.2.0.3.0 - Production on 16-JUL-2004 12:07:11

Copyright (c) 1991, 2002, Oracle Corporation.  All rights reserved.

Starting /exlibris/app/oracle/product/920/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 9.2.0.3.0 - Production
System parameter file is 
/exlibris/app/oracle/product/920/network/admin/listener.ora
Log messages written to 
/exlibris/app/oracle/product/920/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=aleph0)))
Listening on: 
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=zed2.mdah.state.ms.us)(PORT=1521)))

Connecting to (DESCRIPTION=(address=(protocol=ipc)(key=extproc)))
STATUS of the LISTENER

Alias LISTENER
Version   TNSLSNR for Linux: Version 9.2.0.3.0 - 
Production
Start Date16-JUL-2004 12:07:11
Uptime0 days 0 hr. 0 min. 0 sec
Trace Level   off
Security  OFF
SNMP  OFF
Listener Parameter File   
/exlibris/app/oracle/product/920/network/admin/listener.ora
Listener Log File 
/exlibris/app/oracle/product/920/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=aleph0)))
  
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=zed2.mdah.state.ms.us)(PORT=1521)))
Services Summary...
Service "aleph0" has 1 instance(s).
  Instance "aleph0", status UNKNOWN, has 1 handler(s) for this service...
Service "extproc" has 1 instance(s).
  Instance "extproc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

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



[PHP-DB] Need some HELP (not works)

2004-05-10 Thread Adam Farid
Thanks.

I tried your suggestion, but  the values still did not displayed in second 
page.
nothing printed out.

I put my files in db-list (Need some HELP).

regards
Adam
_
Stay in touch with absent friends - get MSN Messenger 
http://www.msn.co.uk/messenger

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


[PHP-DB] Need some HELP (not works)

2004-05-10 Thread Adam Farid
Thanks pepole.

I've tried but still does not work.

when I put the varaibles name between ' '

I found this error:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or 
`T_NUM_STRING'.

I typed in this way

 print ""; 

but nothing  a new.

I have checked  "register_globals" is on.
in my first page I used session_start(); and   global $HTTP_SESSION_VARS;
I dont know if this cause the problem that I had.
Thanks again and more help please.
Adam
_
Use MSN Messenger to send music and pics to your friends 
http://www.msn.co.uk/messenger

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


[PHP-DB] Need some HELP

2004-05-10 Thread Adam Farid
Hi,

I am  a new to php. I am using php ver 4.0.3 and MySQL.

I have wrote two files and I'd like to pass some varaibles from first file 
to use them in the second file.
but  the values did not displayed in the second file(nothing print out). and 
also I want to pass them to anothr file ...  here is what I've wrote :

 file1.php**

print "";
	print "";
   print "\n";
   print "";
   print "";
  	print "";
   print "";

?>

** second file file2.php 



";
print "";
print "";
?>
   Name:
   User Number: 
   Address: 
...



..

Kind Regrads
Adam
I hope someone  can help me. Thanks
_
Stay in touch with absent friends - get MSN Messenger 
http://www.msn.co.uk/messenger

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


Re: [PHP-DB] logic problem

2004-04-21 Thread Adam Williams
Still doesn't work the way I want it.  My boss is taking a look at it, she 
knows SQL really well, I was trying to do this without her assistance, but 
its just harder then I was expecting.  thanks for the help tho

On Wed, 21 Apr 2004, Daniel Clark wrote:

> How about
> 
> SELECT distinct badge.id, convert( varchar,eventime,110) as date
> 
> Shows all the badge numbers IN on that date.   If the badge number is not
> there, they didn't check in at ALL that day.
> 
> 
> > This seems too easy to not be able to do it with SQL. There must be
> > something we're missing in the query.
> > Try this:
> >
> > select distinct badge.id,convert( varchar,eventime,110) as date,count(*)
> > from events, badge where
> > events.cardnum = badge.id and devid = '1' and
> > convert( varchar, events.eventime, 110) BETWEEN '$startdate' and
> > 'enddate'
> > and type = '1'
> > group by date
> >
> > In MySQL you don't need to specify a field for count(). And you should
> > have to convert the eventime field twice, you should be able to
> > reference the calc field in the group by.
> >
> > On Apr 21, 2004, at 2:19 PM, Adam Williams wrote:
> >
> >> Yeah I basically had that with my previous SQL statement, I was
> >> grouping
> >> by event.cardnum instead of counting the cardnums by date.  I think
> >> what
> >> I'm trying to do is beyond the scope of SQL and I'll have to write some
> >> PHP to take the SQL statement results and feed them into an array and
> >> count the distinct cardnums for each date and then spit it all into an
> >> html table.  thanks
> >>
> >> On Wed, 21 Apr 2004, Daniel
> >> Clark wrote:
> >>
> >>> AND: any count >=1 shows they came in that day.
> >>>
> >>> How about:
> >>>
> >>> SELECT convert( varchar,eventime,110) as date from events, badge,
> >>>count(convert( varchar,eventime, 110)) as count
> >>> WHERE events.cardnum = badge.id and devid = '1' and
> >>>convert( varchar, events.eventime, 110) BETWEEN '$startdate' and
> >>> 'enddate'
> >>> AND type = '1'
> >>> GROUP BY convert( varchar,events.eventime, 110), badge
> >>>
> >>>
> >>>> I'm using some proprietary software/hardware where when a visitor
> >>>> swipes
> >>>> their entry card, it is recorded in a mssql 2000 server.  My boss
> >>>> wants a
> >>>> count of unique vistors for a range of dates.  So, I need to have it
> >>>> give
> >>>> a count of unique vistors, meaning that I need to count all vists
> >>>> for a
> >>>> day as one visit (because if they go outside to smoke and come back
> >>>> and
> >>>> swipe their card again to get in, each one is a separate visit, but
> >>>> i need
> >>>> to count all visits by each person as one visit since i just want to
> >>>> know
> >>>> if they came at all each day, not how many times they came in).
> >>>>
> >>>> This is my SQL statement:
> >>>>
> >>>> select distinct count(convert( varchar,eventime, 110)) as count,
> >>>> convert( varchar,eventime,110) as date from events, badge wher
> >>>> events.cardnum = badge.id and devid = '1' and
> >>>> convert( varchar, events.eventime, 110) BETWEEN '$startdate' and
> >>>> 'enddate'
> >>>> and type = '1' group by convert( varchar,events.eventime, 110)
> >>>>
> >>>> for reference, devid = '1' is the hardware device, where everytime it
> >>>> triggers, it means someone swiped their card to get in, and type =
> >>>> '1'
> >>>> means patron (because we have a type = 2 that is for staff and we
> >>>> jsut
> >>>> want to know how many patrons visited)
> >>>>
> >>>> When I execute this statement, its returning the result for each
> >>>> date of
> >>>> the total number of card swipes (so if a person comes in twice on a
> >>>> date,
> >>>> its recording it as 2 swipes, but I just need to know that they came
> >>>> to
> >>>> the building at all on this date, so I just need it to register that
> >>>> there
> >>>> was a count of atleast one for this card that was swiped)
> >>>>
> >>>> any suggestions?  thanks
> 
> 

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



Re: [PHP-DB] logic problem

2004-04-21 Thread Adam Williams
Re-read my original email, I'm using mssql and not mysql.  I'm sort 
of close to having it working with the sql statement i posted earlier and 
using PHP to figure out if the date has changed or not and to count the 
cardnum if the date hasn't changed.  I'm getting a number that is 
different then the total number multiple visits by patrons, haven't 
checked with the registration person if the # I am getting is right or 
not, because for some of the very early dates when we were testing the 
equipment, it returns a count of 0 visits by type 1 card users, even 
though they have a count of 15 multiple entries that day, so something 
weird is still going on.  i think i'm going to have to end up using a 
multidimensional array and having PHP loop through it or something...

On Wed, 21 Apr 2004, Brent Baisley wrote:

> This seems too easy to not be able to do it with SQL. There must be 
> something we're missing in the query.
> Try this:
> 
> select distinct badge.id,convert( varchar,eventime,110) as date,count(*)
> from events, badge where
> events.cardnum = badge.id and devid = '1' and
> convert( varchar, events.eventime, 110) BETWEEN '$startdate' and 
> 'enddate'
> and type = '1'
> group by date
> 
> In MySQL you don't need to specify a field for count(). And you should 
> have to convert the eventime field twice, you should be able to 
> reference the calc field in the group by.
> 
> On Apr 21, 2004, at 2:19 PM, Adam Williams wrote:
> 
> > Yeah I basically had that with my previous SQL statement, I was 
> > grouping
> > by event.cardnum instead of counting the cardnums by date.  I think 
> > what
> > I'm trying to do is beyond the scope of SQL and I'll have to write some
> > PHP to take the SQL statement results and feed them into an array and
> > count the distinct cardnums for each date and then spit it all into an
> > html table.  thanks
> >
> > On Wed, 21 Apr 2004, Daniel
> > Clark wrote:
> >
> >> AND: any count >=1 shows they came in that day.
> >>
> >> How about:
> >>
> >> SELECT convert( varchar,eventime,110) as date from events, badge,
> >>count(convert( varchar,eventime, 110)) as count
> >> WHERE events.cardnum = badge.id and devid = '1' and
> >>convert( varchar, events.eventime, 110) BETWEEN '$startdate' and 
> >> 'enddate'
> >> AND type = '1'
> >> GROUP BY convert( varchar,events.eventime, 110), badge
> >>
> >>
> >>> I'm using some proprietary software/hardware where when a visitor 
> >>> swipes
> >>> their entry card, it is recorded in a mssql 2000 server.  My boss 
> >>> wants a
> >>> count of unique vistors for a range of dates.  So, I need to have it 
> >>> give
> >>> a count of unique vistors, meaning that I need to count all vists 
> >>> for a
> >>> day as one visit (because if they go outside to smoke and come back 
> >>> and
> >>> swipe their card again to get in, each one is a separate visit, but 
> >>> i need
> >>> to count all visits by each person as one visit since i just want to 
> >>> know
> >>> if they came at all each day, not how many times they came in).
> >>>
> >>> This is my SQL statement:
> >>>
> >>> select distinct count(convert( varchar,eventime, 110)) as count,
> >>> convert( varchar,eventime,110) as date from events, badge wher
> >>> events.cardnum = badge.id and devid = '1' and
> >>> convert( varchar, events.eventime, 110) BETWEEN '$startdate' and 
> >>> 'enddate'
> >>> and type = '1' group by convert( varchar,events.eventime, 110)
> >>>
> >>> for reference, devid = '1' is the hardware device, where everytime it
> >>> triggers, it means someone swiped their card to get in, and type = 
> >>> '1'
> >>> means patron (because we have a type = 2 that is for staff and we 
> >>> jsut
> >>> want to know how many patrons visited)
> >>>
> >>> When I execute this statement, its returning the result for each 
> >>> date of
> >>> the total number of card swipes (so if a person comes in twice on a 
> >>> date,
> >>> its recording it as 2 swipes, but I just need to know that they came 
> >>> to
> >>> the building at all on this date, so I just need it to register that 
> >>> there
> >>> was a count of atleast one for this card that was swiped)
> >>>
> >>> any suggestions?  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
> >
> >
> 

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



Re: [PHP-DB] logic problem

2004-04-21 Thread Adam Williams
Yeah I basically had that with my previous SQL statement, I was grouping 
by event.cardnum instead of counting the cardnums by date.  I think what 
I'm trying to do is beyond the scope of SQL and I'll have to write some 
PHP to take the SQL statement results and feed them into an array and 
count the distinct cardnums for each date and then spit it all into an 
html table.  thanks

On Wed, 21 Apr 2004, Daniel 
Clark wrote:

> AND: any count >=1 shows they came in that day.
> 
> How about:
> 
> SELECT convert( varchar,eventime,110) as date from events, badge,
>count(convert( varchar,eventime, 110)) as count
> WHERE events.cardnum = badge.id and devid = '1' and
>convert( varchar, events.eventime, 110) BETWEEN '$startdate' and 'enddate'
> AND type = '1'
> GROUP BY convert( varchar,events.eventime, 110), badge
> 
> 
> > I'm using some proprietary software/hardware where when a visitor swipes
> > their entry card, it is recorded in a mssql 2000 server.  My boss wants a
> > count of unique vistors for a range of dates.  So, I need to have it give
> > a count of unique vistors, meaning that I need to count all vists for a
> > day as one visit (because if they go outside to smoke and come back and
> > swipe their card again to get in, each one is a separate visit, but i need
> > to count all visits by each person as one visit since i just want to know
> > if they came at all each day, not how many times they came in).
> >
> > This is my SQL statement:
> >
> > select distinct count(convert( varchar,eventime, 110)) as count,
> > convert( varchar,eventime,110) as date from events, badge wher
> > events.cardnum = badge.id and devid = '1' and
> > convert( varchar, events.eventime, 110) BETWEEN '$startdate' and 'enddate'
> > and type = '1' group by convert( varchar,events.eventime, 110)
> >
> > for reference, devid = '1' is the hardware device, where everytime it
> > triggers, it means someone swiped their card to get in, and type = '1'
> > means patron (because we have a type = 2 that is for staff and we jsut
> > want to know how many patrons visited)
> >
> > When I execute this statement, its returning the result for each date of
> > the total number of card swipes (so if a person comes in twice on a date,
> > its recording it as 2 swipes, but I just need to know that they came to
> > the building at all on this date, so I just need it to register that there
> > was a count of atleast one for this card that was swiped)
> >
> > any suggestions?  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] logic problem

2004-04-21 Thread Adam Williams
Yes eventtime is a timestamp field (whatever mssql's version of mysql's 
NOW() is) and the convert( varchar,eventime,110) converts the timestamp to 
a date MM-DD-.

my problem is that with the count, it counts each card swipe, and i only 
need to count one card swipe from each patron per day.  so if they swipe 
their card multiple times, in my php script when i return the results, it 
only returns one visit for each patron each day even if they have visited 
two or more times.

On Wed, 21 Apr 2004, Brent Baisley wrote:

> I think your problem is that you are using time, when you are not 
> interested in time, just the date. I'm assuming your eventime column is 
> a timestamp field. Your goal is to select the badge id and the date, 
> distinct will then eliminate multiple visits and then you can group by 
> date to get the visitor count. The way I see it, the hardest part is 
> converting the eventime to a date or some unique string to represent 
> the date.
> 
> 
> On Apr 21, 2004, at 1:13 PM, Adam Williams wrote:
> 
> > I'm using some proprietary software/hardware where when a visitor 
> > swipes
> > their entry card, it is recorded in a mssql 2000 server.  My boss 
> > wants a
> > count of unique vistors for a range of dates.  So, I need to have it 
> > give
> > a count of unique vistors, meaning that I need to count all vists for a
> > day as one visit (because if they go outside to smoke and come back and
> > swipe their card again to get in, each one is a separate visit, but i 
> > need
> > to count all visits by each person as one visit since i just want to 
> > know
> > if they came at all each day, not how many times they came in).
> >
> > This is my SQL statement:
> >
> > select distinct count(convert( varchar,eventime, 110)) as count,
> > convert( varchar,eventime,110) as date from events, badge wher
> > events.cardnum = badge.id and devid = '1' and
> > convert( varchar, events.eventime, 110) BETWEEN '$startdate' and 
> > 'enddate'
> > and type = '1' group by convert( varchar,events.eventime, 110)
> >
> > for reference, devid = '1' is the hardware device, where everytime it
> > triggers, it means someone swiped their card to get in, and type = '1'
> > means patron (because we have a type = 2 that is for staff and we jsut
> > want to know how many patrons visited)
> >
> > When I execute this statement, its returning the result for each date 
> > of
> > the total number of card swipes (so if a person comes in twice on a 
> > date,
> > its recording it as 2 swipes, but I just need to know that they came to
> > the building at all on this date, so I just need it to register that 
> > there
> > was a count of atleast one for this card that was swiped)
> >
> > any suggestions?  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



[PHP-DB] logic problem

2004-04-21 Thread Adam Williams
I'm using some proprietary software/hardware where when a visitor swipes 
their entry card, it is recorded in a mssql 2000 server.  My boss wants a 
count of unique vistors for a range of dates.  So, I need to have it give 
a count of unique vistors, meaning that I need to count all vists for a 
day as one visit (because if they go outside to smoke and come back and 
swipe their card again to get in, each one is a separate visit, but i need 
to count all visits by each person as one visit since i just want to know 
if they came at all each day, not how many times they came in).

This is my SQL statement:

select distinct count(convert( varchar,eventime, 110)) as count, 
convert( varchar,eventime,110) as date from events, badge wher 
events.cardnum = badge.id and devid = '1' and 
convert( varchar, events.eventime, 110) BETWEEN '$startdate' and 'enddate'
and type = '1' group by convert( varchar,events.eventime, 110)

for reference, devid = '1' is the hardware device, where everytime it 
triggers, it means someone swiped their card to get in, and type = '1' 
means patron (because we have a type = 2 that is for staff and we jsut 
want to know how many patrons visited)

When I execute this statement, its returning the result for each date of 
the total number of card swipes (so if a person comes in twice on a date, 
its recording it as 2 swipes, but I just need to know that they came to 
the building at all on this date, so I just need it to register that there 
was a count of atleast one for this card that was swiped)

any suggestions?  thanks

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



[PHP-DB] postgresql

2004-04-14 Thread Adam Williams
Hi, I know this isn't PHP related but I have a quick question about 
postgresql.  I come from a mysql enviroment so I'm a little clueless, even 
after reading the postgresql docs.  

I am moving a postgresql database from one server to another.  As the user 
that owns the database, lculber, I ran pg_dump sroom1 > sroom1.database 
but on the server I'm moving the database to, I can't figure out how to 
get into psql to create the user lculber so I can do psql sroom1 < 
sroom1.database

so how can I create the users lculber in postgresql.  I can't even connect 
to psql.  any advice? :)  below is my command.  I'm not trying to database 
root, I just want to get the psql prompt so I can create the user lculber.

[EMAIL PROTECTED] root]# psql -U root
psql: FATAL:  Database "root" does not exist in the system catalog.
[EMAIL PROTECTED] root]# createuser lculber
Shall the new user be allowed to create databases? (y/n) y
Shall the new user be allowed to create more new users? (y/n) y
psql: FATAL:  user "root" does not exist
createuser: creation of user "lculber" failed

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



[PHP-DB] ocilogon error

2004-03-31 Thread Adam Williams
Hi, I have oracle and PHP working together on a remote server called zed 
that runs redhat linux. I have another computer called accessserver 
that runs win2k pro with PHP that I am trying to connect to oracle on 
zed.  Both computers have the oracle client libraries installed.  On 
accessserver I have the code:



When I run this I get the error:

Warning: ocilogon(): OCISessionBegin: ORA-12705: invalid or unknown NLS 
parameter value specified in C:\htdocs\oracleconnect.php on line 2

I've tried looking on google for the NLS parameter but I'm not having much 
luck.  Anyone able to help?  Thanks!

-- 
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 Adam Voigt
You might want to use iframe's so you can refresh just individual
sections when you need to.


On Fri, 2004-03-19 at 12:00, [EMAIL PROTECTED] wrote:
> 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
-- 

Adam Voigt
[EMAIL PROTECTED]

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



Re: [PHP-DB] MySQL - separating web and database servers

2004-03-18 Thread Adam Voigt
I don't understand, your ready to hack the MySQL extension, rather then
just use one of the free text editors, that let you mass replace all
your pages at once (which takes roughly 10 seconds)?


On Thu, 2004-03-18 at 10:15, Operator wrote:
> Probably I need to change this behaviour in 
> ext/mysql/libmysql/libmysql.c for my installation, but this is 
> my last hope (mostly because I'm not a C programist...) If some 
> of you could tell me if it's possible without breaking 
> something else, or point me to the lines that do the job... I 
> suppose the change needed would be quite simple.
> 
> PB
-- 

Adam Voigt
[EMAIL PROTECTED]

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



Re: [PHP-DB] MySql query

2004-03-17 Thread Adam Voigt
Yes, where evaluates to true.


On Wed, 2004-03-17 at 12:03, Matt Matijevich wrote:
> This is probably a question for for a mysql list but I figured someone
> out here knows the answer.
> 
> I am working with an existing mysql application and there is a bunch of
> queries that are formatted something like this:
> 
> SELECT * FROM sometable WHERE 1
> 
> does "WHERE 1" just return every row?
> 
> thanks in advance.
-- 

Adam Voigt
[EMAIL PROTECTED]

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



Re: [PHP-DB] PHP - MSSQL - LINUX

2004-03-17 Thread Adam Voigt
No, if you are attempting to run PHP under Windows, you want the MSSQL
DLL File, if you are attempting to run PHP under Linux or Unix, you want
to install FreeTDS from www.freetds.org


On Wed, 2004-03-17 at 05:17, Santhosh Kumar wrote:
> Hi Madhu,
>  I am speaking about MSSQL not MySQL . 
> Is it possible can i get for MSSQL.so from MYSQL Installation.
> 
> Thanks and Regards,
> Santhosh Kumar.M
> 
> 
> - Original Message - 
>   From: Madhu Manjari 
>   To: [EMAIL PROTECTED] 
>   Sent: Wednesday, March 17, 2004 2:27 PM
>   Subject: Re: [PHP-DB] PHP - MSSQL - LINUX
> 
> 
>   Hi Santosh Try to install mysql-3..22 source where you will get all libraries 
> by default . After installation of mysql configure php support with mysql. Madhu. > 
> Hi All, > > Where do I get mssql.so to connect mssql with my PHP4.0.6 and PHP4.3.3 > 
> > Regards, > Santos Kumar.M 
>   --
>   This Message and any attachments is intended solely for the addresses and is 
> confidential.
>   If you receive this message in error or if you are not the intended recipient, 
> please delete the mail.
>   Any use not in accord with its purpose, any dissemination or disclosure, either 
> whole or partial, is prohibited.
>   Please inform us in case of erroneous delivery, thanks for your cooperation.
-- 

Adam Voigt
[EMAIL PROTECTED]

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



Re: [PHP-DB] mssql query

2004-03-16 Thread Adam Voigt
SELECT count(id) FROM users WHERE DATEDIFF(eventtime,GETDATE(),d) == 1;

Or something along those lines, all the date functions are very well
documented in the "digital books" that come with Enterprise Manager.
Open up the reference, and search for datediff, and there should be a
link in there for the date functions as a whole.


On Tue, 2004-03-16 at 10:32, Adam Williams wrote:
> I've used mysql a little, but now I'm working with a MS SQL SERVER 2000 
> database.  We have a proprietary application/hardware setup where 
> when a person enters the building, the time they enter the building 
> is automatically put into the database in a field called eventtime, and 
> their access card is entered in a field called cardnum.  The 
> time entered is like the mysql NOW() function (i dunno what its called in 
> mssql), the format is -MM-DD HH:MM:SS.000 anyway.  I need to write an 
> SQL query that will get a unique count of cardnum based on how many times 
> the person enters a building each day.  So I need to do some sort of 
> UNIQUE (although in mssql I think its distinct) count on the -MM-DD 
> and ignore the HH:MM:SS.000, but looking at the mssql reference book I 
> have, it doesn't go into great detail on date functions, so I was 
> wondering if anyone knows how to do a unique on the eventtime with 
> the date and ignore the time.
-- 

Adam Voigt
[EMAIL PROTECTED]

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



[PHP-DB] mssql query

2004-03-16 Thread Adam Williams
I've used mysql a little, but now I'm working with a MS SQL SERVER 2000 
database.  We have a proprietary application/hardware setup where 
when a person enters the building, the time they enter the building 
is automatically put into the database in a field called eventtime, and 
their access card is entered in a field called cardnum.  The 
time entered is like the mysql NOW() function (i dunno what its called in 
mssql), the format is -MM-DD HH:MM:SS.000 anyway.  I need to write an 
SQL query that will get a unique count of cardnum based on how many times 
the person enters a building each day.  So I need to do some sort of 
UNIQUE (although in mssql I think its distinct) count on the -MM-DD 
and ignore the HH:MM:SS.000, but looking at the mssql reference book I 
have, it doesn't go into great detail on date functions, so I was 
wondering if anyone knows how to do a unique on the eventtime with 
the date and ignore the time.

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



RE: [PHP-DB] PHP -> MSSQL connects, but can't query

2004-03-15 Thread Adam Voigt
Yes, I'm connecting to a MSSQL server from FreeTDS, and it works fine.
Try using the IP of the MSSQL server instead of the name, and see if
that makes any difference.


On Mon, 2004-03-15 at 09:23, Jason Morrill wrote:
> I changed the mssql_select_db line as suggested by another person here
> but it didn't change a thing. I still get the exact same error message.
> 
> Is there anyone else here connecting to a MS SQL server using TDS v8.0
> ??
> 
> Thanks!
>  Jason
> 
> 
> -Original Message-
> From: Jason Morrill [mailto:[EMAIL PROTECTED] 
> Sent: Friday, March 12, 2004 8:36 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] PHP -> MSSQL connects, but can't query
> 
> 
> I've got a very simple PHP script for testing my MS SQL Server
> connection. I've installed FreeTDS and I can connect and query the
> database with TSQL.
> 
> With PHP I can connect and disconnect properly but I can't query or
> attach to different databases. Here is my sample PHP followed by what
> the web server throws back at me:
> 
> sql-test.php
> 
> 
> 
> 
>  $dbproc = mssql_connect("roger","sa","admin");
> #$dbproc = sybase_connect("roger","sa","admin");
> if (! $dbproc) {
> print "Can't connect to server";
> return;
> }
> print "Connected to server.";
> 
> $dbconnect = mssql_select_db("Northwind");
> if (! $dbconnect) {
> print "Can't connect to Northwind";
> return;
> }
> print "Connected to database";
> 
> #$res = sybase_query("select * from test",$dbproc);
> #if (! $res) {
> #   return;
> #}
> #while ($arr = sybase_fetch_array($res)) {
> #   print $arr["i"] . " " . $arr["v"] . "\n";
> #}
> 
> if (! mssql_close($dbproc)) {
> print "Can't close server connection";
> return;
> }
> print "Connection closed.";
> ?>
> 
> 
> 
> 
> 
> Output in browser when referencing the sql-test.php file:
> -
> 
> Connected to server.
> Warning: Sybase: Server message: Line 1: Incorrect syntax near 'e'.
> (severity 15, procedure N/A) in /home/www/sql-test.php on line 12 Can't
> connect to Northwind
> 
> 
> 
> Can anyone help me figure this one out?!
> 
> Thanks!
>  Jason Morrill
>  IT Manager
>  Child & Family Agency SE Connecticut 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
-- 

Adam Voigt
[EMAIL PROTECTED]

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



Re: [PHP-DB] PHP -> MSSQL connects, but can't query

2004-03-12 Thread Adam Voigt
Hmm, replace the line where you select the DB with:

$dbconnect = mssql_select_db("Northwind") or
die(mssql_get_last_message());

(All on one line incase the email wraps it.)


On Fri, 2004-03-12 at 08:35, Jason Morrill wrote:
> I've got a very simple PHP script for testing my MS SQL Server
> connection. I've installed FreeTDS and I can connect and query the
> database with TSQL.
> 
> With PHP I can connect and disconnect properly but I can't query or
> attach to different databases. Here is my sample PHP followed by what
> the web server throws back at me:
> 
> sql-test.php
> 
> 
> 
> 
>  $dbproc = mssql_connect("roger","sa","admin");
> #$dbproc = sybase_connect("roger","sa","admin");
> if (! $dbproc) {
> print "Can't connect to server";
> return;
> }
> print "Connected to server.";
> 
> $dbconnect = mssql_select_db("Northwind");
> if (! $dbconnect) {
> print "Can't connect to Northwind";
> return;
> }
> print "Connected to database";
> 
> #$res = sybase_query("select * from test",$dbproc);
> #if (! $res) {
> #   return;
> #}
> #while ($arr = sybase_fetch_array($res)) {
> #   print $arr["i"] . " " . $arr["v"] . "\n";
> #}
> 
> if (! mssql_close($dbproc)) {
> print "Can't close server connection";
> return;
> }
> print "Connection closed.";
> ?>
> 
> 
> 
> 
> 
> Output in browser when referencing the sql-test.php file:
> -
> 
> Connected to server.
> Warning: Sybase: Server message: Line 1: Incorrect syntax near 'e'.
> (severity 15, procedure N/A) in /home/www/sql-test.php on line 12
> Can't connect to Northwind
> 
> 
> 
> Can anyone help me figure this one out?!
> 
> Thanks!
>  Jason Morrill
>  IT Manager
>  Child & Family Agency SE Connecticut 
-- 

Adam Voigt
[EMAIL PROTECTED]

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



[PHP-DB] working with ' in SQL

2004-03-04 Thread Adam Williams
Hi, I have an SQL statement that is ran when data is submitted through a 
form.  When someone types in a word with an ' such as farmer's the SQL 
statement fails.  I tried $_POST[data] = addslashes($_POST[data]); before 
executing the SQL statement, but the statement still fails.  any 
suggestions?  using words without a ' works fine.

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



Re: [PHP-DB] Protecting mysql database

2004-03-03 Thread Adam Voigt
Why not just stop the database?


On Wed, 2004-03-03 at 09:41, Piet from South Africa wrote:
> Hi
> 
> Is there a way that an alert or something can be generated when a mysql
> database is being accessed in any way.
> 
> I want to close the whole database for a period, and nobody may access the
> database via phpadmin or anything else
> 
> Appreciate your input on this one.
-- 

Adam Voigt
[EMAIL PROTECTED]

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



Re: [PHP-DB] Uploading files

2004-02-27 Thread Adam Voigt
If your on a slow connection, it might be timing out.

Try putting:

set_time_limit(0);

At the top of the page where the file is being uploaded to (not from),
and see if that helps.


On Fri, 2004-02-27 at 10:29, nikos wrote:
> It is allready 8M
> 
> - Original Message - 
> From: "Adam Voigt" <[EMAIL PROTECTED]>
> To: "nikos" <[EMAIL PROTECTED]>
> Cc: "PHP-mailist" <[EMAIL PROTECTED]>
> Sent: Friday, February 27, 2004 5:13 PM
> Subject: Re: [PHP-DB] Uploading files
> 
> 
> > Your max post size needs to be upped to, try making it 6M and see if
> > that makes a difference.
> >
> >
> > On Fri, 2004-02-27 at 10:05, nikos wrote:
> > > Hello list
> > >
> > > Allthough I set my PHP.in upload_max_file=4M my system refused to upload
> > > files bigger than 1M and the browser send an "server not found" error.
> > >
> > > Does anybody know anything about that?
> > > Thank you
> > -- 
> >
> > Adam Voigt
> > [EMAIL PROTECTED]
> >
> > -- 
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
-- 

Adam Voigt
[EMAIL PROTECTED]

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



Re: [PHP-DB] Uploading files

2004-02-27 Thread Adam Voigt
Your max post size needs to be upped to, try making it 6M and see if
that makes a difference.


On Fri, 2004-02-27 at 10:05, nikos wrote:
> Hello list
> 
> Allthough I set my PHP.in upload_max_file=4M my system refused to upload
> files bigger than 1M and the browser send an "server not found" error.
> 
> Does anybody know anything about that?
> Thank you
-- 

Adam Voigt
[EMAIL PROTECTED]

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



[PHP-DB] Re: [PHP] Re: [PHP-DB] Embedded MySQL server (libmysqld)?

2004-02-23 Thread Adam Bregenzer
On Mon, 2004-02-23 at 23:02, [EMAIL PROTECTED] wrote:
> Adam,
> Thanks for your repsone(s) now back the root of the problem.
> As stated above I need to be able to run the database from with the home 
> direcory/document root?

I hesitate to answer this so as to not create a naming confusion but I
can not resist. :)

However, Adam (not me) already answered your question.  If your hosting
provider does not provide you with a mysql or any other database server
you need to use a flat file database solution.  I second his
recommendation of sqlite if you can use it with your hosting provider. 
Another choice may be db or access of you are on windows through odbc. 
If none of these options work for you then you either need to change
hosting providers (which you should since they don't provide what you
seem to need) or you are of course able to write your own database in
PHP and share it with the world. (This is a joke, please don't ask us
how to write your own database).

Also, *please* do not cross post in the future, pick a list and give it
a shot, if you don't have any luck try another one.  I hesitate to cross
post this response but you did not even provide a valid e-mail address
so I am not sure which list you are checking.

Regards,
Adam

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

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



[PHP-DB] Re: [PHP] Re: [PHP-DB] Embedded MySQL server (libmysqld)?

2004-02-23 Thread Adam Voigt
Alright, well with any txt based system, your probably going to run into
problems with multi-users (multiple browsers) updating the DB.

Reguardless, if you must use txtbased, I recommend SQL-Lite, it supports
SQL statements, and is very small and very fast.

http://www.sqlite.com



On Mon, 2004-02-23 at 11:53, [EMAIL PROTECTED] wrote:
> Adam Voigt wrote:
> > Check these guys out:
> > 
> > http://spenix.com/WebHostingPlans.aspx
> > 
> > Very cheap, very reliable, great features, and support is second to none
> > I've ever experienced, and before you ask, no I'm not now nor have I
> > ever been an employee or shareholder. =) Just a satisfied customer.
> > 
> Admin --
> There is no shortage of good cheap hosting package.
> The choice of hosting providers is out of my hands.
> 
> What I'm looking for is a way to implement a  relational database in 
> docuument_root of the web site (ie. /home/username)?
> 
> David
-- 

Adam Voigt
[EMAIL PROTECTED]

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



Re: [PHP-DB] Embedded MySQL server (libmysqld)?

2004-02-23 Thread Adam Voigt
Check these guys out:

http://spenix.com/WebHostingPlans.aspx

Very cheap, very reliable, great features, and support is second to none
I've ever experienced, and before you ask, no I'm not now nor have I
ever been an employee or shareholder. =) Just a satisfied customer.

On Mon, 2004-02-23 at 09:53, [EMAIL PROTECTED] wrote:
> Howdy --
> Would someone point or provide me with an example of PHP + libMysqld 
> (Embedded MySQL server)?
> 
>   My problem is my churchs web site doesn't provide a MySQL database as 
> a default package (add $15.95/mo)for a MySQL Db.
> 
> TIA,
> David
-- 

Adam Voigt
[EMAIL PROTECTED]

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



Re: [PHP-DB] Connect to MSDE using PHP

2004-02-23 Thread Adam Voigt
I have connected to MSDE from PHP and it does work, what I would
suggest, is ignore trying to do hostnames, and use IP's, so change the
connect line to the IP of the MSDE machine. I know some will say it's
not necessary, but I'm just telling you what I did, and it worked fine
using the standard mssql functions, not odbc.


On Sun, 2004-02-22 at 10:57, John W. Holmes wrote:
> I've downlownded and installed the Desktop Edition of MSSQL and am 
> trying to connect to it with PHP. Has anyone ever accomplished this?
> 
> I've uncommented the line in php.ini to load the MSSQL functions and 
> they show up on a phpinfo() page, so that part is good.
> 
> When I installed MSDE I tried it without a named instance first and just 
> set an SA password.
> 
> Neither of these worked:
> mssql_connect('localhost','sa','password')
> mssql_connect('coconut','sa','password')
> 
> where "coconut" is the name of my computer.
> 
> Then I tried installing MSDE again with a named instance and tried
> 
> mssql_connect('namedinstance\localhost','sa','password')
> mssql_connect('namedinstance\coconut','sa','password')
> 
> and those wouldn't work either. The only response I get is "failed to 
> connect to server ..."
> 
> I'm off to try ODBC. Anyone have any suggestions?
> 
> -- 
> ---John Holmes...
> 
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
> 
> php|architect: The Magazine for PHP Professionals – www.phparch.com
-- 

Adam Voigt
[EMAIL PROTECTED]

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



RE: [PHP-DB] MS SQL 'Changed database context' error

2004-02-20 Thread Adam Voigt
Well, even though ignoring the error's (which is actually just an
informational message), you could call the error_reporting function
right above the line throwing the message, and then again below that
line, turning error_reporting back to the default level.



On Thu, 2004-02-19 at 16:38, Michael Flanagan wrote:
> Adam,  Thanks for the suggestions.  I don't want to ignore all error
> handling.  Later, I might get an error that I really don't want php to
> swallow due to either of your suggestions.
> 
> Has anyone else run into this and solved it?
> 
> Any idea why the following lines in the php.ini file don't work?
> mssql.min_error_severity = 11
> mssql.min_message_severity = 11
> 
> Michael
> 
> -Original Message-
> From: Adam Voigt [mailto:[EMAIL PROTECTED]
> Sent: Thursday, February 19, 2004 12:44 PM
> To: Michael Flanagan
> Cc: [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] MS SQL 'Changed database context' error
> 
> 
> Try putting the error suppressor (@) before the query, eg:
> 
> @mssql_query
> 
> Or, try setting the error reporting:
> 
> error_reporting(0);
> 
> 
> 
> On Thu, 2004-02-19 at 14:38, Michael Flanagan wrote:
> > Thanks, Adam.
> >
> > I don't get the error in Enterprise manager.  MS has a KB article out that
> > says that this message is informational.  I seem to remember that the
> > article also says the message comes out some times, and not other times,
> but
> > that you should just forget it.
> >
> > The particular SELECT statement I'm getting the message on is the second
> > query in my script.  The other query is to the same db; in fact, it uses
> the
> > exact same $db connection object.
> >
> > Any ideas on getting PHP to ignore this info message?
> >
> > Thanks again.
> > Michael
> >
> > -Original Message-
> > From: Adam Voigt [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, February 19, 2004 12:13 PM
> > To: Michael Flanagan
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: [PHP-DB] MS SQL 'Changed database context' error
> >
> >
> > This may not be the case, but I've seen this before when the PHP library
> > didn't know how to express MS SQL's error, so it simply returns the last
> > message sent which was the informational context change. If it is infact
> > an error, you should be able to plug the query directly into Enterprise
> > Manager to see MS SQL's take on the problem, so to speak. =)
> >
> > But again, this is all just in my past experience's, yours may differ
> > greatly.
> >
> >
> >
> > On Thu, 2004-02-19 at 14:08, Michael Flanagan wrote:
> > > I'm getting the error "Changed database context" from MS SQL.  I see
> > > where this is supposedly just an informational message.  I've tried
> > > setting
> > >
> > > mssql.min_error_severity = 11
> > > mssql.min_message_severity = 11
> > >
> > > but to no avail.  What am I missing?  I don't mind the message so much,
> > > but php treats this as an error, and doesn't execute my query.
> > >
> > > I'm running php 4.3.3 for Windows; the SQL Server and web server are on
> > the
> > > same machine.  I'm using PEAR:DB for the database access.
> > >
> > > Thanks.
> > >
> > > Michael Flanagan
> > > voice: (1) 303-674-2691
> > >   fax: (1) 603-963-0704 (note '603' area code)
> > > mailto:[EMAIL PROTECTED]
> > --
> >
> > Adam Voigt
> > [EMAIL PROTECTED]
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> --
> 
> Adam Voigt
> [EMAIL PROTECTED]
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
-- 

Adam Voigt
[EMAIL PROTECTED]

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



RE: [PHP-DB] MS SQL 'Changed database context' error

2004-02-19 Thread Adam Voigt
Try putting the error suppressor (@) before the query, eg:

@mssql_query

Or, try setting the error reporting:

error_reporting(0);



On Thu, 2004-02-19 at 14:38, Michael Flanagan wrote:
> Thanks, Adam.
> 
> I don't get the error in Enterprise manager.  MS has a KB article out that
> says that this message is informational.  I seem to remember that the
> article also says the message comes out some times, and not other times, but
> that you should just forget it.
> 
> The particular SELECT statement I'm getting the message on is the second
> query in my script.  The other query is to the same db; in fact, it uses the
> exact same $db connection object.
> 
> Any ideas on getting PHP to ignore this info message?
> 
> Thanks again.
> Michael
> 
> -Original Message-
> From: Adam Voigt [mailto:[EMAIL PROTECTED]
> Sent: Thursday, February 19, 2004 12:13 PM
> To: Michael Flanagan
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] MS SQL 'Changed database context' error
> 
> 
> This may not be the case, but I've seen this before when the PHP library
> didn't know how to express MS SQL's error, so it simply returns the last
> message sent which was the informational context change. If it is infact
> an error, you should be able to plug the query directly into Enterprise
> Manager to see MS SQL's take on the problem, so to speak. =)
> 
> But again, this is all just in my past experience's, yours may differ
> greatly.
> 
> 
> 
> On Thu, 2004-02-19 at 14:08, Michael Flanagan wrote:
> > I'm getting the error "Changed database context" from MS SQL.  I see
> > where this is supposedly just an informational message.  I've tried
> > setting
> >
> > mssql.min_error_severity = 11
> > mssql.min_message_severity = 11
> >
> > but to no avail.  What am I missing?  I don't mind the message so much,
> > but php treats this as an error, and doesn't execute my query.
> >
> > I'm running php 4.3.3 for Windows; the SQL Server and web server are on
> the
> > same machine.  I'm using PEAR:DB for the database access.
> >
> > Thanks.
> >
> > Michael Flanagan
> > voice: (1) 303-674-2691
> >   fax: (1) 603-963-0704 (note '603' area code)
> > mailto:[EMAIL PROTECTED]
> --
> 
> Adam Voigt
> [EMAIL PROTECTED]
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
-- 

Adam Voigt
[EMAIL PROTECTED]

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



Re: [PHP-DB] MS SQL 'Changed database context' error

2004-02-19 Thread Adam Voigt
This may not be the case, but I've seen this before when the PHP library
didn't know how to express MS SQL's error, so it simply returns the last
message sent which was the informational context change. If it is infact
an error, you should be able to plug the query directly into Enterprise
Manager to see MS SQL's take on the problem, so to speak. =)

But again, this is all just in my past experience's, yours may differ
greatly.



On Thu, 2004-02-19 at 14:08, Michael Flanagan wrote:
> I'm getting the error "Changed database context" from MS SQL.  I see
> where this is supposedly just an informational message.  I've tried
> setting
> 
> mssql.min_error_severity = 11
> mssql.min_message_severity = 11
> 
> but to no avail.  What am I missing?  I don't mind the message so much,
> but php treats this as an error, and doesn't execute my query.
> 
> I'm running php 4.3.3 for Windows; the SQL Server and web server are on the
> same machine.  I'm using PEAR:DB for the database access.
> 
> Thanks.
> 
> Michael Flanagan
> voice: (1) 303-674-2691
>   fax: (1) 603-963-0704 (note '603' area code)
> mailto:[EMAIL PROTECTED]
-- 

Adam Voigt
[EMAIL PROTECTED]

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



[PHP-DB] compiling oracle support

2004-02-12 Thread Adam Williams
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-DB] [Fwd: Catalog listing]

2004-01-04 Thread Adam i Agnieszka Gasiorowski FNORD

LOL, look what I've got after posting
 to one of the groups about my problem with
 multiple JOIN query...Some kind of robot
 reads one of them?

 Original Message 
From: [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
Precedence: bulk
Subject: Catalog listing
To: [EMAIL PROTECTED]

Catalog PAGE OF THE BOOK IS VISIBLE IN THE SECTION does not exist.

smime.p7s
Description: S/MIME Cryptographic Signature


Re: [PHP-DB] Trouble With Counting New Documents With Complex Query

2004-01-04 Thread Adam i Agnieszka Gasiorowski FNORD
Jeremy Peterson wrote:
 
> I haven't tested this code, but it should get you started.  I imagine that
> you have a lot of different days that you are trying to restrict in your
> query (This could be costing you a lot of time), so the first query removes
> all articles you don't want up front before doing your joins.  If you were
> using a database that allows subselects, you could have shortened this even
> more (Last I heard MYSQL doesn't support subselects).  Ultimatly you
> shorten the time the query executes because you are removing unnecessary
> computation with the joins.
> 
> I hope this helps you along your way.

Thank you, I'll try to make something out of it
 and test it :8] Maybe I will even get an idea or two
 to improve it futher...

-- 
Seks, seksić, seksolatki... news:pl.soc.seks.moderowana
http://hyperreal.info  { iWanToDie }   WiNoNa)   (
http://szatanowskie-ladacznice.0-700.pl  foReVeR(  *  )
Poznaj jej zwiewne kształty... http://www.opera.com 007

smime.p7s
Description: S/MIME Cryptographic Signature


Re: [PHP-DB] Trouble With Counting New Documents With Complex Query

2004-01-02 Thread Adam i Agnieszka Gasiorowski FNORD
Jeremy Peterson wrote:
 
> Could you repost your original message (I deleted it already, sorry.)  and
> more details about your database tables even some sample data.  I'll try to
> make more sense of the query you are performing and help you along.
> 
> In general it would be better to eliminate the joins.  But there are other
> reasons to use the joins as you are doing, it just depends.  Sometimes
> doing your distinct first then processing that data in an array will be
> faster.  That is as long as you don't have a million records it needs to
> process.
> 
> I'll see what I can do,

To put it short, this just takes to long
 to process. I need to make it faster. Relevant
 fragment below. What I want is a sum of all
 "new", instantiated (visible) articles in all non 
 hidden sections, where "new" is defined as
 "today, from 00:00:01 to 23:59:59". As you can
 see I count in departments "2" and "5", because
 other would give false results(the "3" department
 shares a lot of articles with the "2" department
 and if there is an article in the "3" department
 it is always in "2" too). First I need to know 
 if the article is instantiated, so I JOIN with
 x_instance. From the x_instance table I get also
 the "state" of the article. Then I need to know the 
 department plus is the section I am querying visible at
 all (some aren't), so I JOIN on x_section. Then
 I add all the counts over all the sections and 
 pretty-print a sum. If you need some diagnostic
 information, please tell me what you need (results
 of EXPLAIN? SHOW?). IIRC, all the fields I JOIN on
 are indexed (BTREE).

>  $suma = 0;
> $pytanie  = "SELECT COUNT(DISTINCT x_article.ID) AS CNT ";
> $pytanie .= "FROM x_article ";
> $pytanie .= "LEFT JOIN x_instance ";
> $pytanie .= "ON x_article.ID = x_instance.Article ";
> $pytanie .= "LEFT JOIN x_section ";
> $pytanie .= "ON x_instance.Section = x_section.ID ";
> $pytanie .= "WHERE (x_section.Status & 1) = 0 "; // not empty
> $pytanie .= "AND (x_section.Dept = 2 OR x_section.Dept = 5) "; // Drugs, NeuroGroove
> $pytanie .= "AND (x_instance.Status & 255) = 0 "; // not hidden, etc
> $pytanie .= "AND UNIX_TIMESTAMP(x_article.Date) BETWEEN " . mktime(0, 0, 1, 
> date('m'), date('d'), date('Y')) . " AND UNIX_TIMESTAMP(NOW()) ";
> $pytanie .= "GROUP BY x_article.ID";
> $wynik = mysql_query($pytanie);
> while ($tmp = mysql_fetch_array($wynik))
> {
>   $suma += $tmp['CNT'];
> }
> if ($suma) 
> {
>   // pretty-printing of the result
>   $dzisdodano = str_pad((string)(int)$suma, 4, '0', STR_PAD_LEFT);
> }
> else $dzisdodano = '';
> ?>
> 
> The table layout is as follows:
> 
> mysql> DESC x_article;
> +-+--+--+-+--++
> | Field   | Type | Null | Key | Default  | Extra 
>  |
> +-+--+--+-+--++
> | ID  | int(10) unsigned |  | PRI | NULL | 
> auto_increment |
> | Name| varchar(255) | YES  | MUL | NULL |   
>  |
> | Description | varchar(255) | YES  | | NULL |   
>  |
> | Keywords| varchar(255) | YES  | | NULL |   
>  |
> | Content | mediumtext   |  | |  |   
>  |
> | Date| datetime |  | | 2001-01-01 00:00:00  |   
>  |
> | Author  | varchar(100) |  | | [EMAIL PROTECTED] ||
> | Feedback| varchar(100) | YES  | | NULL |   
>  |
> | Size| int(32)  | YES  | | NULL |   
>  |
> | Words   | int(32)  | YES  | | NULL |   
>  |
> | Images  | int(32)  | YES  | | NULL |   
>  |
> +-+--+--+-+--++
> 
> mysql> DESC x_instance;
> +--+--+--+-+-+---+
> | Field| Type | Null | Key | Default | Extra |
> +--+--+--+-+-+---+
> | Article  | mediumint(9) |  | MUL | 0   |   |
> | Section  | mediumint(9) |  | MUL | 0   |   |
> | Priority | tinyint(4)   |  | | 0   |   |
> | Status   | int(16) unsigned |  | | 0   |   |
> +--+--+--+-+-+---+
> 
> mysql> DESC x_section;
> +--+--+--+-+---++
> | Field| Type | Null | Key | Default   | Extra  |
> +--+--+--+-+---++
> | ID   | mediumint(9) |  | PRI | NULL  | auto_increment |
> | Name | varchar(100) |  | M

Re: [PHP-DB] Trouble With Counting New Documents With Complex Query

2004-01-02 Thread Adam i Agnieszka Gasiorowski FNORD
Jeremy Peterson wrote:
 
> If you are concerned with speed, consider multiple queries.  Joins cause
> most delays.  Give that a shot.

What do you mean? Sorry, please explain
 futher, I don't know what you have in mind...
 I have to do some of those joins, because of
 the relationships between tables - I don't
 want to count invisible articles, so I have
 to JOIN on x_instance table to get to know
 if they are visible at all in any of the
 subsections in the section tree. How would
 you solve this dilemma? Thank you for your
 time.
 
 (sorry if my English is sometimes hard to understand)

-- 
Seks, seksić, seksolatki... news:pl.soc.seks.moderowana
http://hyperreal.info  { iWanToDie }   WiNoNa)   (
http://szatanowskie-ladacznice.0-700.pl  foReVeR(  *  )
Poznaj jej zwiewne kształty... http://www.opera.com 007

smime.p7s
Description: S/MIME Cryptographic Signature


[PHP-DB] Trouble With Counting New Documents With Complex Query

2004-01-02 Thread Adam i Agnieszka Gasiorowski FNORD

I need help width formulating the most
 effective (in terms of processing time) 
 SQL query to count all the "new"
 documents in the repository, where "new" is
 defined as "from 00:00:01 up to 23:59:59
 today". My current query does not give me
 satisfactory results, it creates a visible
 delay in rendering of the main page of one of
 the departments (Drugs) :8[[[
 (at least I, for now, think it's the culprit).
 It's for the https://hyperreal.info >
 site, see for yourself, notice the delay
 https://hyperreal.info/drugs/go.to/index >.

Currently I ask MySQL to (offending
 PHP fragment follows, I hope it is self-
 explanatory).



The table layout is as follows:

mysql> DESC x_article;
+-+--+--+-+--++
| Field   | Type | Null | Key | Default  | Extra  |
+-+--+--+-+--++
| ID  | int(10) unsigned |  | PRI | NULL | auto_increment |
| Name| varchar(255) | YES  | MUL | NULL ||
| Description | varchar(255) | YES  | | NULL ||
| Keywords| varchar(255) | YES  | | NULL ||
| Content | mediumtext   |  | |  ||
| Date| datetime |  | | 2001-01-01 00:00:00  ||
| Author  | varchar(100) |  | | [EMAIL PROTECTED] ||
| Feedback| varchar(100) | YES  | | NULL ||
| Size| int(32)  | YES  | | NULL ||
| Words   | int(32)  | YES  | | NULL ||
| Images  | int(32)  | YES  | | NULL ||
+-+--+--+-+--++

mysql> DESC x_instance;
+--+--+--+-+-+---+
| Field| Type | Null | Key | Default | Extra |
+--+--+--+-+-+---+
| Article  | mediumint(9) |  | MUL | 0   |   |
| Section  | mediumint(9) |  | MUL | 0   |   |
| Priority | tinyint(4)   |  | | 0   |   |
| Status   | int(16) unsigned |  | | 0   |   |
+--+--+--+-+-+---+

mysql> DESC x_section;
+--+--+--+-+---++
| Field| Type | Null | Key | Default   | Extra  |
+--+--+--+-+---++
| ID   | mediumint(9) |  | PRI | NULL  | auto_increment |
| Name | varchar(100) |  | MUL |   ||
| Parent   | mediumint(9) |  | MUL | 0 ||
| Dept | smallint(6)  |  | MUL | 0 ||
| Priority | tinyint(4)   |  | | 3 ||
| Keywords | varchar(255) | YES  | | NULL  ||
| Sorting  | varchar(255) |  | | Priority DESC ||
| OrderBy  | varchar(255) | YES  | | NULL  ||
| SplitAt  | smallint(5) unsigned |  | | 25||
| Status   | int(16) unsigned |  | | 0 ||
+--+--+--+-+---++

Tell me if you need any additional information.
 Thank you for all your help.

MySQL version is 4.0.17, PLD Linux Distribution MySQL RPM.

-- 
Seks, seksić, seksolatki... news:pl.soc.seks.moderowana
http://hyperreal.info  { iWanToDie }   WiNoNa)   (
http://szatanowskie-ladacznice.0-700.pl  foReVeR(  *  )
Poznaj jej zwiewne kształty... http://www.opera.com 007

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



Re: [PHP-DB] CREATE TABLE LIKE, error

2003-12-15 Thread Adam i Agnieszka Gasiorowski FNORD
"CPT John W. Holmes" wrote:
 
> From: "Adam i Agnieszka Gasiorowski FNORD" <[EMAIL PROTECTED]>
> 
> > I cannot use this query
> >
> > CREATE TABLE table LIKE other_table;
> >
> > , which is supposed to create an
> >  empty "clone" of the other_table named
> >  table.
> > Was it added in some later MySQL version?
> >  It's in the manual on mysql.com, bo no version info
> >  available.
> 
> Sure there is, you just had to keep reading.
> 
> Quote:
> In MySQL 4.1, you can also use LIKE to create a table based on the
> definition of another table, including any column attributes and indexes the
> original table has:

Ah, I missed it. Do you know what is
 an estimate for 4.1 to go "stable"?
 
> CREATE TABLE new_tbl LIKE orig_tbl;
> CREATE TABLE ... LIKE does not copy any DATA DIRECTORY or INDEX DIRECTORY
> table options that were specified for the original table.
> 
> Since this is a PHP list, an alternative, two-step method is to issue a SHOW
> CREATE TABLE Table_Name query, retrieve the results, and use them to create
> your second table (replacing the table name, of course).

Thank you very much.

-- 
Seks, seksić, seksolatki... news:pl.soc.seks.moderowana
http://hyperreal.info  { iWanToDie }   WiNoNa)   (
http://szatanowskie-ladacznice.0-700.pl  foReVeR(  *  )
Poznaj jej zwiewne kształty... http://www.opera.com 007

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



[PHP-DB] CREATE TABLE LIKE, error

2003-12-15 Thread Adam i Agnieszka Gasiorowski FNORD

I cannot use this query

CREATE TABLE table LIKE other_table;

, which is supposed to create an
 empty "clone" of the other_table named
 table.
Was it added in some later MySQL version?
 It's in the manual on mysql.com, bo no version info
 available.

-- 
Seks, seksić, seksolatki... news:pl.soc.seks.moderowana
http://hyperreal.info  { iWanToDie }   WiNoNa)   (
http://szatanowskie-ladacznice.0-700.pl  foReVeR(  *  )
Poznaj jej zwiewne kształty... http://www.opera.com 007

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



[PHP-DB] informix error

2003-11-19 Thread Adam Williams
Hi, I was wondering if anyone has seen this informix error before.  It has 
me stumped.  Searching on google didn't reveal anything.  Running my query 
in informix returns the proper results, so I'm not sure what the problem 
is.

Warning: ifx_fetch_row(): 4 is not a valid Informix Result resource in 
/usr/local/apache2/htdocs/alephpub/rg2a.php on line 86

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



Re: [PHP-DB] Optimal mySQL query for next prev page system

2003-11-18 Thread Adam i Agnieszka Gasiorowski FNORD
Kim Steinhaug wrote:

> Then I query the mySQL database again to get the final result set, which
> I return together
> with the buildt prev/next htmlkode

Instead of querying twice, use the
 SQL_CALC_FOUND_ROWS parameter of SELECT
 statement and then do a quick

 SELECT HIGH_PRIORITY FOUND_ROWS();

, to get the number of found rows
 (full number, ignoring LIMIT clause).

-- 
Seks, seksić, seksolatki... news:pl.soc.seks.moderowana
http://hyperreal.info  { iWanToDie }   WiNoNa)   (
http://szatanowskie-ladacznice.0-700.pl  foReVeR(  *  )
Poznaj jej zwiewne kształty... http://www.opera.com 007

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



Re: [PHP-DB] keyword searching

2003-11-12 Thread Adam Williams
This is my SQL query:

"SELECT seriesno, governor, descr, boxno, year, eyear, docno
from rg2 WHERE seriesno = '$_POST[seriesno]' and governor matches 
'*$searchterm*' or descr matches '*$searchterm*'";

So as you can see, its gonna need some work to make it do fulltext 
searching of the descr field.  I'm not really sure how to make it do a 
keyword search, either since "holmes*north*carolina" doesn't work 
because it only searches  for those words in that order, if descr field 
in the database contains "north carolina holmes" it won't return that 
result, but I want it to because the person using the db is looking for 
all the fields that contain holmes, north, and carolina.

CPT John W. Holmes wrote:
From: "Adam Williams" <[EMAIL PROTECTED]>

CPT John W. Holmes wrote:

From: "Adam Williams" <[EMAIL PROTECTED]>

I am selecting a field in a database called description for keyword
searching.  The field contains names of people, states, years, etc.
When

someone searches for say "holmes north carolina" the query searches for
exactly that, fields which have "holmes north carolina", and not fields
that contaim holmes, north, and carolina.  So I run a str_replace to
replace all spaces with *, which turns it into "holmes*north*carolina",
but say that north carolina is before holmes in the field, it won't
return

those fields (it only returns fields in which holmes is infront of north
carolina).  So how can I have it return all fields which contain all
the words holmes, north, and carolina in any order, in that field?
Are you doing a fulltext search or just matching a word in a lookup
column?

I'm doing a fulltext search.


What is your query? Assuming MySQL, I get a result like this:

mysql> select * from test where match(t) against ('holmes north carolina');
++
| t  |
++
| my name is john holmes from north carolina |
| i'm from the north |
| in carolina is my home |
| did I mention my last name is holmes?  |
++
4 rows in set (0.01 sec)
Isn't that what you want?

---John Holmes...

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


[PHP-DB] Re: [PHP] keyword searching

2003-11-12 Thread Adam Williams
I'm using Informix SQL.  Do you know how to do full text searching on 
Informix?  If so, please share the details :)

Jay Blanchard wrote:

[snip]
I am selecting a field in a database called description for keyword 
searching.  The field contains names of people, states, years, etc.
When 
someone searches for say "holmes north carolina" the query searches for 
exactly that, fields which have "holmes north carolina", and not fields 
that contaim holmes, north, and carolina.  So I run a str_replace to 
replace all spaces with *, which turns it into "holmes*north*carolina", 
but say that north carolina is before holmes in the field, it won't
return 
those fields (it only returns fields in which holmes is infront of north

carolina).  So how can I have it return all fields which contain all 
the words holmes, north, and carolina in any order, in that field?
[/snip]

You don't say which database you are using, but several allow for full
text searching of fields where the order is inconsequential. The
behaviour you describe is preceisely how most (if not all) databases
will return a search on a "standard" column type.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] keyword searching

2003-11-12 Thread Adam Williams
I'm doing a fulltext search.

CPT John W. Holmes wrote:

From: "Adam Williams" <[EMAIL PROTECTED]>

I am selecting a field in a database called description for keyword
searching.  The field contains names of people, states, years, etc.  When
someone searches for say "holmes north carolina" the query searches for
exactly that, fields which have "holmes north carolina", and not fields
that contaim holmes, north, and carolina.  So I run a str_replace to
replace all spaces with *, which turns it into "holmes*north*carolina",
but say that north carolina is before holmes in the field, it won't return
those fields (it only returns fields in which holmes is infront of north
carolina).  So how can I have it return all fields which contain all
the words holmes, north, and carolina in any order, in that field?


Are you doing a fulltext search or just matching a word in a lookup column?

In the case of the latter, you'll have to split up the sentence into
individual words and look for each of them
WHERE column = 'holmes' || column = 'north' || column = 'carolina' ...

---John Holmes...
(not in North Carolina, btw!)
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] keyword searching

2003-11-12 Thread Adam Williams
Hello,

I am selecting a field in a database called description for keyword 
searching.  The field contains names of people, states, years, etc.  When 
someone searches for say "holmes north carolina" the query searches for 
exactly that, fields which have "holmes north carolina", and not fields 
that contaim holmes, north, and carolina.  So I run a str_replace to 
replace all spaces with *, which turns it into "holmes*north*carolina", 
but say that north carolina is before holmes in the field, it won't return 
those fields (it only returns fields in which holmes is infront of north 
carolina).  So how can I have it return all fields which contain all 
the words holmes, north, and carolina in any order, in that field?

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



[PHP-DB] $_POST in MySQL query issue...

2003-10-19 Thread Adam Reiswig
A couple of days ago I placed a post regarding using the $_POST[]
variable in an insert sql query.  Both
$sql="insert into $table set Name = '".$_POST['elementName']."'";
  and
$sql="insert into $table set Name = '{$_POST['elementName']}'";
worked perfectly.  Thanks to everyone for your help.  My question now is
regarding the curly brackets in the 2nd example.  Can anyone describe
why using the curly brackets works and/or how php processes them.  I
have read quite a bit about php and never come accross thier use in this
way.  Thanks again.
-Adam Reiswig

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


Re: [PHP-DB] $_POST in MySQL query issue...

2003-10-19 Thread Adam Reiswig
A couple of days ago I placed a post regarding using the $_POST[] 
variable in an insert sql query.  Both

$sql="insert into $table set Name = '".$_POST['elementName']."'";
  and
$sql="insert into $table set Name = '{$_POST['elementName']}'";
worked perfectly.  Thanks to everyone for your help.  My question now is 
regarding the curly brackets in the 2nd example.  Can anyone describe 
why using the curly brackets works and/or how php processes them.  I 
have read quite a bit about php and never come accross thier use in this 
way.  Thanks again.

-Adam Reiswig

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


[PHP-DB] $_POST in MySQL query issue...

2003-10-16 Thread Adam Reiswig
Greetings to all.  I am trying for the life of me to place a $_POST[] 
variable in my MySQL query.  I am running the latest stable versions of 
PHP, MySQL and Apache 2 on my Win2kPro machine.  My register_globals are 
set to off in my php.ini.  My code I am attempting create is basically 
as follows:

$table="elements";
$sql="insert into $table set Name = '$elementName'";
This works with register_globals set to on.  But, I want to be able to 
turn that off.  My code then, I am guessing, be something as follows:

$table="elements";
$sql="insert into $table set Name = '$_POST["elementName"]'";
Unfortunately this and every other combination I can think of, 
combinations of quotes that is, does not work.  I believe the source of 
the problem is the quotes within quotes within quotes. I also tried:

$sql='insert into $table set Name = '.$_POST["elementName"];
  or
$sql="insert into $table set Name = ".$_POST['elementName'];
and several other variations.

Can anyone give me some pointers to inserting $_POST[] statements inside 
of query statements?  I am sure there must be a way but I have spent a 
lot of time on this and am really stumped here.  Thanks for any help.

-Adam Reiswig

PS if anything here is not clear to you, please let me know and I'll 
clarify as I can.  Thanks again.

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


[PHP-DB] Variables not working within Functions

2003-10-15 Thread Adam Symonds
Hi,
I am starting to us functions with my work but I am having troubles
With the variables in the functions..

If I have the following function called from my page it will work but the
variable won’t
($username)
but if I put this code straight on the page then it works fine..

Any reason for the variable not to work in the function but in straight
coding?
Thanx



Sample Function Below:

==
function LoginSystem()
 {
echo "";
if ( !isset( $_SESSION['login'] ) ) {

echo "";
echo "Username:  Password:  ";
echo "Not A Member
Yet? ";
echo "";

 } else {
echo "Welcome $username    Logout   ";
}
echo "";
 }


[PHP-DB] Photo Gallery Comments.. NOT WORKING

2003-09-25 Thread Adam Symonds
Hi I have the following code which is a photo gallery, I have set it up so
users
can add comments to the photos, what I want to happen is in the gallery if a
user
has posted a comment on the photo, I want it to say comments under the photo
in the gallery, I have tried doing this using  IN_ARRAY but I am getting an
error msg,

Warning: in_array(): Wrong datatype for second argument
on line 203

line 203 is this: if(in_array($images[$i],$result))echo "Comments";
will have a play around with a few things and left yuo know if I suceed b4
you get back.

Can someone see what I am doing wrong with the in_array..

Thanx In advance
Adam

==

";
} //End While
} else {
echo "no comments";
}

//end of comments selection

//page vars
$total = count($images);
$limit = 15;
$page = $_GET['page'];
$num_prow=3;

//$offset = ($page - 1) * $limit;

//$jpgs=0;
$handle=opendir($PathVar);
$index=0;
$images;
$last_updated;

while($file=readdir($handle)){

if($file!='.' && $file!='..'){
$myfile=explode(".",$file);

if($myfile[1]=='jpg' || $myfile[1]=='JPG'){
$images[$index]=$file;
//$size[$index]=filesize($file);
//$date[$index]=filemtime($file);
$thumb[$index]=$file;
$index++;
$jpgs++;
}
}
}

if(!$images){
print "::Warning::This folder contains no allowed image files.";
exit;
}

$total=count($images);

$numPages = ceil($total / $limit);


$j=0;

// Set first set of pictures
if(!isset($pics)){$pics=$page * $limit;}

//$pics = $page * $limit;


$from = $pics-$limit;
$pp = $pics+$limit;
// =OUTPUT=

$query2 = "SELECT * FROM eventlistings WHERE PhotoPath = $PathVar";
   $result2 = mysql_query($query2, $mysql_access) or DIE(mysql_error());
if ($result2) {
while ($r = mysql_fetch_array($result2))
{ // Begin While
extract($r);
echo "";
}} //End While

echo "$EventName - $EventDate 
Directory contains a total of ".count($images)." image files ";

echo "";

for($i = $from; $i < $pics && $i < $total; $i++){

if($j == $num_prow){
echo "


";
if(in_array($images[$i],$result))echo "Comments";
echo "";
//
$j = 1;

}else{
echo "";
//
if(in_array($images[$i],$result))echo "Comments";//

$j++;

}
}
echo "";

if ($page == 1) // this is the first page - there is no previous page
echo "Previous";
else// not the first page, link to the previous page
echo "Previous";

for ($i = 1; $i <= $numPages; $i++) {
echo " | ";
if ($i == $page)
echo "$i";
else
echo "$i";
}

if ($page == $numPages) // this is the last page - there is no next page
echo " | Next";
else// not the last page, link to the next page
echo " | Next";
/*
if($i < $total){echo "Next";}
if($page != $total){echo " Last";}
*/
echo "";

closedir($handle);
?>

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



[PHP-DB] Re: PHP & MSSQL

2003-08-14 Thread Adam Presley
I know what you're going through here. In MS SQL you can define a VARCHAR up
to about 8000 characters, but your PHP mssql_query command only returns 255
(0 - 254) characters. I then tried using the TEXT datatype. TEXT datatype in
MS SQL allows somewhere around 2 billion characters. However, the PHP
mssql_query command only returns 4096 characters every time. This appear to
be a limitation of the PHP MSSQL commands.


"Shaun Bentley" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi
> I am currently trying to use PHP and MSSQL together but I am having a
> few problems.
>
> I can enter data into the Db OK, but when pulling the data back to display
> on the page, the string cuts to around 250 chars. The Db field is VarChar
> 6000 and I can see the whole data in the field.
>
> I have tried pulling the data out as object, array & row but always lose
the
> end.
>
> Any help please!
>
> Shaun
>
>



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



[PHP-DB] Re: PHP & MSSQL

2003-08-14 Thread Adam Presley
Ok. Special thanks to Robert Twitty for the answer. I started using the TEXT
datatype to achieve long texts of data. However, PHP.INI is configured by
default to limit TEXT datatype retrievals to 4K. Change the mssql.textlimit
in the INI file to suit your purposes, and use the TEXT datatype.

Thanks!

"Shaun Bentley" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi
> I am currently trying to use PHP and MSSQL together but I am having a
> few problems.
>
> I can enter data into the Db OK, but when pulling the data back to display
> on the page, the string cuts to around 250 chars. The Db field is VarChar
> 6000 and I can see the whole data in the field.
>
> I have tried pulling the data out as object, array & row but always lose
the
> end.
>
> Any help please!
>
> Shaun
>
>



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



RE: [PHP-DB] Don't know why query works this way

2003-08-11 Thread Adam Alkins
Quoting Aaron Wolski <[EMAIL PROTECTED]>:

> Here's some functions I use in my development which save on connect and
> query calls for me.
> 
> //General Purpose Utilities.
> //db_connect connects to the database server and selects the proper
> database.
> //Arguments: None
> //Returns: Nothing
> 
> 
> function db_connect() {
> 
>   mysql_pconnect("localhost","username","password");
>   mysql_select_db("Database");
>   
> }
> 
> 
> //db_query queries the database server and returns the results.
> //Arguments: SQL query string
> //Returns: Query results
> 
> function db_query($query) {
> 
>   return mysql_query($query);
>   
> }
> 
> 
> //db_fetch returns the next set of results from a db_query.
> //Arguments: db_query results variable
> //Returns: Next set of query results as an array or 0 if no further
> results are present
> 
> 
> function db_fetch($results) {
> 
>   return mysql_fetch_array($results);
>   
> }
> 
> 
> //db_numrows returns the number of rows selected from a query.
> //Arguments: query result
> //Returns: number of rows in the query result
> 
> function db_numrows($result) {
> 
>   return mysql_num_rows($result);
>   
> }
> 
> 
> //Always connect to the database!
> 
> db_connect();
> 
> 
> Keep these in an include file. The db_connect(); goes at the bottom and
> keep the connection open during the routines.
> 
> 
> To call db_query you would use it like:
> 
> $someQuery = db_query("SELECT * from someTable ");
>  
> 
> to get the results out of the query you would call db_fetch and use it
> like:
> 
> 
> $someResult = db_fetch($someQuery);
> 
> If you needed to return an array you would use it with a while or for
> statement like:
> 
> While ($someResult = db_fetch($someQuery)) {
> 
> }
> 
> If you needed to get the number of rows from the query you'd use like:
> 
> numRows = db_numrows($someQuery);
> 
> or
> 
> if (db_numrows($someQuery) > ...)
> 
> 
> These are just some thing I use to make my life easier.
> 
> Hope it helps
> 

Not to be rude... but what does that have to do with his question?

-- 
Adam Alkins
http://www.rasadam.com

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



RE: [PHP-DB] determining if a query returns no value

2003-08-08 Thread Adam Alkins
Quoting [EMAIL PROTECTED]:

> Youy could use:
> if(!$result) {
>   // Don't display
> } else {
> echo "Title";
> }
> 
> You fill in the blanks

That only checks to see the query failed. A query returning no rows doesn't fail...

-- 
Adam Alkins
http://www.rasadam.com

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



Re: [PHP-DB] Limit

2003-08-04 Thread Adam Alkins
If it is a unix timestamp, why not just select rows where the date is >= 7776000
(which is 90 days) or if you want to be specific about the months, use mktime()
to generate the timestamp for the date 3 months ago.

-- 
Adam Alkins
http://www.rasadam.com


Quoting Marie Osypian <[EMAIL PROTECTED]>:

> I don't want to use the limit on this query anymore.  What I want is to
> display all that are dated within the last 3 months.  What would be the easy
> way to do that?
> 
> 
> SELECT federal_development_id, UNIX_TIMESTAMP(date) AS date, topic, body
>   FROM federal_developments
>   WHERE pro_solutions = 'Y'
>   ORDER BY date DESC
>   LIMIT 5";
> 
> 
> Thanks,
> 
> MAO
> 
> 
> 
> -- 
> 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] Regular Expressions? URGENT

2003-08-02 Thread Adam Royle
Hi Aaron,

I found this on a little useful when I started learning regex. Good 
luck 2 ya!

adam

http://www.devshed.com/Server_Side/Administration/RegExp/

Hi All,

Sorry for OT post but need some info.

Does anyone know a good tutorial that explains regular expressions in
DUMMY terms?
I have a list of characters that I need to check to see if
they are in a
string. I tried creating an array of the characters but some
of them are
like  ' " and ` which seem to cause some problems.
Any good turotials for regular expressions?

Thanks a bunch!

Aaron


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


[PHP-DB] MySQL Extention in PHP5.0.0b2-dev

2003-07-07 Thread Adam Lundrigan
Apache 2.0.46 (Win32) PHP/5.0.0b2-dev w/ MySQL 4.1.0

I have a question about the mySQL extension in the aforementioned version of
PHP
Whenever I try to load the extension thru adding it to PHP.INI like so I get
an error

extension_dir = "C:\Servers\PHP\extensions"
.
.
.
extension = php_gd2.dll
extension = php_mysql.dll



The error says that "C:\Servers\PHP\extensions\php_mysql.dll" could not be
loaded.  However, it doesn't give the same error for php_gd2.dll, it loads
fine.
When I change the extension_dir to the wrong directory, it gives me errors
for both DLLs.  When the directory is right, I still get the error for the
mysql extension

Any Ideas?

Thanks.
Adam Lundrigan



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



Re: [PHP-DB] Re: How to get PHP to download web contents

2003-07-07 Thread Adam Voigt
Try CURL:

http://us2.php.net/curl



On Mon, 2003-07-07 at 10:17, Steve B. wrote:
> Yes I had tried all those below before posting.
> It sounds like this is the only way to deal with authentication from what I see.
> In windows it works fine from the browser to include name and pass in url.
> In Linux it comes back and asks for the pw again.
> I'd think the only difference would be in headers.
> Is there any header info todo with authentication which come from the client which 
> are not set by
> doing the url name and pw?
> 
> Thanks,
> Steve
> 
> --- Ognyan Bankov <[EMAIL PROTECTED]> wrote:
> > "Steve B." <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > Hi Nadim,
> > > It works but not for sites with password window that pops up.
> > I see.
> > That is HTTP Basic Authentication
> > You should use this line:
> > $filename = 'http://someuser:[EMAIL PROTECTED]/';
> > instead of:
> > $filename = "http://somesite.com?user=someuser&pwd=somepwd;
> > 
> > and source will look like:
> >  > // get contents of a file into a string
> > $filename = 'http://someuser:[EMAIL PROTECTED]/';
> > $handle = fopen ($filename, "r");
> > $contents = fread ($handle, filesize ($filename));
> > fclose ($handle);
> > ?>
> > 
> > nadim's solution will look like this:
> > $html = implode ('', file ('http://someuser:[EMAIL PROTECTED]/'));
> > 
> > 
> > 
> > 
> > 
> > -- 
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> 
> 
> __
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
-- 
Adam Voigt ([EMAIL PROTECTED])
Linux/Unix Network Administrator
The Cryptocomm Group


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



Re: [PHP-DB] No MySQL Support in PHP5 - Uh oh!

2003-07-04 Thread Adam Lundrigan
Thanks.  I'll try that

-Adam

"Marco Tabini" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Try in the current snapshot at http://snaps.php.net (also, more info on
> my blog).
>
> Cheers,
>
>
> Marco Tabini
> http://blogs.phparch.com
>
> On Fri, 2003-07-04 at 13:01, Adam Lundrigan wrote:
> > that doesn't seem to workit tells me that the libmysql.dll file is
not a
> > PHP module.  Where can I track down the PHP module for MySQL?  Its not
in my
> > /extensions directory
> >
> > -Adam
> >
> > "Lester Caine" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > > Exactly how would one go about installing the MySQL extension, as a
> > > > workaround to the removal of the builtin MySQL library?
> > >
> > > Just select it in the php.ini list of extensions? That is
> > > how I get Firebird(Interbase) instead.
> > >
> > > Leaving sections of the code to user choice is much better
> > > than building in code that lots of people do not want anyway.
> > >
> > > --
> > > Lester Caine
> > > -
> > > L.S.Caine Electronic Services
> > >
> > >
> > >
> --
>
> Marco Tabini
> President
>
> Marco Tabini & Associates, Inc.
> 28 Bombay Avenue
> Toronto, ON M3H 1B7
> Canada
>
> Phone: (416) 630-6202
> Fax: (416) 630-5057
> Web: http://www.tabini.ca
>



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



Re: [PHP-DB] No MySQL Support in PHP5 - Uh oh!

2003-07-04 Thread Adam Lundrigan
that doesn't seem to workit tells me that the libmysql.dll file is not a
PHP module.  Where can I track down the PHP module for MySQL?  Its not in my
/extensions directory

-Adam

"Lester Caine" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > Exactly how would one go about installing the MySQL extension, as a
> > workaround to the removal of the builtin MySQL library?
>
> Just select it in the php.ini list of extensions? That is
> how I get Firebird(Interbase) instead.
>
> Leaving sections of the code to user choice is much better
> than building in code that lots of people do not want anyway.
>
> --
> Lester Caine
> -
> L.S.Caine Electronic Services
>
>
>



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



Re: [PHP-DB] No MySQL Support in PHP5 - Uh oh!

2003-07-03 Thread Adam Lundrigan
Exactly how would one go about installing the MySQL extension, as a
workaround to the removal of the builtin MySQL library?

Thanks,

-Adam Lundrigan


"Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Sun, 29 Jun 2003, Ben Lake wrote:
> > Anyone have an input on the recent announcement that about MySQL
> > libraries not being present in PHP 5. What other means might be
> > available to connect to MySQL?
>
> This only affects the bundled library.  It doesn't mean the MySQL
> extension is going away.  Just means you will need to install the library
> yourself.  Exactly like you have to install the client library for
> PostgreSQL, Oracle, Sybase, LDAP, IMAP, SNMP, etc. before you will have
> support for those things.
>
> -Rasmus



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



Re: [PHP-DB] Reading from a file

2003-07-01 Thread Adam Voigt
$data = file('c:\file.txt');

for($counter = 0; $counter < count($data); $counter++)
$data[$counter] = explode("\t",$data[$counter]);

Poof. For:

bob ninajim joe

You will get:

$data[0][0] = 'bob';
$data[0][1] = 'nina';
$data[0][2] = 'jim';
$data[0][3] = 'joe';

Nice and easy to recurse through.



On Tue, 2003-07-01 at 12:10, Rick Dahl wrote:
> I need to read from a file that is tab delimited.  Is there anyway to specify that 
> it reads between each tab and that is it.  I know fread() uses bytes to figure out 
> what to read but that isn't very practical in my case.  
> 
> Also, how do I get rid of any white space at the end of a variable if there is some 
> once it is read in?
> 
> - Rick
-- 
Adam Voigt ([EMAIL PROTECTED])
Linux/Unix Network Administrator
The Cryptocomm Group


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



Re: [PHP-DB] Related Tables - Capture ID

2003-06-26 Thread Adam Voigt
Do the second query, call the mysql_insert_id function,
and that will give you the id of the row it just inserted.



On Thu, 2003-06-26 at 11:43, Marie Osypian wrote:
> Hello,
> 
> I have three table in which I am inserting records into in one script.  I
> need to capture the ID of the second tables record insertion to insert into
> a field into a related table in the third.  What would the easiest way to go
> about this in php?
> 
> Thanks,
> 
> MAO
-- 
Adam Voigt ([EMAIL PROTECTED])
Linux/Unix Network Administrator
The Cryptocomm Group


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



Re: [PHP-DB] moving though an array..

2003-06-26 Thread Adam Voigt
One Thing:

Change $columns[] to $colums, example:

$columns = explode(',',$threadsColumn);


On Thu, 2003-06-26 at 10:23, Aaron Wolski wrote:
> Hi All,
>  
> Hopefully someone here can point me in the right direction.
>  
> I need to create a SELECT statement based on some criteria select and
> entered into a form.
>  
> Form variables:
>  
> $threadsColumn = "manufactuer,colour";
> $string = "n";
>  
> Code:
>  
> $columns[] = explode(",",$threadsColumn);
>  
> $test = "(";
>  
> for ($i=0;$i  
> $test .= $columns[$i]." %$string%";
>  
> }
>  
> $test .= ")";
>  
> echo $test;
>  
> What I am attempting to do is create a select statement that would look
> like (based on "form variables"):
>  
> SELECT * FROM tablename WHERE (manufacturer LIKE %n% OR colour LIKE %n%)
>  
> The information between ( and ) needs to be written in such a manner
> that it scales up or down in options.. depending on what was selected in
> the form.
>  
> ANYONE have some thoughts?
>  
> Oh.. when I echo the above code I get this: (Array %h%)
>  
> Thanks!
>  
> Aaron 
>  
-- 
Adam Voigt ([EMAIL PROTECTED])
Linux/Unix Network Administrator
The Cryptocomm Group


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



Re: [PHP-DB] Accessing MySql using Flash while using PHP as themiddleware

2003-06-25 Thread Adam Voigt
Might want to check out a article on devshed:

http://devshed.com/Client_Side/Flash/DataDrivenFlash/page1.html


On Wed, 2003-06-25 at 11:15, Ron Allen wrote:
> Does anybody have an idea how-to use Flash and PHP to access a MySql
> database. I know how to use PHP and mysql with no problem to pull info, but
> with Flash I am struggling.
-- 
Adam Voigt ([EMAIL PROTECTED])
Linux/Unix Network Administrator
The Cryptocomm Group


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



Re: [PHP-DB] Total Values with MySQL

2003-06-03 Thread Adam Voigt
SELECT SUM(ColumnName) AS total FROM table WHERE ColunName = '1';



On Mon, 2003-06-02 at 11:18, shaun wrote:
> Hi,
> 
> Is it possible to get MySQL to total the values of a select statement, say
> 'SELECT ColumnName FROM Table WHERE ColumnName = '1''
> 
> Say I have three values in ColumnName all of '1' then can I get MySQL to
> return 3?
> 
> Thanks for your help
-- 
Adam Voigt ([EMAIL PROTECTED])
Linux/Unix Network Administrator
The Cryptocomm Group


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



Re: [PHP-DB] Problem with php/mysql and ISS on windows XPprofeesional

2003-06-03 Thread Adam Voigt
Put single quote's around name in your record array, example:

Use:

$record['name']

Instead Of:

$record[name]


On Mon, 2003-06-02 at 11:04, Ahmed Abdelaliem wrote:
> here is the code i wrote
> i didn't miss the $ sign
> and it works fine on web
> but returns the error message when i use it on localhost
> 
> 
>  @ $db = mysql_connect("localhost");
> mysql_select_db("cds");
> $test_tr = mysql_query("select name from newpcgames order by gameid desc 
> LIMIT 0,
> 10");
> $test_tr1 = mysql_query("select name from newpcgames order by gameid desc 
> LIMIT 10,
> 20");
> 
> 
> while($record = mysql_fetch_array($test_tr))
>   {
> 
>   $record1= mysql_fetch_array($test_tr1);
> 
> echo "
> 
>  onmouseout=\"this.bgColor='475674'\" bgColor=#475674 width=\"50%\">
>  color=#ff size=1>";
>   echo stripslashes($record[name]);
>   echo "  ";
>   echo " onmouseover=\"this.bgColor='00'\" onmouseout=\"this.bgColor='475674'\" 
> bgColor=#475674 width=\"50%\">
>  color=#ff size=1>";
>  echo stripslashes($record1[name]);
>  echo "
>";
>   }
> 
> 
>   ?>
> 
> 
> >From: "Cal Evans" <[EMAIL PROTECTED]>
> >To: "Ahmed Abdelaliem" 
> ><[EMAIL PROTECTED]>,<[EMAIL PROTECTED]>
> >Subject: Re: [PHP-DB] Problem with php/mysql and ISS on windows XP 
> >profeesional
> >Date: Mon, 2 Jun 2003 09:52:21 -0500
> >
> >Sounds like you left off a $ when using a variable.  I would take a look at
> >line 158, find the variable name and make sure it's $name. Disabling the
> >error will cause the message to go away but not fix the problem.
> >
> >humbly,
> >=C=
> >* Cal Evans
> >* http://www.christianperformer.com
> >* Stay plugged into your audience
> >* The measure of a programmer is not the number of lines of code he writes
> >but the number of lines he does not have to write.
> >*
> >
> >- Original Message -
> >From: "Ahmed Abdelaliem" <[EMAIL PROTECTED]>
> >To: <[EMAIL PROTECTED]>
> >Sent: Monday, June 02, 2003 9:50 AM
> >Subject: [PHP-DB] Problem with php/mysql and ISS on windows XP profeesional
> >
> >
> > > hi
> > > i use php and mysql on IIS server on windows xp professional
> > > when i select anything from the database i get this :
> > > "Notice: Use of undefined constant name - assumed 'name' in
> > > d:\inetpub\wwwroot\EGYCDS\index.php on line 158
> > > Spy Hunter"
> > >
> > > while evrything is going fine when i upload it on the web and it returns
> > > only "Spy Hunter"
> > >
> > > i think  i have to disable this eroor message only
> > > can any one tell me how i disable that error message
> > >
> > > _
> > > Help STOP SPAM with the new MSN 8 and get 2 months FREE*
> > > http://join.msn.com/?page=features/junkmail
> > >
> > >
> > > --
> > > 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
> >
> 
> _
> Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
> http://join.msn.com/?page=features/junkmail
-- 
Adam Voigt ([EMAIL PROTECTED])
Linux/Unix Network Administrator
The Cryptocomm Group


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



Re: [PHP-DB] Problem with php/mysql and ISS on windowsXPprofeesional

2003-06-03 Thread Adam Voigt
Ok, like I said, if it is an error (like a missing dollar sign) then
put the dollar sign in, therefore fixing the problem. However, if there
is not an error and he is simply using a variable and PHP is complaining
it's not defined, that's not a big deal, thats why it doesn't make the
code fail. It just means it noticed you accessed the variable $whatever
without making sure it was defined before you checked if it was false,
etc. No big deal, thats why the majority of PHP install's set the
error_reporting to ignore E_NOTICE, because it's completely safe to do
so.

On Mon, 2003-06-02 at 10:58, Cal Evans wrote:
> Again, changing the error reporting level will not fix the problem.  Since
> he is getting a warning AND his code is acting unexpectedly, he probably
> needs to concentrate on fixing the problem. (At least I assume that there is
> a problem. It sounds like there is from his description.)
> 
> humbly,
> =C=
> 
> * Cal Evans
> * http://www.christianperformer.com
> * Stay plugged into your audience
> * The measure of a programmer is not the number of lines of code he writes
> but the number of lines he does not have to write.
> *
> 
> - Original Message -
> From: "Adam Voigt" <[EMAIL PROTECTED]>
> To: "Ahmed Abdelaliem" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Monday, June 02, 2003 9:59 AM
> Subject: Re: [PHP-DB] Problem with php/mysql and ISS on windows
> XPprofeesional
> 
> 
> > If your missing the dollar sign then add it, if your not, then
> > set error_reporting in your php.ini to "E_ALL & ~E_NOTICE".
> >
> >
> >
> > On Mon, 2003-06-02 at 10:52, Cal Evans wrote:
> > > Sounds like you left off a $ when using a variable.  I would take a look
> at
> > > line 158, find the variable name and make sure it's $name. Disabling the
> > > error will cause the message to go away but not fix the problem.
> > >
> > > humbly,
> > > =C=
> > > * Cal Evans
> > > * http://www.christianperformer.com
> > > * Stay plugged into your audience
> > > * The measure of a programmer is not the number of lines of code he
> writes
> > > but the number of lines he does not have to write.
> > > *
> > >
> > > - Original Message -
> > > From: "Ahmed Abdelaliem" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Monday, June 02, 2003 9:50 AM
> > > Subject: [PHP-DB] Problem with php/mysql and ISS on windows XP
> profeesional
> > >
> > >
> > > > hi
> > > > i use php and mysql on IIS server on windows xp professional
> > > > when i select anything from the database i get this :
> > > > "Notice: Use of undefined constant name - assumed 'name' in
> > > > d:\inetpub\wwwroot\EGYCDS\index.php on line 158
> > > > Spy Hunter"
> > > >
> > > > while evrything is going fine when i upload it on the web and it
> returns
> > > > only "Spy Hunter"
> > > >
> > > > i think  i have to disable this eroor message only
> > > > can any one tell me how i disable that error message
> > > >
> > > > _
> > > > Help STOP SPAM with the new MSN 8 and get 2 months FREE*
> > > > http://join.msn.com/?page=features/junkmail
> > > >
> > > >
> > > > --
> > > > PHP Database Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > > >
> > --
> > Adam Voigt ([EMAIL PROTECTED])
> > Linux/Unix Network Administrator
> > The Cryptocomm Group
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
-- 
Adam Voigt ([EMAIL PROTECTED])
Linux/Unix Network Administrator
The Cryptocomm Group


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



Re: [PHP-DB] Problem with php/mysql and ISS on windows XPprofeesional

2003-06-03 Thread Adam Voigt
If your missing the dollar sign then add it, if your not, then
set error_reporting in your php.ini to "E_ALL & ~E_NOTICE".



On Mon, 2003-06-02 at 10:52, Cal Evans wrote:
> Sounds like you left off a $ when using a variable.  I would take a look at
> line 158, find the variable name and make sure it's $name. Disabling the
> error will cause the message to go away but not fix the problem.
> 
> humbly,
> =C=
> * Cal Evans
> * http://www.christianperformer.com
> * Stay plugged into your audience
> * The measure of a programmer is not the number of lines of code he writes
> but the number of lines he does not have to write.
> *
> 
> - Original Message -
> From: "Ahmed Abdelaliem" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, June 02, 2003 9:50 AM
> Subject: [PHP-DB] Problem with php/mysql and ISS on windows XP profeesional
> 
> 
> > hi
> > i use php and mysql on IIS server on windows xp professional
> > when i select anything from the database i get this :
> > "Notice: Use of undefined constant name - assumed 'name' in
> > d:\inetpub\wwwroot\EGYCDS\index.php on line 158
> > Spy Hunter"
> >
> > while evrything is going fine when i upload it on the web and it returns
> > only "Spy Hunter"
> >
> > i think  i have to disable this eroor message only
> > can any one tell me how i disable that error message
> >
> > _
> > Help STOP SPAM with the new MSN 8 and get 2 months FREE*
> > http://join.msn.com/?page=features/junkmail
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
-- 
Adam Voigt ([EMAIL PROTECTED])
Linux/Unix Network Administrator
The Cryptocomm Group


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



Re: [PHP-DB] Connect Microsoft SQL database with php on unix

2003-04-01 Thread Adam Voigt
You need to compile the FreeTDS library (freetds.org),
and on your PHP configure line, add "--with-sybase=/usr/local/freetds"
replacing the path for where you installed FreeTDS.

And yes, it says Sybase, but no, you don't use the sybase
functions, you can still use all the mssql_whatever functions.

On Mon, 2003-03-31 at 13:40, Greg Cirino wrote:
> >Maybe mssql_connect()??
> >
> >www.php.net/mssql_connect
> 
> 
> The documentation indicates using sybase_connect (etc...) unless you
> are on a windows machine.
> 
> But that doesn't work either as the sybase.so file seems to be
> non-existant (on my machine anyway)
> 
> Regards
> Greg Cirino
> 
> 
> "John W. Holmes" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > I would like to know the best way to connect to SQL database(which
> located
> > on Microsoft SQL Server) from PHP(Located on Unix Server).
> 
> Maybe mssql_connect()??
> 
> www.php.net/mssql_connect
> 
> ---John W. Holmes...
> 
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
> 
> 
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc


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



[PHP-DB] RE: MySql Help needed

2003-03-31 Thread Adam Douglas
Are you sure you give access to this user from the machine to the database
server? Check IP address permissions and if the user has access to the
specific table and/or database in MySQL. Also check to make sure the
database server is setup to allow you access from your machine.. check the
MySQL and System log files they usually help to determine what went wrong.

> -Original Message-
> From: Sparky Kopetzky [mailto:[EMAIL PROTECTED]
> Sent: Saturday, March 29, 2003 9:12 PM
> To: [EMAIL PROTECTED]
> Subject: MySql Help needed
> 
> 
> Greetings!
> 
> I am building an application in PHP and am creating a global 
> $connect_id for MySql. I have MySql on a separate machine and 
> am using the connect like this:
> 
> $server = "development.myservermachine.net";
> $username = "myname";
> $password = "mypassword";
> $connect_id = mysql_connect($server, $username, $password);
> 
> All I get is 'Access denied for user '[EMAIL PROTECTED]' (Using 
> password:YES)
> 
> Now, I know I'm in the DNS server for my system, and the 
> username and password are correct as I checked the User table.
> 
> Any thoughts, ideas, etc. toward fixing this problem??
> 
> I'd appreciate any help provided.
> 
> Robin Kopetzky
> Black Mesa Computer/Internet Services
> 
> 
> 

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



Re: [PHP-DB] Gathering data from a database

2003-03-22 Thread Adam -
Hi,

   $select = "mysql_select_db ($database)"; << like Mike said you don't 
need to have this in " and no need for a var to be assigned...

  Then when you want to print out the data

print_r( $row );

you can use $row['table_row_name'];
:)
Adam
At 08:26 PM 3/22/2003 -0500, you wrote:
I have been having this problem for a while now, and I cant figure it out. 
the code is:

$host = "localhost";
$uname = "sniper";
$pass = "starcraft";
$database = "sha";
$tablename = "members";
$connect = mysql_connect ($host, $uname, $pass);
$select = "mysql_select_db ($database)";
$query = "SELECT * from $tablename";
$result = mysql_query ($query, $connect);

while ($row = mysql_fetch_array($result))
{
print_r( $row );
echo mysql_error();
}
?>
mysql has an error on line 19. Line 19 is while ($row = 
mysql_fetch_array($result)). What am I doing wrong?

Thanks for your help,
Mike


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


Re: [PHP-DB] Including Details in MySQL longer than 255 characters

2003-03-20 Thread Adam Venturella
Thanks,

I totally forgot about that type...
And thanks to everyone else who replied!

-a


"Mike Karthauser" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> on 20/3/03 6:11 pm, Adam Venturella at [EMAIL PROTECTED] wrote:
>
> > Anyway if someone could point me in the right direction I would be very
> > appreciative.
>
> Change your column type to TEXT rather than varchar(255)
>
> --
> Mike Karthauser
> Managing Director - Brightstorm Ltd
>
> Email   >> [EMAIL PROTECTED]
> Web >> http://www.brightstorm.co.uk
> Tel >> 0117 9426653 (office)
>07939 252144 (mobile)
>
> Snailmail   >> Unit 8, 14 King Square,
>Bristol BS2 8JJ
>



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



[PHP-DB] Including Details in MySQL longer than 255 characters

2003-03-20 Thread Adam Venturella
Ok So I have my Database/Tables all set up.  What I wanna know how to do /
find a tutorial on is how I might go about  including details longer than
255 characters that are referenced by a mysql query.  So basically I have
some thing like this on the inputs:

First:
Last:
Email:
Comments:

Now the comments Section, I basically want to type in whatever I want.
Since that could be larger than 255 characters how do I get mysql to
reference that chunck of text in a query.  I imagine the text will have to
be stored outside the DB and read in to the HTML at an appropriate time or
done like a message board or something. I would also like to keep it
searchable. So that I could do a search through the whole DB and keep
comments included in that search  well maybe do a drop down that
references the various fields to search and if you select comments you would
get a select like "select * from data where comments =$input"

Anyway if someone could point me in the right direction I would be very
appreciative.

Adam
[EMAIL PROTECTED]



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



RE: [PHP-DB] Addslashes (MSSQL)

2003-03-20 Thread Adam Voigt
Umm, how about using str_replace to replace the quotes for there ASCII
equivalent's,
and when you print them out in HTML they will be interpreted properly,
or you
could str_replace them back.

On Thu, 2003-03-20 at 11:23, Poon, Kelvin (Infomart) wrote:

Actually, that eliminated the error messages but it still hasn't fix
the
problem

I did what you saidbut now in my MSSQL table, the content column
has
somethign like thsi

"Step 1: blah blah balh
Step 2: blah balh balh \'Username\'"

so it included the slashes...I just learned that mSSQL doens;t
accept
slashes so is there any other way I can fix this problem?..I want
literally

step 1: balh bah balh
Step 2: balhb alhb alhb 'Username'

to be inserted to the table..please help 

thanks a lot by the way

-Original Message-
From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 20, 2003 11:06 AM
To: Poon, Kelvin (Infomart); [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Addslashes (MSSQL)


> where my $content value is osmethign like this.
>
> "Step 1: Access the homepage
> Step 2: type in your username under the field 'username' "
>
> and after the addslashes funciton there would be \ around the
'username'
> like this..
> \'username\'and now after running this program I got an error
message:
>
> Warning: MS SQL message: Line 14: Incorrect syntax near
'username'.
> (severity 15) in
d:\apache_docroots\internal.infomart.ca\infodesk\kb_add.php
> on line 119

I think you need to replace ' with '' in MSSQL (one single quote
replaced
with two single quotes)

$text = str_replace("'","''",$old_text);

---John Holmes...


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


-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc


[PHP-DB] Re: PHP script execution - display issue

2003-03-13 Thread Adam Royle
This is neither a PHP nor database question. This is client side. 
Anyway, a simple fact is that tables won't render until the whole table 
has been loaded into memory (ie. it won't show until it reaches the 
 tag). If you have your whole site inside one big table, then 
this is what is causing your problems. Unfortunately, sometimes this 
unavoidable. To make it run sequentially, you could do this, or use 
divs with absolute positioning. just a thought.

Adam

Hello,
I have a display problem with one of my sites.
Because there is an big amount of information in the pages, which is
extracted from database, using IE browser I see only the background of
the site, and then, after a time, the whole page.
My client has recently requested to make something to improve the site
speed and display time.
So because all the site is done using the classes, and the information
is extracted through them, I reduced the instruction numbers, and I
compacted as much as I could the classes. But I still have the display
problem using IE browser : I see the background, and just after that I
see the whole site.
I mention that the classes are included, and the class function is
called through $this_class->function($parameters); Not all the classes
used in the page are called In the beginning; and another mention is
that the site pages contains 4 sections. Top, left, middle, & right.
My question is:
Is there a way to display sequentially the site. After the background,
to display the first section (top), then left part, middle part and
right part after that ?
Again, the site loads like this : the background, then the whole page.
This doesn't matter if I use dial-up or T1.
My client saw, for example, that cnn or yahoo site loads sequentially.
Knowing that yahoo is done in php, I'm wondering how they did it.
Thanks
Petre Nicoara


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


[PHP-DB] Re: adding to an array variable using a loop...?

2003-03-10 Thread Adam Royle
I assume the field 'date' in your database is a date field, and in your code
you are trying to do a date + 1, but you are not specifying *what* you are
adding to the date (ie. 1 day, 1 week, 1 month), therefore the whole
variable is being replaced (with a 1). Try looking at the various date
functions (or string functions) to work out how to do this. Depending on how
your date is setup you would use strtotime() or mktime() (or both).

Adam

--- Original Message ---
I want to create an array from results returned from a mysql query. I want
it to go through each row in the returned result, and if the variable in the
array staff exists add 1 to the total, if it doesnt exist, set it as one and
carry on.

But when i run this and do var_dump, it just returns "1" in the array for
every date.

I don't think my logic for this is correct, please help.
Cheers,
Dave.
==
$query = "SELECT * FROM Rota WHERE date >= $start and date <= ($start +
INTERVAL 6 DAY) ";
 $result = mysql_query($query);
 while ($row = mysql_fetch_array($result)){
  $x = 1;
  $date = $row['Date'];
  if ( isset($staff[$date] ) ){
   $staff[$date] = $staff[$date] + $x ;
  }
  else{
   $staff[$date] = $x ;
  }

 }


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



[PHP-DB] Re: Dynamic Variable names

2003-03-09 Thread Adam Royle
It's probably better to use arrays.

$tips[0] = "value";
$tips[1] = "value";
$tips[2] = "value";
Although, if you REALLY want dynamic variable names.

$i = 1;
$varname = 'tips_'.$i;
$$varname = "value";
this will make a variable like below:

$tips_1 = "value";

But like I said before, it's better to use arrays - they are much more 
flexible (and PHP arrays are especially cool).

http://www.php.net/manual/en/ref.array.php

adam

Just a quick question about dynamic variables

would like to end up with a variable called
$tips_1
$tips_2
...
$tips_n
where "n" is the value of the variable $sid

i have tried

$tips . '$sid';

and other variants, but i can't get one that doesn't return a parse 
error or T_VARIABLE error.


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


  1   2   3   4   >