Re: [PHP-DB] SQL injection

2015-06-21 Thread Mark Murphy
But what does your application do when it gets an invalid SQL statement?
Maybe it is telling the attacker something important about your database so
that they can compromise it with the appropriate injection.

On 2:36PM, Sun, Jun 21, 2015 Lester Caine  wrote:

> On 21/06/15 18:55, Richard wrote:
> >>> OK - this had no chance of success since publish_date_desc is
> >>> >> processed using the _desc ( or _asc ) and any invalid data
> >>> >> stripped
> >>> >>
> >>> >>
> >>> >> &sort_mode=publish_date_desc%20or%20(1,2)=(select*from(select%20n
> >>> >> ame_const(CHAR(111,108,111,108,111,115,104,101,114),1),name_const
> >>> >> (CHAR(111,108,111,108,111,115,104,101,114),1))a)%20--%20and%201%3
> >>> >> D1
> >>> >>
> >>> >> The question is more of interest in just what it was trying to
> >>> >> achieve? I presume hack MySQL? So Firebird would barf anyway, but
> >>> >> just trying to something that has generated some several hundred
> >>> >> error log entries in the last two days ...
> >>> >>
> >>> >> Lester Caine - G8HFL
> >>> >>
> >>> >>
> >> > The sub-query is invalid, if valid it would've been equivalent to:
> >> > or (1,2)=(select*from(select 'b2xvbG9zaGVy' as 1, 'b2xvbG9zaGVy'
> >> > as 1))a) -- and 1=1
> >> >
> >> > Seems non threatening to me.
> > Regardless of whether this specific attack could have resulted in
> > harmful sql injection or not, user input should be sanitized so that
> > things never get this far.
>
> ? That is taken direct off the URL! Sod all I can do to prevent it, but
> I was simply asking if I was missing something as it did not make any
> sense? It got no further than the error log but as I said several
> hundred attempts via a few different filter options all of which
> suggested something that was expected to work if the site was a
> vulnerable mysql powered site ... which it's not.
>
> Seems that is just a pointless URL rather than some recently identified
> potential vulnerability?
>
> --
> Lester Caine - G8HFL
> -
> Contact - http://lsces.co.uk/wiki/?page=contact
> L.S.Caine Electronic Services - http://lsces.co.uk
> EnquirySolve - http://enquirysolve.com/
> Model Engineers Digital Workshop - http://medw.co.uk
> Rainbow Digital Media - http://rainbowdigitalmedia.co.uk
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --

Sent from my android


Re: [PHP-DB] Re: Code Security

2015-02-18 Thread Mark Murphy
@Taco, Read back through the whole thread and you will understand. Ethan
just can't do what he wants to with PHP.
On Feb 18, 2015 9:59 AM, "Taco Mathijs Hillenaar-Meerveld" <
tm.hillen...@gmail.com> wrote:

> Sorry if i misread and put my reply in a wrong context.
> but from how i read this question it is all about preventing a user to open
> a terminal window.
>
> if Mr. Nice is logged in then i assume he has all rights as the topic
> starter is afraid Mr. ugly can look at his code.
>
> as far as i know it is not common practice to work direct on a server and
> have all rights and allow other people using that computer when connected
> to the specific server.
> Ethan also pointed out that he made a POS (Point of Sale) program to work
> in that store. there are 2 account types: 1>admin  2>worker.
>
> the worker should not have any rights and the admin account should only be
> able to change/edit things within that program.
> 
>
> i don't see why anyone (the admin included) would need to have access on
> the stand alone server apart for maintainance duties to keep it all up and
> running.
> the server needs to be locked in a server room or another place that will
> fit. but definately locked.
>
> if someone can get on that server through a terminal it will mean something
> has gone horrible wrong.
>
> i am not sure if Ethan is trolling though. but if i understand his question
> right and it's a honest question, it sounds kind of weird to me.
>
> when i get an order to install a server, my first question would be like:
> - who is going to use it?
> - who has access to it?
> - who need to have access to it?
> - where will this server be placed? (server room, datacenter, store).
>
> once the server is installed i have a root account, an admin account with
> certain rights and i have made a couple of 'administrator groups' . the
> programs like apache are in this group aswell. but this has nothing to do
> with the administrator account from the POS.
>
> so are we here talking about securing the code of the POS and its content
> or are we talking about the basics of securing a Linux server?
> if it is the latter, the Topic starter better read about how to secure his
> server. btw, i'm wondering what his question has got to do with PHP and
> databases :-/
>
> in addition:
>
> *as soon we talk about 'looking at code' and 'user is logged in as an
> administrator with all rights to delete content' you will make ANY
> administrator*
> *nervous :) i know a couple of admins, trust me, they are paranoid and
> won't trust anyone near their machines. not to speak about getting access
> to a server!*
>
>
> On Fri, Feb 13, 2015 at 6:28 PM, Guru  wrote:
>
> > Put a redirect code in www folder to your index page.
> > On Feb 13, 2015 10:55 PM, "Karl DeSaulniers" 
> wrote:
> >
> > > Set up a password or a salt that Mr. Nice has to call you to get and
> > > expires on logout.
> > >
> > > Lol
> > >
> > > Best,
> > > Karl
> > >
> > >
> > > Sent from losPhone
> > >
> > > > On Feb 13, 2015, at 8:47 AM, erosenb...@hygeiabiomedical.com wrote:
> > > >
> > > >
> > > > Ethan,
> > > > It seems like you're looking for a programmatic solution to a
> physical
> > > > security problem. In the end, your most viable solution will likely
> > > > be to train Mr. Goodguy to remove the key the same way he needs to
> > > > remember his ATM card after a withdrawal. I've seen programmatic
> > > > work-arounds to solve similar issues, but they have always ended up
> > > > being significantly arduous for the end users...
> > > > Respectfully,
> > > > Joshua D. Arneson
> > > > -Original Message-From: Ethan Rosenberg
> > > > [mailto:erosenb...@hygeiabiomedical.com] Sent: Friday, February 13,
> > > > 2015 9:12 AMTo: php...@lists.php.netSubject: Re: [PHP-DB] Code
> > > > Security
> > > > On 02/13/2015 02:58 AM, Karl DeSaulniers wrote:> Prevent THIS from
> > > > ever happening.>> On Feb 12, 2015, at 11:03 PM, Ethan Rosenberg
> > > > wrote:>>> He asks Mr.[naive]Nice if he could look at the computer
> > > > while it is logged in.>>> Otherwise, I would say an external key that
> > > > has a salt stored on it that the user has to insert in the computer
> > > > before the system can be accessed.> Like an access key card.
> Immediate
> > > > shut down when tampered and/or removed.>> Just a stab in the dark
> > > > though.>> Best,>> Karl DeSaulniers> Design Drumm
> > > > Karl -
> > > > Thanks.
> > > > The key is already plugged in. Mr [Naive] Nice is using the computer,
> > > > and is logged in. Mr. Ugly just want to "look at" the computer.
> > > > Ethan--
> > > > Joshua -
> > > > My apologies for an HTML message.  That is all I have at work.
> > > >
> > > > How about this -
> > > > Block access to Ctrl-Alt-Del for Mr. Nice.
> > > > TIA
> > > > Ethan
> > > >
> > > >
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
>


[PHP-DB] Error fetching a second row from a result set (mysql)

2014-11-14 Thread Mark Murphy
Windows 7 SP1; php 5.3.29; Apache 2.4.9; MySQL 5.6.17

$isr = mysql_unbuffered_query ( $is, $link_id );
if ($isr === false) {
...
}
if ($isr) {
$booking_id = '';
while ( $isv = mysql_fetch_assoc ( $isr ) ) {
$result ['id'] = $isv ['id'];
...

Second time through this loop I get the following error:

Warning: mysql_fetch_assoc(): 40 is not a valid MySQL result resource in
C:\Users\Mark Murphy\whiworkspace\spur\cron\import_bookings.php on line 89

Problem is that for the resource, the type is changed to Unknown by a
different mysql_query within the loop. Any idea what will cause this?

When the statement works, the debug value for $isr is resource id='40'
type='mysql result'.
When the statement fails, the debug value if resource id='40' type='Unknown'


Re: [PHP-DB] Re: PHP and table/view names with '$'

2009-04-23 Thread Mark Casson
i was absolutely convinced that i tried to escape the $ and it hadn't worked 
and got side tracked looking at other options . . . but yes, that indeed 
works perfectly.

Thanks a lot!


""Yves Sucaet""  wrote in message 
news:007d01c9c404$97d4d1b0$0402a...@rincewind...
> Switch back to double quotes? :-)
>
> $stmt = OCIParse($conn, "SELECT * FROM v\$sql WHERE 
> INSTR(SQL_TEXT,'something')>0");
>
> - Original Message - 
> From: "Mark Casson" 
> To: 
> Sent: Thursday, April 23, 2009 6:10 AM
> Subject: [PHP-DB] Re: PHP and table/view names with '$'
>
>
>> Hi,
>>
>> Of course, the next problem is that i want to specify a line to find:
>>
>> $stmt = OCIParse($conn, 'SELECT * FROM v$sql WHERE 
>> INSTR(SQL_TEXT,'something')>0');
>>
>> and i seem to have to use single quotes in the INSTR function.
>>
>> Is there an alternative way to deal with that?
>>
>> Thanks again
>>
>> Mark
>>
>> ""Mark Casson""  wrote in message 
>> news:89.4e.33545.c2d30...@pb1.pair.com...
>>> Hi,
>>>
>>> I am trying to access some of the v$ views using php on iis, with admin 
>>> privileges.
>>>
>>> However, using:
>>>
>>> $stmt = OCIParse($conn, "SELECT * FROM v$sql");
>>>
>>> gives me this error:
>>>
>>> PHP Notice: undefined variable: sql . . .
>>>
>>> Is there a way around this?
>>>
>>> Thanks
>>>
>>> Mark
>>>
>>
>>
>>
>> -- 
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
> 



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



Re: [PHP-DB] Re: PHP and table/view names with '$'

2009-04-23 Thread Mark Casson
Noted!

:)

""Ford, Mike""  wrote in message 
news:93ed589e60ba254f97435fe6c97f2c6702b92...@leedsmet-exch1.leedsmet.ac.uk...
On 23 April 2009 11:36, Mark Casson advised:

> Hi Guys,
>
> Thanks to you both - you are spot on!
>
> Shame this is not better documented somewhere.

I don't know how much better documented it can be than at
http://php.net/language.types.string ... ;)

Cheers!

Mike

 --
Mike Ford,  Electronic Information Developer,
C507, Leeds Metropolitan University, Civic Quarter Campus,
Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom
Email: m.f...@leedsmet.ac.uk
Tel: +44 113 812 4730


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm 



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



[PHP-DB] Re: PHP and table/view names with '$'

2009-04-23 Thread Mark Casson
Hi,

Of course, the next problem is that i want to specify a line to find:

$stmt = OCIParse($conn, 'SELECT * FROM v$sql WHERE 
INSTR(SQL_TEXT,'something')>0');

and i seem to have to use single quotes in the INSTR function.

Is there an alternative way to deal with that?

Thanks again

Mark

""Mark Casson""  wrote in message 
news:89.4e.33545.c2d30...@pb1.pair.com...
> Hi,
>
> I am trying to access some of the v$ views using php on iis, with admin 
> privileges.
>
> However, using:
>
> $stmt = OCIParse($conn, "SELECT * FROM v$sql");
>
> gives me this error:
>
> PHP Notice: undefined variable: sql . . .
>
> Is there a way around this?
>
> Thanks
>
> Mark
> 



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



Re: [PHP-DB] PHP and table/view names with '$'

2009-04-23 Thread Mark Casson
Hi,

For reference, this didn't work, but just using single quotes instead of 
double quotes did.

Mark

""Yves Sucaet""  wrote in message 
news:006201c9c3ff$4896f7e0$0402a...@rincewind...
> What if you use back-quotes `` around the table/view name?
> $stmt = OCIParse($conn, "SELECT * FROM `v$sql`");
>
>
> - Original Message - 
> From: 
> To: "Mark Casson" ; 
> Sent: Thursday, April 23, 2009 5:25 AM
> Subject: RE: [PHP-DB] PHP and table/view names with '$'
>
>
> I find that using single quotes rather than double quotes prevents
> variable substitution.
>
> I don't know if this is an undocumented feature, as the documentation
> says that both have the same functionality.
>
> Regards, Neil
>
> -Original Message-
> From: Mark Casson [mailto:confu...@icube.co.uk] Sent: 23 April 2009 11:04
> To: php-db@lists.php.net
> Subject: [PHP-DB] PHP and table/view names with '$'
>
> Hi,
>
> I am trying to access some of the v$ views using php on iis, with admin 
> privileges.
>
> However, using:
>
> $stmt = OCIParse($conn, "SELECT * FROM v$sql");
>
> gives me this error:
>
> PHP Notice: undefined variable: sql . . .
>
> Is there a way around this?
>
> Thanks
>
> Mark
>
>
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> 



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



[PHP-DB] Re: PHP and table/view names with '$'

2009-04-23 Thread Mark Casson
Hi Guys,

Thanks to you both - you are spot on!

Shame this is not better documented somewhere.

Mark

""Mark Casson""  wrote in message 
news:89.4e.33545.c2d30...@pb1.pair.com...
> Hi,
>
> I am trying to access some of the v$ views using php on iis, with admin 
> privileges.
>
> However, using:
>
> $stmt = OCIParse($conn, "SELECT * FROM v$sql");
>
> gives me this error:
>
> PHP Notice: undefined variable: sql . . .
>
> Is there a way around this?
>
> Thanks
>
> Mark
> 



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



[PHP-DB] PHP and table/view names with '$'

2009-04-23 Thread Mark Casson
Hi,

I am trying to access some of the v$ views using php on iis, with admin 
privileges.

However, using:

$stmt = OCIParse($conn, "SELECT * FROM v$sql");

gives me this error:

PHP Notice: undefined variable: sql . . .

Is there a way around this?

Thanks

Mark 



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



[PHP-DB] LDAP: get list of ou

2009-04-20 Thread Mark Zimmermann
Hello,

i am working  with a LDAP tree like this.

o=tree
ou=de
user1
user2
user3
ou=en
ou=ignore.me
ou=us

I wish to get a list of all 'ou' entries and one of their attributes, not the 
users one.

I have no idea, how to realize this? Maybe, anyone can help me?

ldap_search($ldap,"o=tree", "ou=de");
works fine and i get a list of all 'de' users.

Thanks!

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



Re: [PHP-DB] Php, Oracle on Mac, with strange behaviour

2009-03-16 Thread Mark Halling-Brown

Grant, thank you very much. You are a life saver. This worked perfectly.

Thanks again
Mark



On 16 Mar 2009, at 11:53 AM, Grant Croker wrote:


Hi Mark,

you are right /System/Library/LaunchDaemons/org.apache.httpd.plist  
will not work in your case, it's for the Mac OS X supplied Apache.  
In your case you can edit /usr/local/apache2/bin/apachectl adding  
the following:


DYLD_LIBRARY_PATH=/opt/oracle/instanceclient
LD_LIBRARY_PATH=/opt/oracle/instanceclient
ORACLE_BASE=/opt/oracle/instanceclient
ORACLE_HOME=/opt/oracle/instanceclient
export DYLD_LIBRARY_PATH LD_LIBRARY_PATH ORACLE_BASE ORACLE_HOME

(note: As Chris Jones mentioned LD_LIBRARY_PATH is not used on OS X,  
however there is no harm in having it set)


Place the above some where near the top of apachectl, I cannot tell  
you exactly since fink will not install and MacPorts does not build  
SQLite3. Restart apache and you should see the correct values in  
getenv() or phpinfo().


regards

grant


On/El 16/03/09 12:13, Mark Halling-Brown wrote/escribió:

Hi Grant,

Thanks to your instructions, I am making a bit of progress.
I have entered the PassEnv commands into the https.conf.:
SetEnv DYLD_LIBRARY_PATH /opt/oracle/instanceclient
SetEnv LD_LIBRARY_PATH /opt/oracle/instanceclient
PassEnv DYLD_LIBRARY_PATH
PassEnv LD_LIBRARY_PATH

It now seems that this variable is passed through correctly, but it  
is not as I set it. Instead it states:

DYLD_LIBRARY_PATH: /usr/local/apache2/lib:

I restart apache as root user (sudo /usr/local/apache2/bin/ 
apachectl restart) and it complains that:
[Mon Mar 16 11:08:53 2009] [warn] PassEnv variable LD_LIBRARY_PATH  
was undefined


So I am guessing that root has not picked up any of the environment  
variables that I have set in various places around my system. I  
have put DYLD_LIBRARY_PATH in /etc/bashrc ~/.bash_profileetc, but I  
still seems root doesn't know about them.


Have you any idea where I need to set these variables (Is there a  
root home directory I can edit a bash_profile or something?)


I did edit the /System/Library/LaunchDaemons/org.apache.httpd.plist  
file, but the apache I am using was compiled from source, so I fear  
it wont work list that plist?


Thanks for all your help
Mark




--
Grant Croker - Ingres PHP and Ruby maintainer
http://blogs.planetingres.org/grant
It was so much easier to blame it on Them. It was bleakly depressing  
to think that They were Us. If it was Them, then nothing was  
anyone's fault. If it was us, what did that make Me? After all, I'm  
one of Us. I must be. I've certainly never thought of myself as one  
of Them. No one ever thinks of themselves as one of Them. We're  
always one of Us. It's Them that do the bad things.

   -- Terry Pratchett, Jingo



_

Mark Halling-Brown
Higher Scientific Officer,
Computational Biology & Chemogenomics, Cancer Therapeutics,
The Institute of Cancer Research
15 Cotswold Road
Belmont, Surrey SM2 5NG, UK
Tel: (+44)-20-8722-4300 (ext: 4659)
Email: mhallingbr...@icr.ac.uk
Web: http://www.markyhb.co.uk

"A cynic is what an idealist calls a realist"


The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company 
Limited by Guarantee, Registered in England under Company No. 534147 with its 
Registered Office at 123 Old Brompton Road, London SW7 3RP.

This e-mail message is confidential and for use by the addressee only.  If the 
message is received by anyone other than the addressee, please return the 
message to the sender by replying to it and then delete the message from your 
computer and network.

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



Re: [PHP-DB] Php, Oracle on Mac, with strange behaviour

2009-03-16 Thread Mark Halling-Brown

Hi Grant,

Thanks to your instructions, I am making a bit of progress.
I have entered the PassEnv commands into the https.conf.:
SetEnv DYLD_LIBRARY_PATH /opt/oracle/instanceclient
SetEnv LD_LIBRARY_PATH /opt/oracle/instanceclient
PassEnv DYLD_LIBRARY_PATH
PassEnv LD_LIBRARY_PATH

It now seems that this variable is passed through correctly, but it is  
not as I set it. Instead it states:

DYLD_LIBRARY_PATH: /usr/local/apache2/lib:

I restart apache as root user (sudo /usr/local/apache2/bin/apachectl  
restart) and it complains that:
[Mon Mar 16 11:08:53 2009] [warn] PassEnv variable LD_LIBRARY_PATH was  
undefined


 So I am guessing that root has not picked up any of the environment  
variables that I have set in various places around my system. I have  
put DYLD_LIBRARY_PATH in /etc/bashrc ~/.bash_profileetc, but I still  
seems root doesn't know about them.


Have you any idea where I need to set these variables (Is there a root  
home directory I can edit a .bash_profile or something?)


I did edit the /System/Library/LaunchDaemons/org.apache.httpd.plist  
file, but the apache I am using was compiled from source, so I fear it  
wont work list that plist?


Thanks for all your help
Mark


On 16 Mar 2009, at 10:27 AM, Grant Croker wrote:


On/El 16/03/09 09:23, chris smith wrote/escribió:

On Mon, Mar 16, 2009 at 6:51 PM, Mark Halling-Brown
  wrote:


Thanks for your replies.
In my desperation, I declared those environment variables in as  
many places
as I could think of. The script (Although I know I shouldnt),  
php.ini and

also the apache httpd.conf file:

SetEnv ORACLE_HOME /opt/oracle/instanceclient
SetEnv DYLD_LIBRARY_PATH /opt/oracle/instanceclient
SetEnv LD_LIBRARY_PATH /opt/oracle/instanceclient
SetEnv ORACLE_BASE /opt/oracle/instanceclient

But given that it works on the command line, but not through the  
browser, I

think that the environment variables must be set correctly.



Did you restart apache after doing this?

The env variables are set correctly for your user, but not apache's
(which is the problem).

  Does the mac have an /etc/environment file? That should cover all  
users.


Unfortunately not although with the stock/supplied Apache web server  
there is a plist file you can edit to add environment settings. Edit  
|/System/Library/LaunchDaemons/org.apache.httpd.plist, adding the  
relevant environment variable key/value information:|



http://www.apple.com/DTDs/PropertyList-1.0.dtd 
">



EnvironmentVariables

DYLD_LIBRARY_PATH
path goes here
ORACLE_HOME
path goes here
ORACLE_BASE
path goes here

Label
org.apache.httpd
   .
   .
   .




Then you use PassEnv in Apache to pass these values through to PHP.  
The SetEnv directive in Apache is not the same as "setenv" or  
"export" in csh/bash/etc. Apache maintains its own symbol table for  
environment variables. Unless the OCI8 extension calls apache_getenv  
those declarations will have no effect.


regards

grant

--
Grant Croker - Ingres PHP and Ruby maintainer
http://blogs.planetingres.org/grant
Generally, old media don't die. They just have to grow old gracefully.
Guess what, we still have stone masons. They haven't been the primary
purveyors of the written word for a while now of course, but they  
still

have a role because you wouldn't want a TV screen on your headstone.



_

Mark Halling-Brown
Higher Scientific Officer,
Computational Biology & Chemogenomics, Cancer Therapeutics,
The Institute of Cancer Research
15 Cotswold Road
Belmont, Surrey SM2 5NG, UK
Tel: (+44)-20-8722-4300 (ext: 4659)
Email: mhallingbr...@icr.ac.uk
Web: http://www.markyhb.co.uk

"A cynic is what an idealist calls a realist"


The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company 
Limited by Guarantee, Registered in England under Company No. 534147 with its 
Registered Office at 123 Old Brompton Road, London SW7 3RP.

This e-mail message is confidential and for use by the addressee only.  If the 
message is received by anyone other than the addressee, please return the 
message to the sender by replying to it and then delete the message from your 
computer and network.

Re: [PHP-DB] Php, Oracle on Mac, with strange behaviour

2009-03-16 Thread Mark Halling-Brown


Did you restart apache after doing this?


Yes, many times



The env variables are set correctly for your user, but not apache's
(which is the problem).


Indeed, I have removed the putenv declarations in the php script and  
inserted this:

echo("Using LD_LIBRARY_PATH: ". getenv("LD_LIBRARY_PATH"));
echo ", ORACLE_HOME=".getenv("ORACLE_HOME");
echo(", DYLD_LIBRARY_PATH: ". getenv("DYLD_LIBRARY_PATH"));

And it prints to the screen (browser) correctly:
Using LD_LIBRARY_PATH: /opt/oracle/instanceclient, ORACLE_HOME=/opt/ 
oracle/instanceclient, DYLD_LIBRARY_PATH: /opt/oracle/instanceclient


For completeness, I have also put the variables is /etc/profile, /etc/ 
bash_profile etc


So it seems that the variables are set up for sure (unless this is  
just for php, but I do have these variables in the apache httpd.conf)


This is a puzzler
Cheers
Mark





Does the mac have an /etc/environment file? That should cover all  
users.


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


_

Mark Halling-Brown
Higher Scientific Officer,
Computational Biology & Chemogenomics, Cancer Therapeutics,
The Institute of Cancer Research
15 Cotswold Road
Belmont, Surrey SM2 5NG, UK
Tel: (+44)-20-8722-4300 (ext: 4659)
Email: mhallingbr...@icr.ac.uk
Web: http://www.markyhb.co.uk

"A cynic is what an idealist calls a realist"



The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company 
Limited by Guarantee, Registered in England under Company No. 534147 with its 
Registered Office at 123 Old Brompton Road, London SW7 3RP.

This e-mail message is confidential and for use by the addressee only.  If the 
message is received by anyone other than the addressee, please return the 
message to the sender by replying to it and then delete the message from your 
computer and network.

Re: [PHP-DB] Php, Oracle on Mac, with strange behaviour

2009-03-16 Thread Mark Halling-Brown

Thanks for your replies.
In my desperation, I declared those environment variables in as many  
places as I could think of. The script (Although I know I shouldnt),  
php.ini and also the apache httpd.conf file:


SetEnv ORACLE_HOME /opt/oracle/instanceclient
SetEnv DYLD_LIBRARY_PATH /opt/oracle/instanceclient
SetEnv LD_LIBRARY_PATH /opt/oracle/instanceclient
SetEnv ORACLE_BASE /opt/oracle/instanceclient

But given that it works on the command line, but not through the  
browser, I think that the environment variables must be set correctly.


Cheers
Mark


On 16 Mar 2009, at 1:26 AM, Christopher Jones wrote:




Chris wrote:
   Warning: ocilogon() [function.ocilogon]: OCIEnvNlsCreate()  
failed. There is something wrong with your system - please check  
that LD_LIBRARY_PATH includes the directory with Oracle  
Instant Client libraries in/Library/WebServer/Documents/oracle.php  
on line 25   Oracle Connect Error



putenv("LD_LIBRARY_PATH=/opt/oracle/instanceclient");
I'd guess you probably need this in apache's start up script, not  
in php (where that is on a mac setup I have no idea).

You could also try it in your virtual host:
http://httpd.apache.org/docs/2.2/mod/mod_env.html#setenv
SetEnv LD_LIBRARY_PATH /opt/oracle/instanceclient


I agree that using putenv() for Environment variables in scripts is  
bad.

On Mac, I think you need DYLD_LIBRARY_PATH instead of LD_LIBRARY_PATH.
See http://www.oracle.com/technology/pub/articles/bibbs-php-leopard.html

Chris

--
Email: christopher.jo...@oracle.com  Tel: +1 650 506 8630
Twitter:  http://twitter.com/ghrdFree PHP Book: http://tinyurl.com/UGPOM


_____

Mark Halling-Brown
Higher Scientific Officer,
Computational Biology & Chemogenomics, Cancer Therapeutics,
The Institute of Cancer Research
15 Cotswold Road
Belmont, Surrey SM2 5NG, UK
Tel: (+44)-20-8722-4300 (ext: 4659)
Email: mhallingbr...@icr.ac.uk
Web: http://www.markyhb.co.uk

"A cynic is what an idealist calls a realist"


The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company 
Limited by Guarantee, Registered in England under Company No. 534147 with its 
Registered Office at 123 Old Brompton Road, London SW7 3RP.

This e-mail message is confidential and for use by the addressee only.  If the 
message is received by anyone other than the addressee, please return the 
message to the sender by replying to it and then delete the message from your 
computer and network.

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



[PHP-DB] Php, Oracle on Mac, with strange behaviour

2009-03-13 Thread Mark Halling-Brown

Dear List,

I have a puzzler, which I can't seem to fix.
To summarise, I have installed PHP, apache from source and the oracle  
client (details below). I then construct a simple PHP script to  
connect to my oracle database.
When I run the script from the command line, it works perfectly, and  
returns rows from the database.


bash$ php oracle.php
	Using : /opt/oracle/instanceclient, ORACLE_HOME=/opt/oracle/ 
instanceclient

Successfully connected to Oracle.
	7171421.4983td>421.4983C23 H27 N5 O3C23 H27 N5 O3


Bt, when I try to view this through a browser, it returns this  
error:


	Using : /opt/oracle/instanceclient, ORACLE_HOME=/opt/oracle/ 
instanceclient
	Warning: ocilogon() [function.ocilogon]: OCIEnvNlsCreate() failed.  
There is something wrong with your system - please check that  
LD_LIBRARY_PATH includes the 	directory with Oracle Instant Client  
libraries in/Library/WebServer/Documents/oracle.php on line 25	

Oracle Connect Error

Here are the details of my installation and a few things I have tried:

Apache:
Installed apache (httpd-2.2.11) with the following configuration: -- 
prefix=/usr/local/apache --enable-module=so

No Errors

PHP
Installed PHP (php-5.2.9) with the following configuration:
--with-apxs2 -enable-cli  --with-mysql=/usr/local/mysql/ --exec- 
prefix=/usr --localstatedir=/var --libexecdir=/System/Library/Apache
/Modules  --enable-shared=max  --with-gd=/usr/local  --with-zlib -- 
with-oci8=instantclient,/opt/oracle/instanceclient -enable-layout
=Darwin -enable-mods-shared=all --with-apxs2=/usr/local/apache2/bin/ 
apxs --with-config-file-path=/usr/local/apache2/conf --enable-si

gchild
No errors

Oracle Client
Installed Basic + all others in /opt/oracle/instanceclient
No errors

Oracle (Version 11g) is installed on a different server

I will paste the PHP script I am using at the bottom of the mail.
Now, as I said, it is working fine through the command line, so  
everything is setup fine, so I figure it must be a permissions problem.
Hence, I chmod -R 755 $ORACLE_HOME and have tried running apache as  
lots of different users, but to no avail


Thanks in advance
Mark

# PHP SCRIPT #
 (HOST=)(PORT=1521) ### I have hidden this for  
security

   )
   (CONNECT_DATA=(SERVER=DEDICATED)(SID=orcl) 
(SERVICE_NAME=orcl))

 )";

if ($c = OCILogon($username,$passwd,$db)) {
echo "Successfully connected to Oracle.n";
$s = OCIParse($c, "select * from COMPOUNDS WHERE rownum=1");
OCIExecute($s, OCI_DEFAULT);
print '';
while ($row = oci_fetch_array($s, OCI_RETURN_NULLS)) {
print '';
foreach ($row as $item) {
print ''.($item? 
htmlentities($item):' ').'';

}
print '';
}
OCILogoff($c);
} else {
$err = OCIError();
echo "Oracle Connect Error " . $err[text]. "".  
$err[message];

}
echo("\n");

# END #
_

Mark Halling-Brown
Higher Scientific Officer,
Computational Biology & Chemogenomics, Cancer Therapeutics,
The Institute of Cancer Research
15 Cotswold Road
Belmont, Surrey SM2 5NG, UK
Tel: (+44)-20-8722-4300 (ext: 4659)
Email: mhallingbr...@icr.ac.uk
Web: http://www.markyhb.co.uk

"A cynic is what an idealist calls a realist"


The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company 
Limited by Guarantee, Registered in England under Company No. 534147 with its 
Registered Office at 123 Old Brompton Road, London SW7 3RP.

This e-mail message is confidential and for use by the addressee only.  If the 
message is received by anyone other than the addressee, please return the 
message to the sender by replying to it and then delete the message from your 
computer and network.

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



[PHP-DB] Re: [PHP] Re: [PHP-DB] Re: MySQL Identifying worst-performing codes

2007-11-09 Thread Mark Summers
There may be something useful here...

http://forge.mysql.com/

chris smith wrote:
> On Nov 9, 2007 1:18 AM, Colin Guthrie <[EMAIL PROTECTED]> wrote:
>   
>> Lasitha Alawatta wrote:
>> 
>>> There is  a tool call "idera" (SQL diagnostic manager). Basically it is
>>> a performance monitoring and diagnostics tool.
>>>
>>> It has a feature;
>>> Identifying of worst-performing codes –
>>>
>>> Identifies performance bottlenecks such as the worst-performing stored
>>> procedures, long-running queries, most frequently run queries, SQL
>>> Statements and SQL batches
>>>
>>> http://www.idera.com/Products/SQLdm/Features.aspx
>>>
>>>
>>> I'm looking for a same like tool for MySQL. Is anyone have any  ideas.
>>>   
>> I know this is OT for this list but.
>>
>> In addition to the slow query logging I mentioned before (which you
>> seemed to appreciate :)), I've just stumbled across this:
>> http://rackerhacker.com/mysqltuner/
>> 
>
> http://jeremy.zawodny.com/mysql/mytop/ might come in handy too.
>
>   

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



[PHP-DB] Executing a query in the future

2007-09-13 Thread Mark Bomgardner
I am looking for a way in PHP to execute a query at some point in the
future.  Here is my example;  I am writing a page to checkout laptop
computers to instructors.  I want the person that checks out the laptop to
receive an email when the laptop is close to being to, but I want this to be
automated.  I don't want to have to pull up a page everyday to run the
query.  Is there something that can run in the background  that can run a
page at varying intervals?

markb


[PHP-DB] Connection to MySQL from PHP 4 with SSL enabled by default?

2007-07-23 Thread Mark B.

Hi,

I would like to know if there is any setting that allows to connect to mysql
from php using SSL by default. I know that there is a flag MYSQL_CLIENT_SSL
in mysql_connect, however, I am trying to force PHP apps which I did *not*
wrote to transparently connect to mysql using SSL without having to change
the source code. 

I have no root access to the computer running Apache or MySQL so I cannot
set any tunnel between them. My current configuration is:

- PHP 4.3
- Mysql 4.1.20
- GNU/Linux 2.6.9-42.0.2.ELsmp
- Apache 1.3.22

Ideally, there could be a setting somewhere in php.ini, httpd.conf or
somewhere else that by default makes all connections to mysql go though SSL.
Can anyone help me?

Thanks in advance!
-- 
View this message in context: 
http://www.nabble.com/Connection-to-MySQL-from-PHP-4-with-SSL-enabled-by-default--tf4132847.html#a11754055
Sent from the Php - Database mailing list archive at Nabble.com.

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



Re: [PHP-DB] array field type

2007-03-06 Thread Mark
Sancar Saran wrote:

> Thanks for all those replies. It seems there was no easy solution (and or
> serializing was better solution) for us.
> 
> Our arrays contains lots of things.. XML may not fit because content of
> array may broke xml structure.
> 

Before you give up, take a look at the XMLDBX PHP extension at
http://www.mohawksoft.org

It uses XML and works really well.

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



[PHP-DB] Do while loop inside of mail()

2006-07-05 Thread Mark Bomgardner

MySQL 4.1/PHP 4.2

I am trying to generate a email to send to people with a list of events 
happening through out the month.


I am pulling the email addresses from the database with no problem, but 
when I put the list of events inside of the mail(), it barks at the do 
while statment.


Here is the do while code:

   $message='
 
   Project Number 


   Start Date
   Class
   Location
 
Line 28  'do { .'

   
 class="style8">'.$row_Recordset1['pnumber'].'   
 '.date("m/d/Y", 
strtotime($row_Recordset1['Sdate'])).'

 '.$row_Recordset1['title'].'
 '.$row_Recordset1['location'].'
 '. while } $row_Recordset1 = 
mysql_fetch_assoc($Recordset1)).'';


And the server response
*Parse error*: parse error in */home/Data/email/test.php* on line *28*

Line 28 is the start of the do while loop

markb

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



[PHP-DB] Converting to Decimal

2006-06-28 Thread Mark Bomgardner
I am query a database and pulling some decimal values out of the table, 
but when I display whole numbers in php, it drops the decimal places.
It takes a value of 12.00 in the database and makes it 12, where I need 
12.00.  I am having trouble finding ways to "cast" this value.





markb

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



Re: [PHP-DB] Generating forms and form elements

2006-06-20 Thread Mark Fellowes

Micah, Thanks for the reply.  I didn't see it earlier.  Also my apologies for 
the vagueness but right now things are somewhat vauge.  
Let me try and explain better:

To start I'll paint a visual to explain it better.  Ultimately I know this will 
require additional tables (will get to that in a moment)

When the page loads, there is going to be a "palette" area where form fields of 
various types will be sitting.  They will not be in a form.  The form will sit 
in another part of the page in it's own div.  So to start the table all that 
should be generated into that palette area will be the form elements (selects, 
checkboxes, radio buttons, etc).  I'm thinking php will be used to pull the 
markup out of the table and into the palette.  

Users can drag and drop form elements into the form.  They can edit the 
elements in there (i.e. length of field, label name, required field, etc). At 
that point the chosen elements (the ones now in the form) should be pumped back 
 into another table where a name column will save the form intact with all it's 
elements. 

Hope this gives a better idea of what I"m trying to acheive.
Mark

-Original Message-
From: [EMAIL PROTECTED]
Sent: Tuesday, June 20, 2006 4:01 PM -07:00
To: Mark Fellowes [EMAIL PROTECTED]
Subject: [PHP-DB] Generating forms and form elements 
Hi Mark,

That's pretty vague, there's probably 1000 ways to do this. Are you just 
intending to store the HTML in a text field, or generate the form fields 
based on data so that the user can edit the data? Are you storing just 
data in the database, or the form structure? Also if it's structure, do 
you intend on storing formatting information, or just the form fields 
themselves.

If you sit down and draw up a detailed non-code plan, the solution would 
likely present itself.

-Micah


Re: [PHP-DB] Generating forms and form elements

2006-06-20 Thread Mark Fellowes
PHP code to generate HTML markup.   Or maybe just HTML code and then have the 
php generate it from the makrup in the table ?

Mark


-Original Message-
From: [EMAIL PROTECTED]
Sent: Tuesday, June 20, 2006 6:49 PM -07:00
To: Mark Fellowes [EMAIL PROTECTED]
Cc: php-db@lists.php.net
Subject: [PHP-DB] Generating forms and form elements


Mark Fellows previously described:
> Hi, Hitting up the list for maybe a decent link(s) or pointers.
> I need to figure out how to generate forms and form elements from
> php code inside database tables. Hope this makes sense.  It's not
> a complete picture of what I need to do but the first step I'll need to
take.

Do you mean you want to store PHP code or HTML markup in the DB?

David

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



[PHP-DB] Generating forms and form elements

2006-06-20 Thread Mark Fellowes
Hi, Hitting up the list for maybe a decent link(s) or pointers.
I need to figure out how to generate forms and form elements from php code 
inside database tables. Hope this makes sense.  It's not a complete picture of 
what I need to do but the first step I'll need to take.

TIA
Mark

[PHP-DB] Weird database entry

2006-05-29 Thread Mark Fellowes
I checked my registration table recently and found 3 weird entries. 
First, this is where someone registers a username and password.  The password 
is generated but encrypted , and an email link must be responded to activate 
the account , which these were not but it kind of threw me anyway.

This what was in the username field:
Content-Type: multipart/alternative; 
boundary=6bc7cccbb294b179bd23781d7d300264
MIME-Version: 1.0
Subject: said ophie call once again he ammerjunker
bcc: [EMAIL PROTECTED]
This is a multi-part message in MIME format.
--6bc7cccbb294b179bd23781d7d300

Now, since my site is not totally operational and not really in production I 
gues I still should have put the validation code in anway :)

However aside from my bad behaviour does this type of entry signify an attempt 
at an attack of any kind ?

TIA 
Mark



[PHP-DB] Date Conversion

2006-05-16 Thread Mark Bomgardner

PHP 4.4/MySQL 4.0

I am tying to convert a date to put into a database from a string (ie: 
January, February) to a numeric value (ie: 01,02).  I am taking the 
value from a form, which is a drop down menu listing the months.


$sMonth1 = $_POST['Smonth']; returns the money selected from the form.
When I go to format the month from a string to numeric with 
date('m',strtotime($sMonth1));

it returns 12, no matter which month I select.

In reading the docs at php.net, date('m',strtotime($sMonth1)); is 
correct to reformat from a string to a time format.


What am I missing.


mark bomgardner

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



[PHP-DB] Result set in different columns

2006-04-10 Thread Mark Bomgardner
I am trying to work through some display logic where I want to display a 
results set from a database query into to columns in a table, but I 
can't see to get it correct.


Example; I want to loop through the months of the year and display them 
like this;


   JanuaryFebruary
   March  April
   MayJune
   JulyAugust
   September  October
   November   December

Any ideas?


Mark Bomgardner

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



Re: [PHP-DB] Help: Two dimensional array from table

2006-04-07 Thread Mark Fellowes
The reason I had orginally singled out one column ['usr_d'] is so I could nest 
it inside another loop to see if two values match.  if usr_id matched returned 
value from first loop.
The way I called it was if(!in_array(@$row_rsResults['id_subscribe'],$usrreg)) {
else{

now Im not sure how to call the individual fields.  I've tried $usrreg['date']; 
but that doesn't seem to work.
Do I need to use keys and values ?

TIA
Mark



-Original Message-
From: [EMAIL PROTECTED]
Sent: Friday, April 7, 2006 4:14 PM -07:00
To: Mark Fellowes [EMAIL PROTECTED]
Subject: [PHP-DB] Help: Two dimensional array from table


Yes, all wrong.

The array that mysql_fetch_assoc returns is one dimensional. Not two. So 
you can refer to it like you are. Your problem is in your query more 
than anything. You're doing things the hard way. Keep in mind that 
mysql_fetch_assoc will take care of column names for you so:

$rs_usr_usr = mysql_query("select user_id, usr_date from table");

//Code for registered
$usrreg = array();
do {
 $usrreg[] = $row_usr_usr;
} while($row_rs_usr_usr = mysql_fetch_assoc($rs_usr_usr));
//end of registered



That's all you need.
-Micah

Mark Fellowes wrote:
> I created an array to pull data out of one column in database.
>
>//Code for registered
> $usrregid = array();
> do {
>  $usrregid[] = $row_rs_usr_usr["usr_id"];
> } while($row_rs_usr_usr = mysql_fetch_assoc($rs_usr_usr));
> //end of registered
> ?>
>
> However I now need a second column from the table and think a two dimensional 
> array is the right way to go. Having a problem though in defining.  Most of 
> the examples I found don't seem to apply to pulling the values from a db.
>
> I tried this and while it returns no errors, it also returns no value.
>
>  //Code for registered
> $usrreg = array("id", "date");
> do {
>  $usrreg[] = $row_rs_usr_usr["usr_id"]["usr_date];
> } while($row_rs_usr_usr = mysql_fetch_assoc($rs_usr_usr));
> //end of registered
> ?>
>
> Am I defining wrong or pulling the values wrong ?
>
> TIA
> Mark
> __
> Organize. Communicate. Share. @ http://www.goowy.com
>   


__
Organize. Communicate. Share. @ http://www.goowy.com

[PHP-DB] Help: Two dimensional array from table

2006-04-07 Thread Mark Fellowes
I created an array to pull data out of one column in database.

  

However I now need a second column from the table and think a two dimensional 
array is the right way to go. Having a problem though in defining.  Most of the 
examples I found don't seem to apply to pulling the values from a db.

I tried this and while it returns no errors, it also returns no value.



Am I defining wrong or pulling the values wrong ?

TIA
Mark
__
Organize. Communicate. Share. @ http://www.goowy.com

[PHP-DB] MySQL Query Help

2006-03-23 Thread Mark Dyer

Hello, I'm unsure how to write the follow query, Please can someone assist.

I am writing in short hand the basis of the two queries I would like to
combine. The object is to select all the products that have not meet the min
sale requirements so I can send myself a reminder email.

The first table products contains the product information and how ofter the
stores must purchase and at what period ie, Weekly or Monthly by product.

First Query gives me all the products that must check to see if they have
meet the min sales.

Select store_id,product_id, min_level, reoirder_period from products db
where monthly_order_required > 0


Second Query is then run to test to see if they have meet the min sales.

Php: If reorder period = weekly then backdate = 7 days elseif period =
monthly then backdate = 30

Select sum(sale_product_qty) as sale_period_total from sales db where store
= store_id and product = product_id and date <= now and date > backdate and
sale_period_total > min_level


Result: sum of sales in the last week or month period for that product from
that store. If no result then sale level ok. If result then the difference
from min_level is what is require for the store to make asap.

Php: if sale_period_total < min_level then email low order email.


Any assistance to combine to the queries instead of hundreds of individual
would be grateful.

Regards
Mark Dyer
NZ

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



[PHP-DB] MySQL creating new tables using wrong engine...

2006-03-15 Thread Mark Benson

I have run into an issue where I keep getting InnoDB tables everytime I create 
a new table in PHPMyAdmin, and I want MyISAM tables. It's very annoying. Anyone 
got any suggestions as to what I might have done that made MySQL or PHPMyAdmin 
do this?

-- 
Mark Benson

http://homepage.mac.com/markbenson

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



[PHP-DB] Mail Function

2006-03-01 Thread Mark Bomgardner
I have been racking my brain for the better part of a day with a simple 
mail function.  I am trying to generate a list of events from MySQL and 
then use the php Mail function to email the list in an html email to a 
mailing list.  I keep getting a parse error on a section that I can not 
figure out why.


The code is attached

Markb
http://www.w3.org/TR/html4/loose.dtd";>



Up Coming Training







  
Upcoming Training Event 
  
  
Sponsored by The Kansas Law 
Enforcement Training Center 
  
  
 
  
  
Listed below, you’ll find an assortment of 
Specialized Training classes being offered by the Kansas Law Enforcement 
Training Center during the months of March and April. Of special interest are 
the Ethics Instructor class being offered March 13 – 17; Field Training 
Officer class being offered March 13 – 15 in Dodge City; Crime Scene and 
Arson Photography class offered March 16 – 17. These classes should have 
a significant impact on those officers attending, providing new insight and 
expertise to your agency.
  
  
 
  
  

  
Start Date 
Project Number 
Class Title 
Location
  '.
 do {
  if($row_Recordset1['special'] =='Y'){   
  .'
  '.date("m/d/Y", 
strtotime($row_Recordset1['Sdate'])).'
  '.$row_Recordset1['pnumber'].'
  '.$row_Recordset1['title'].'
  .'$row_Recordset1['city'].'
  '.
  
  }else{
  .'
  '.date("m/d/Y", strtotime($row_Recordset1['Sdate'])).'
  '.$row_Recordset1['pnumber'].'
  '.$row_Recordset1['title'].'
  '.$row_Recordset1['city'].'
  '.
  
  }
  } 
  
  while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)).'

  



'.mysql_free_result($Recordset1).'')
?>

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

[PHP-DB] Future Event

2006-02-20 Thread Mark Bomgardner
Is there a way in php to execute a SELECT statement in the future?  What 
I am wanting to do is use a page to parse a database at a future time.  
I want to send out some email about an event I am putting on, but I 
don't want to execute the select statement until 2:00am.  I could use 
cron for this, but I would perfer not, as I am writing an application in 
which cron may not be an option.  Is there 3rd party engines that will 
do this?



Mark

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



Re: [PHP-DB] How to compare crypted password with stored in MySQL

2006-02-01 Thread Mark Bomgardner

Eduardo Bejar wrote:
Hi, 


I have a MySQL database with encrypted passwords, that were created with:

$input_password = $_POST["password"];
$salt = "ab"; /// Salt is always two character string and the same for all
$password_to_save = crypt($input_password, $salt);

and then saved in MySQL with: insert into password_table set
passwd='$password_to_save'; (other columns are inserted also, but passwd is
the one related to this question).


Now, to check if a password is valid, I set $salt as the first two
characters of the stored encrypted password, and with this salt I crypt and
compare both:

$salt = substr ($password_stored_in_mysql, 0,2);
$password_to_check = crypt($input_password, $salt);

if ($password_to_check == $password_stored_in_mysql) echo "Password is the
same";


This used to work on a PC that runs PHP 4.1.2 and MySQL 3.23.36. But when
trying this on other PC that runs PHP 4.3.11 and MySQL 3.23.58, I get no
password match, as $password_to_check is different from the one stored in
the database.

In example: $password_to_check shows "ab2vG8KakAAGY" and the stored one is
"abFcR2QZ/2fUU".


What could be causing this? How should I compare the passwords? 


Thank you,

Edo

  
Instead of using PHP, use MySQL MD5 to encrypt the string.  You could do 
the encryption on the insert and then when you want to check the 
password, use the MD5 on the select statement.  I have done it both 
ways, and I perfer to use MySQL to do it.


My $.02 worth

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



[PHP-DB] Date Formatting Question

2005-12-14 Thread Bomgardner, Mark A
I am trying to format the month portion of a date that I am trying to
pull from MySQL to be placed into a drop down menu to modify the date.
I have tried several ways and none seem to be working.  

I am pulling the date out of MySQL with: 
$sDate = explode("-", $row_events['Sdate']);

And then attempting to insert each portion of the array into a drop down
menu with:
echo "";
echo "$sDate[1]";
which is where I am running into the problem.  I pull out the month as 2
digit numeric 01, 02, 03 etc., but I want it displayed as January,
February, March, etc.,

I have tried the following with no success:
Date("F",strtotime($sDate));  
Strftime("%B:,$sDate);
Date("F",$sDate);


I would use MySQL to format the date, but I have three date fields to
modify and it would be easier to do it in PHP

Any pointers would be appreciated.


Mark Bomgardner
Technology Specialist
KLETC

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



Re: [PHP-DB] MySQL 5 Stored Procedures

2005-11-03 Thread Mark Jordan
Thanks a lot. Ive just been reading them up on the MySQL website, and
they seem really useful, so this really helps.

Mark

On 03/11/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

>
> It is possible using PHP 5. Simply make a query like this:
>
> Select name_of_procedure(parameter1,parameter2,...);
>
> We use this with phpcvs from april 2005 and the mysqli interface and it
> works fine.

--
This message is best viewed with your eyes.

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



[PHP-DB] MySQL 5 Stored Procedures

2005-11-03 Thread Mark Jordan
Ive heard that mysql 5 now supports stored procedures. Can you call
these from PHP? or is it too early to expect functionality already?

Mark

--

This message is best viewed with your eyes.

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



Re: [PHP-DB] HTML Tables in PHP...

2005-09-26 Thread Mark Jordan
boo ... short tags
though i admit it's gotta be easier to type.

Why I don't like short tags : I use XML a lot.

Mark

On 26/09/05, Micah Stevens <[EMAIL PROTECTED]> wrote:
>
> Rasmus, there's a shortcut for this:
>
> 
>
> 
>
> Saves me a lot of time, although it can be confusing for those unfamiliar with
> it.
>
> -Micah
>
>
> On Sunday 25 September 2005 11:01 pm, Rasmus Lerdorf wrote:
> > There are many ways to do it.  I prefer one of these two:
> >
> >  >   echo << > 
> > EOB;
> > ?>
> >
> > or.
> >
> >  width="">
> >
> > -Rasmus
> >
> > Micah Stevens wrote:
> > > I apologize, I was being rude.
> > >
> > > More specifically, I don't see why you say all html tags should be in
> > > single quotes. There's several ways you can do things in almost every
> > > situation in PHP, and I can just as easily say you should always use
> > > double quotes. I of course would be wrong though.
> > >
> > > echo "";
> > >
> > > provides the convenience of inserting variables:
> > > echo "";
> > >
> > > which you can not do with single quotes, so I could argue that double
> > > quotes are better.
> > >
> > > So, in contrast to my original rude comment (again, I apologize) perhaps
> > > I should of said: Why do you say that?
> > >
> > > -Micah
> > >
> > > On Sunday 25 September 2005 9:44 pm, Micah Stevens wrote:
> > >>That's ridiculous.
> > >>
> > >>On Sunday 25 September 2005 9:28 pm, balwant singh wrote:
> > >>>all html tags should be in single quote when used in php like
> > >>>
> > >>>echo '';
> > >>>echo ''; echo "HELLO";
> > >>>echo '';
> > >>>
> > >>>
> > >>>
> > >>>With Best Wishes
> > >>>
> > >>>Balwant Singh
> > >>>
> > >>>INDO ASIAN FUSEGEAR LTD.
> > >>>A-39, HOSIERY COMPLEX
> > >>>PHASE - II EXTN., NOIDA
> > >>>PH: +91 - 120 - 3048140 / 304
> > >>>FAX: +91 - 120 - 2568 473
> > >>>WEB : www.indoasian.com
> > >>>
> > >>>
> > >>>
> > >>> Original Message 
> > >>>From: "Daryl Booth" <[EMAIL PROTECTED]>
> > >>>To: php-db@lists.php.net
> > >>>Subject: [PHP-DB] HTML Tables in PHP...
> > >>>Date: 9/25/2005 19:05
> > >>>
> > >>>>How can I give a   with all of it's parameters in PHP in
> > >>>>each of the cells there is a variable that gives me the data back but I
> > >>>>can't get the table to show as it always gives me either this error
> > >>>>"Parse error: parse error, unexpected T_LNUMBER, expecting ',' or ';'
> > >>>>in C:\FoxServ\www\Dad\proofing\index.php on line 41" or this one when I
> > >>>>don't put in the quotes "Parse error: parse error, unexpected '<',
> > >>>>expecting ',' or ';' in C:\FoxServ\www\Dad\proofing\index.php on line
> > >>>>41".
> > >>>>
> > >>>>
> > >>>>
> > >>>>Here is the PHP code I'm using:
> > >>>>
> > >>>>
> > >>>>
> > >>>> > >>>>
> > >>>>$datei="c:\licence.txt";
> > >>>>
> > >>>>
> > >>>>
> > >>>>
> > >>>>
> > >>>>if(file_exists($datei)){
> > >>>>
> > >>>> $nachricht="The licence has been validated thank-you!";
> > >>>>
> > >>>> $fp = fopen($datei,"r");
> > >>>>
> > >>>> fpassthru($fp);
> > >>>>
> > >>>> fclose($fp);
> > >>>>
> > >>>> }
> > >>>>
> > >>>>else{
> > >>>>
> > >>>> $nachricht="The licence doesn't exist please contact us!
> > >>>>
> > >>>> echo  > >>>>cellpadding="0" cellspacing="0">
> > >>>>
> > >>>> 
> > >>>>
> > >>>>> >>>>height="109" border="0" usemap="#Map">
> > >>>>
> > >>>> 
> > >>>>
> > >>>> 
> > >>>>
> > >>>>> >>>>height="394">
> > >>>>
> > >>>>    
> > >>>>
> > >>>>   
> > >>>>
> > >>>>    
> > >>>>
> > >>>>> >>>>class="style3">$nachricht
> > >>>>
> > >>>>> >>>>height="394" border="0" usemap="#Map2">
> > >>>>
> > >>>> 
> > >>>>
> > >>>> 
> > >>>>
> > >>>>> >>>>height="23">
> > >>>>
> > >>>> 
> > >>>>
> > >>>>;
> > >>>>
> > >>>>}
> > >>>>
> > >>>>?>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
theExile.vze.com
www.stpaulswalsall.org.uk

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



Re: [PHP-DB] Getting Started..

2005-09-19 Thread Mark Jordan
Maybe you don't need the trailing semicolon after the phpinfo()? This
is just a thought as sometimes you don't need it in the final php
statement before the ?> tag.

Mark

On 20/09/05, Clint Lovell <[EMAIL PROTECTED]> wrote:
> I'm just getting started here and I'm working with PHP & MySQL for Dummies.
> The book says to write a simple file called "test.php" with the following
> entries in it:
> 
> 
> PHP Test
> 
> 
> This is an HTML line
> 
>  echo "This is a PHP line";
> phpinfo();
> ?>
> 
> When I run http://localhost/test.php, this is the error I got:
> Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in
> C:\apachefriends\xampp\htdocs\test.php on line 9.
> Can someone tell me what's wrong and what I need to do to get things squared
> away?
> Thank you...
> Respectfully,
> 
> Clinton E. Lovell
> Principal
> Rainmaker Marketing Corporation
> 15519 Dawnbrook Drive
> Houston, Texas 77068
> (281) 537-1200
> (206) 203-1229 (eFax)
> 
> CONFIDENTIALITY NOTICE: This communication and any documents, or files,
> attached to it, constitute an electronic communication within the scope of
> the Electronic Communication Privacy Act, 18 USCA 2510. This communication
> may contain non-public, confidential, or legally privileged information
> intended for the consideration of the designated recipients(s). The unlawful
> interception, use, or disclosure of such information is strictly prohibited
> by 18 USCA 2511 and any applicable laws. If you have received this e-mail in
> error, please immediately notify us at (281) 537-1200 or via reply email and
> permanently delete the original and any copy of any e-mail, file or
> attachment and destroy any printout thereof. Thank you for your assistance.
> 
> 
> -Original Message-
> From: Norland, Martin [mailto:[EMAIL PROTECTED]
> Sent: Monday, September 19, 2005 2:04 PM
> To: php-db@lists.php.net
> Subject: RE: [PHP-DB] insert error for mysql
> 
> One of the strings you're inserting has an quotation mark (apostrophe).
> You're going to have to do some more careful data scrubbing on the
> incoming data.
> 
> E.G. one of the strings says "it's used in the retail, banking, and
> insurance industries, among" ...
> And it's breaking the containing '   -  insert into foo (bar) values
> ('this isn't going to work.');
> 
> might I suggest starting with addslashes()
> 
> Cheers,
> - Martin Norland, Sys Admin / Database / Web Developer, International
> Outreach x3257
> 
> The opinion(s) contained within this email do not necessarily represent
> those of St. Jude Children's Research Hospital.
> 
> 
> -Original Message-
> From: Yui Hiroaki [mailto:[EMAIL PROTECTED]
> Sent: Monday, September 19, 2005 1:26 PM
> To: php-db@lists.php.net
> Subject: [PHP-DB] insert error for mysql. .
> 
> hi!
> 
> I have an error message to try to insert character into table.
> But I have an error messages like below. When I try to insert
> $strbuf, I got error.
> 
> 
> Could not perform INSERT to table 1064: You have an error in your SQL
> syntax. Check the manual that corresponds to your MySQL server version
> for the right syntax to use near 's used in the retail, banking, and
> insurance industries, among
> 
> 
> 
> I publish SQL;
> 
> mysql> create table view(b_col_id mediumint(255) NOT NULL
> AUTO_INCREMENT, b_col longblob NOT NULL,file_name varchar(255) NOT
> NULL,file_size varchar(255) NOT NULL,file_type varchar(255) NOT
> NULL,file_date time,vtext longtext,PRIMARY KEY(b_col_id))TYPE=MyISAM;
> 
> 
> mysql> alter tablev view add fulltext (vtext);
> 
> The code--
> $handle = popen("/usr/bin/pdftotext \"$original_tmp\" - -layout  2>&1",
> 'r');
> $strbuf = fread($handle, 2048000);
> echo $strbuf;
> 
> pclose($handle);
> 
> 
> $sql_insert = "INSERT INTO
> view(b_col,file_name,file_size,file_type,file_date,vtext) VALUES
> ('$binaryContent','$original_name','$original_size','$original_type',CUR
> TIME(),'$strbuf')";
> 
> mysql_query($sql_insert) or DIE ("Could not perform INSERT to table
> ".mysql_errno().": ".mysql_error());
> mysql_close($db);
> 
> 
> 
> 
> 
> 
> Please do help me!
> 
> Yui
> 
> --
> 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
> 
> 


-- 
theExile.vze.com
www.stpaulswalsall.org.uk

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



[PHP-DB] Re: retrieving field names in ascending order

2005-09-10 Thread Mark Jordan
Does php have anything like the Visual Basic statement 
"Option Compare String"
or
"Option Compare Database"
which controls how visual basic sorts strings like this.?

If it does, then it might help

*rushes off to check php manual*

-- 
---
theExile.vze.com
www.stpaulswalsall.com

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



Re: [PHP-DB] Files stored in mysql

2005-08-17 Thread Mark Cain
Here is one way to do it.  It happens to be the way that I use for a group
of folks that have authentication levels of access to pdf.

I store all of the pdf files above the www folder.  This keeps them out of
prying eyes.  You of course could store them in a database.

the security levels for the pdf are in the name of the pdf itself.  Such as:

thomas_korea_2_General-Travel-Info.pdf

where "thomas" is a group of people getting access to the files.
where "korea" is a particular region of their responsibility
where "2" is the security level that the "thomas" group must have to "see"
this file.
where "General-Travel-Info" is the "public or displayed name for the file.

Now here is how it works, the user logs in.  A session records his group and
his security level which is stored in a users database.  Once authentication
is done, the dir of pdf files is read and exploded on the underscores.
Every file that fits this user (group and security level) is displayed with
the public name with the hyphens replaced with spaces -- such as "General
Travel Info"

That data is displayed as a link which when clicked reads the real file out
to the browser such as

header("Content-Type: application/pdf");
header("Content-Disposition: inline; filename=$file_access_name");
@readfile("$file_access_name");

.

This is one way to do it.  Of course you may want to read the files out of
the database in your case.

Mark Cain


- Original Message -
From: "Vincent Lape" <[EMAIL PROTECTED]>
To: 
Sent: Wednesday, August 17, 2005 12:18 PM
Subject: [PHP-DB] Files stored in mysql


> I need some advise on how to handle some pfd files. We have sales guys out
> in the field and generally need to access client reports regularly. I was
> thinking about making a dir for each rep, subdir for each client and
posting
> the pfd files there.
>
> After the reps auth from the login page I call an iframe depending on the
> user:
>  name="Userss" src="repdata/rep1/dlist.php" width="100%" height="100%"
> scrolling="AUTO" frameborder="1" marginwidth="0"
> marginheight="0">'; ?>
>
>  name="Userss" src="repdata/rep2/dlist.php" width="100%" height="100%"
> scrolling="AUTO" frameborder="1" marginwidth="0"
> marginheight="0">'; ?>
>
> This is going to be a pain later when we get all the guys stuff online.
The
> iframe calls dlist.php which will display all the data in a directory.
>
> There has got to be a better way to handle this. How would I go about
> storing the pdf files in mysql and printing all the files in a nice linked
> table do onclick of filename it will open the pfd file to read?
>
> Any help would be greatly appreciated.
>
> P.S. sorry about the read request in my last post
>
> --
> 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] Payment Gateways

2005-07-21 Thread Mark Cain
You need to find out from the bank a few pieces of info:
what is the url that you would use to make the transaction?
what port is the server expecting you to use?
what useragent is the server expecting?
what is the format of the request?
is your request to be a GET or POST?
is the server looking for a custom request string?
what is the separator of the custom request?

Then read the following:

http://php.net/curl


Mark Cain


- Original Message -
From: "Ahmed Shams" <[EMAIL PROTECTED]>
To: 
Sent: Wednesday, July 20, 2005 1:11 PM
Subject: [PHP-DB] Payment Gateways


> Hi all,
> I am working on a project that I haven't came across before and I would
> appreciate all the help I can get with it. Our client is requesting a
> payment gateway system where we communicate with the bank and provide
> reports and stats about the transactions. The reports part is relatively
> familiar but the communications with the bank is what is puzzeling me. I
> know the bank is providing an API but I need a similar code to work with.
If
> anyone can provide me with a similar project which I can change to our
specs
> or tell me how to start I would be extremely greatful.
> 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] PostgreSQL 7.2 - 8.0 replication issue

2005-06-27 Thread Mark Galbreath
The solution was to make sure that ftp mode is in ASCII (type I) and then 
execute the following, assuming a dummy database, "test," has been created as 
part of the installation, and the database dump resides at 
/usr/local/pgsql/temp:

On 7.2 server:
$ /usr/local/pgsql/bin/pg_dumpall --format=ASCII > db.out

On 8.0.3 server:

$ ftp [IP address]
$ ftp>cd [db.out location]
$ ftp>lcd /usr/local/pgsql/temp
$ ftp>ascii
$ ftp>get db.out
$ ftp>bye

$ /usr/local/pgsql/bin/psql test

# \i /usr/local/pgsql/temp/db.out
[database]-# \q
$

-
That's it.  This was by no means obvious from the documentation, by the way.

But now the real fun begins...will the migration work?  Stay tuned

~mark

-Original Message-
From: D.C. [mailto:[EMAIL PROTECTED]
Sent: Monday, June 27, 2005 4:23 PM

Le 27 juin 05, à 21:23, Mark Galbreath a écrit :

> Thanks for your reply, Des; unfortunately, your suggestion had no 
> affect.  I realize this is technically a PostgreSQL issue, but 
> rationalized my request help here because (1) this is the PHP-DB list 
> and PHP is used with MySQL and PostgreSQL more than any other 
> databases, and (2) I assumed that since PHP5 and PostgreSQL 8.0 have 
> been released, there are many developers who have had to deal with 
> this or a similar problem.

Hey, no worries.  I wasn't actually 'flaming' you for posting your 
question here, as I've been subscribed all of two hours myself .. .but 
I did have exactly the same problem with pg_dump as you.  Google for my 
name and pg_dump, and it might turn up.  Regards ...

D.

--  
Des Coughlan
[EMAIL PROTECTED]





***
This email and any file transmitted with it may be confidential and is intended 
solely for the use of the individual or entity to whom it is addressed.  If you 
received this email in error please notify the DBM Service Desk by forwarding 
this message to [EMAIL PROTECTED]


This email has been scanned by networkMaryland Antivirus Service for the 
presence of computer viruses.

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



RE: [PHP-DB] PostgreSQL 7.2 - 8.0 replication issue

2005-06-27 Thread Mark Galbreath
Thanks for your reply, Des; unfortunately, your suggestion had no affect.  I 
realize this is technically a PostgreSQL issue, but rationalized my request 
help here because (1) this is the PHP-DB list and PHP is used with MySQL and 
PostgreSQL more than any other databases, and (2) I assumed that since PHP5 and 
PostgreSQL 8.0 have been released, there are many developers who have had to 
deal with this or a similar problem.

~mark

-Original Message-
From: D.C. [mailto:[EMAIL PROTECTED]
Sent: Monday, June 27, 2005 2:43 PM

Le 27 juin 05, à 20:31, Mark Galbreath a écrit :

> I have to upgrade a web app from PHP 4.3.11 with PostgreSQL 7.2 to PHP 
> 5.0.4 with PostgreSQL 8.0.3.
>
> Currently I have PHP4 (as Apache 2.54 mod on port 80) and PHP5 
> (default CGI mode on port 8181) running concurrently on my DEV box.  I 
> installed PostgreSQL 8.0.3 on the DEV box as well.
>
> On the PostgreSQL 7.2 server, I did a pg_dumpall > db.out and ftp'd 
> db.out to the PostgreSQL 8.0.3 (DEV) server.  When I attempt to 
> pg_restore db.out, the PostgreSQL archiver aborts with the error: 
> "input file does not appear to be a valid archive"
>
> I'd sure appreciate a clue on this issue!

Try -format .. and output it as ASCII ... I _seem_ to recall having a 
similar issue a month or so ago .. this is really a PostgreSQL issue, 
though.






This email and any file transmitted with it may be confidential and is intended 
solely for the use of the individual or entity to whom it is addressed.  If you 
received this email in error please notify the DBM Service Desk by forwarding 
this message to [EMAIL PROTECTED]


This email has been scanned by networkMaryland Antivirus Service for the 
presence of computer viruses.

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



[PHP-DB] PostgreSQL 7.2 - 8.0 replication issue

2005-06-27 Thread Mark Galbreath
I have to upgrade a web app from PHP 4.3.11 with PostgreSQL 7.2 to PHP 5.0.4 
with PostgreSQL 8.0.3.

Currently I have PHP4 (as Apache 2.54 mod on port 80) and PHP5 (default CGI 
mode on port 8181) running concurrently on my DEV box.  I installed PostgreSQL 
8.0.3 on the DEV box as well.

On the PostgreSQL 7.2 server, I did a pg_dumpall > db.out and ftp'd db.out to 
the PostgreSQL 8.0.3 (DEV) server.  When I attempt to pg_restore db.out, the 
PostgreSQL archiver aborts with the error: "input file does not appear to be a 
valid archive"

I'd sure appreciate a clue on this issue!

tia,
~mark





***
This email and any file transmitted with it may be confidential and is intended 
solely for the use of the individual or entity to whom it is addressed.  If you 
received this email in error please notify the DBM Service Desk by forwarding 
this message to [EMAIL PROTECTED]


This email has been scanned by networkMaryland Antivirus Service for the 
presence of computer viruses.

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



Re: [PHP-DB] mysql check boxes

2005-06-24 Thread Mark Cain
I was confused for a moment about the use of the "two" checkboxes in your
request -- now I understand that you actually use the word "checkbox" for
two different items in your post.  1) is for the field in the table where
binary data is fetched and 2) is for an actual HTML form checkbox that is to
precede each row of data.

Your script only displays #1 -- the data from the database.  Here is what
you need to do to see the checkbox before the data in each row.

echo "   $id
$checkbox $testField ";

I am assuming a couple of things with the above code -- but this should get
you to the place where you can work it out.


Mark Cain


- Original Message -
From: <[EMAIL PROTECTED]>
To: 
Sent: Friday, June 24, 2005 5:25 AM
Subject: [PHP-DB] mysql check boxes


Dear Friends,

I have mysql database and php script.

Script pulls all the data with their serial number in html form, from
database however, I want each field pulled to be preceeded by a check box.

I created field in table and entered array for check boxes in php script,
still check boxes aren't displayed.at the same time rest of the data with
serial
number is displayed.

--
--
Php script

--
--
";
}
?>
---
mysql table structure
---
   Field TypeAttributes   NullDefault Extra
Action
id int(11)   No   auto_increment

checkbox char(2) BINARY   No []
emailvarchar(150)  No

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



[PHP-DB] Problem with MySQL Extension

2005-06-23 Thread Bomgardner, Mark A
Setup
Linux RHEL 3, PHP 4.3.2, MySQL 4.1.12

I am trying to use phpMyAdmin to connect and I am running into trouble.
I get the message that PHP can not load mysql extension.  A check of
/usr/lib/php4 shows mysql.so is where is should be and under /etc/php.d
there is the correct mysql.ini, along with imap, odbd and ldap which all
show up with a call to phpinfo(), but mysql does not.

I upgrade the php-mysql extension from 4.3.2-8 to 4.3.2-23, which is the
most current rpm and still no luck.  I now get the message that it can't
find mysqli extension.

Any ideas?

Mark Bomgardner
Technology Specialist
KLETC

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



RE: [PHP-DB] PHP 4 to 5 Upgrade Issue

2005-06-23 Thread Mark Galbreath
Excellent, Gary! Typically, sitting there staring me in the face!

Thanks a lot!

~mark

-Original Message-
From: Gary Every [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 23, 2005 4:12 PM
To: Mark Galbreath; php-db@lists.php.net
Subject: RE: [PHP-DB] PHP 4 to 5 Upgrade Issue


I need to compare PHP 4 code with PHP 5 interpreter on same machine.

I am following the examples in Adam Trachtenberg's Upgrading to PHP 5
(O'Reilly 2004) listed in "Appendix C: Installing PHP 5 Alongside PHP 4"
with regard to using virtual hosting and relative ports on Apache httpd.
I have also read the Apache docs online regarding virtual hosting.  And
I cannot get it to work.

I have the following relevant entries in Apache httpd.conf:

Listen 8181
Listen 80


LoadModule php4_module modules/libphp4.so
DocumentRoot /srv/www/htdocs



DocumentRoot /srv/www/htdocs
ScriptAlias /* /srv/www/htdocs






When I browse http://localhost:8181/ I always get the root (/index.html)
instead of the alias (/php5/index.php).  Any clues?

tia,
~mark


Mark,
Change your DocumentRoot on *:8181 to:
DocumentRoot /srv/www/htdocs/php5

Your ScriptAlias isn't really affecting that portion of the site. 
Your PHP5 index.php resides in /srv/www/htdocs/php5 directory, right?

G.~





This email and any file transmitted with it may be confidential and is
intended solely for the use of the individual or entity to whom it is
addressed.  If you received this email in error please notify the DBM
Service Desk by forwarding this message to [EMAIL PROTECTED]


This email has been scanned by networkMaryland Antivirus Service for the
presence of computer viruses.

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






***
This email and any file transmitted with it may be confidential and is intended 
solely for the use of the individual or entity to whom it is addressed.  If you 
received this email in error please notify the DBM Service Desk by forwarding 
this message to [EMAIL PROTECTED]


This email has been scanned by networkMaryland Antivirus Service for the 
presence of computer viruses.







This email and any file transmitted with it may be confidential and is intended 
solely for the use of the individual or entity to whom it is addressed.  If you 
received this email in error please notify the DBM Service Desk by forwarding 
this message to [EMAIL PROTECTED]


This email has been scanned by networkMaryland Antivirus Service for the 
presence of computer viruses.

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



[PHP-DB] PHP 4 to 5 Upgrade Issue

2005-06-23 Thread Mark Galbreath
I need to compare PHP 4 code with PHP 5 interpreter on same machine.

I am following the examples in Adam Trachtenberg's Upgrading to PHP 5 (O'Reilly 
2004) listed in "Appendix C: Installing PHP 5 Alongside PHP 4" with regard to 
using virtual hosting and relative ports on Apache httpd.  I have also read the 
Apache docs online regarding virtual hosting.  And I cannot get it to work.

I have the following relevant entries in Apache httpd.conf:

Listen 8181
Listen 80


LoadModule php4_module modules/libphp4.so
DocumentRoot /srv/www/htdocs



DocumentRoot /srv/www/htdocs
ScriptAlias /* /srv/www/htdocs






When I browse http://localhost:8181/ I always get the root (/index.html) 
instead of the alias (/php5/index.php).  Any clues?

tia,
~mark






This email and any file transmitted with it may be confidential and is intended 
solely for the use of the individual or entity to whom it is addressed.  If you 
received this email in error please notify the DBM Service Desk by forwarding 
this message to [EMAIL PROTECTED]


This email has been scanned by networkMaryland Antivirus Service for the 
presence of computer viruses.

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



[PHP-DB] list test - ignore

2005-06-23 Thread Mark Galbreath
is this list alive?





***
This email and any file transmitted with it may be confidential and is intended 
solely for the use of the individual or entity to whom it is addressed.  If you 
received this email in error please notify the DBM Service Desk by forwarding 
this message to [EMAIL PROTECTED]


This email has been scanned by networkMaryland Antivirus Service for the 
presence of computer viruses.



Re: [PHP-DB] Com 1

2005-06-13 Thread Mark Cain
>From the manual's user supplied comments:  (Looks like this is for a windows
machine)

http://us4.php.net/fopen

   // Use this code to write directly to the COM1 serial port
   // First, you want to set the mode of the port. You need to set
   // it only once; it will remain the same until you reboot.
   // Note: the backticks on the following line will execute the
   // DOS 'mode' command from within PHP
   `mode com1: BAUD=9600 PARITY=N data=8 stop=1 xon=off`;
   $fp = fopen ("COM1:", "w+");
   if (!$fp) {
   echo "Uh-oh. Port not opened.";
   } else {
   $e = chr(27);
   $string  = $e . "A" . $e . "H300";
   $string .= $e . "V100" . $e . "XL1SATO";
   $string .= $e . "Q1" . $e . "Z";
   echo $string;
   fputs ($fp, $string );
   fclose ($fp);
   }


Mark Cain

- Original Message -
From: "Nandar" <[EMAIL PROTECTED]>
To: 
Sent: Monday, June 13, 2005 11:01 PM
Subject: [PHP-DB] Com 1


Hi,.

any one to know, how to send ascci file to com1 port from php ??

thx,
nandar

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



Re: [PHP-DB] Still having a form problem

2005-05-30 Thread Mark Cain
The array that you are using "quantity[]" has an automatic index populated
for it:

Meaning that if you have page1 that has the following code:










and assuming that we ordered 1 of the first item, 2 of the second item, 3 of
the 3rd, etc

Then the array will be passed to page2 as follows

_REQUEST["quantity"] Array
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
[4] => 5
)

All you need to do is explicitly specify the index of "quantity[]" on the
first page and use the SKU or Part Number as the index.

(I made up some part numbers to show you how to do it)

So, now your code will look like this:










 Now the array that is passed to page2 looks like this:

_REQUEST["quantity"] Array
(
[b54] => 1
[t3fl] => 2
[8956798] => 3
[A-E3600] => 4
[SA-8] => 5
)

 Voila! SKUs and quantities joined!

Mark Cain





- Original Message -
From: "Chris Payne" <[EMAIL PROTECTED]>
To: 
Sent: Monday, May 30, 2005 3:07 PM
Subject: [PHP-DB] Still having a form problem


> Hi there everyone,
>
>
>
> I'm still having problems with my form PHP data, I lost email for a couple
> of days due to a server crash on my account so don't know if this was
> answered or not (Sorry).
>
>
>
> Basically, I have a form which populates 25 entries at a time from a MySQL
> DB with PHP, you can select the product you want to order by entering a
> value in the quantity box, if it was a single box it wouldn't be a
problem,
> but it's an array.
>
>
>
> Now again, an array for the quantity is no problem at all, as I just use
>
>
>
>  size="5">
>
>
>
> HOWEVER, I also need to transfer the $id (Named $id_new) from the database
> in each quantity array at the same time so I can split each array into ID
> and QUANTITY, this way I know which ID has which quantity, but this is
what
> has me stumped.
>
>
>
> I tried with a HIDDEN field but of course that won't work, as there's no
way
> of aligning which ID goes with which quantity, so what I guess I need to
> know, is how to amend $id_new with the quantity[] array.
>
>
>
> Any help would be REALLY appreciated as this is really urgent.
>
>
>
> Chris
>
>

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



Re: [PHP-DB] Need some help

2005-05-11 Thread Mark Cain
You could use  a form -- but since this is a db maillist -- maybe you ought
to explore that on one of the other php lists e.g. general.

Mark Cain

- Original Message -
From: "ReClMaples" <[EMAIL PROTECTED]>
To: "Philip Hallstrom" <[EMAIL PROTECTED]>
Cc: "PHP" 
Sent: Wednesday, May 11, 2005 6:28 PM
Subject: RE: [PHP-DB] Need some help


> Sorry but this isn't working.  The variable $ttl_price is a calculation in
> my first script.  It stores the value of $Total_Price for all items.  I am
> trying to pass that to a new page.  It isn't a form that I'm working with,
> do I need to make it a form?  I would greatly appreciate any help you
could
> offer.
>
> Thanks
> -rich
>
> -Original Message-
> From: Philip Hallstrom [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, May 11, 2005 4:36 PM
> To: ReClMaples
> Cc: PHP
> Subject: Re: [PHP-DB] Need some help
>
> >   I am having an issue with displaying a variable from another php
script.
> > Can you help please?
> >
> > Here is the code that I'm using:
> >
> >  >
> > $item_ttlprice = $_POST[$ttl_price];
>
> This should at the very least be:
>
> $item_ttlprice = $_POST[ttl_price];  // remove the last dolalr sign
>
> Also, if youre HTML form's action is GET then you should replace POST with
> GET...
>
>
>
>
> > ?>
> > 
> > 
> > Your price is: $
> >  > echo $item_ttlprice;
> > ?>
> > 
> > 
> >
> > pretty simple I would think but I can't figure out what I'm doing wrong.
> > The above is the new script.  Below is the script that the $ttl_price is
> > coming from:
> >
> > td align=center>\$ $item_price 
> >$item_qty 
> >\$ $total_price
> > > href=\"removefromcart.php?id=$id\">remove
> >";
> > $ttl_price = $ttl_price + $total_price;
> >
> >
> > Can anyone tell me what I'm doing wrong?
> >
> > I have tried changing this part:
> >
> >  >
> > $item_ttlprice = $_POST[$ttl_price];
> > ?>
> >
> > to $item_ttlprice = $_GET[ttl_price];
> >
> > to $item_ttlprice = $_POST['$ttl_price'];
> >
> > nothing seems to work.
> >
> >
> > Thanks for your help
> > -Rich
> >
>
> --
> 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] Need some help

2005-05-11 Thread Mark Cain
run the following line of code in your page.  This will help you not only
with this experience but for a long time to come in the future:

phpinfo();

BTW, I suspect that your problem is that the variable is

$_POST['ttl_price'];

and not

$_POST[$ttl_price];

You will see that in the output of phpinfo();

Mark Cain


- Original Message -
From: "ReClMaples" <[EMAIL PROTECTED]>
To: "PHP" 
Sent: Wednesday, May 11, 2005 3:14 PM
Subject: [PHP-DB] Need some help


> Hello all,
>
>I am having an issue with displaying a variable from another php
script.
> Can you help please?
>
> Here is the code that I'm using:
>
> 
> $item_ttlprice = $_POST[$ttl_price];
> ?>
> 
> 
> Your price is: $
>  echo $item_ttlprice;
> ?>
> 
> 
>
> pretty simple I would think but I can't figure out what I'm doing wrong.
> The above is the new script.  Below is the script that the $ttl_price is
> coming from:
>
> td align=center>\$ $item_price 
> $item_qty 
> \$ $total_price
>  href=\"removefromcart.php?id=$id\">remove
> ";
> $ttl_price = $ttl_price + $total_price;
>
>
> Can anyone tell me what I'm doing wrong?
>
> I have tried changing this part:
>
> 
> $item_ttlprice = $_POST[$ttl_price];
> ?>
>
> to $item_ttlprice = $_GET[ttl_price];
>
> to $item_ttlprice = $_POST['$ttl_price'];
>
> nothing seems to work.
>
>
> Thanks for your help
> -Rich
>

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



Re: [PHP-DB] URL question

2005-04-29 Thread Mark Cain
 a 404 script is the way I would handle it.

Modify what the server does when it finds a page that doesn't exist.
Currently the server issues 404 headers and displays a brain dead message
about not being able to find the page.  Change that so that the server
issues 200 headers (tricking the client which has "friendly error message"
enabled) and pick off the part after the .com/ and do a look up for the
item.  If found, proceed as expected, it not found display, a brain dead 404
message.

How do you modify the server?
Either modify the 404 directive in Apache or one of the other lesser
products
or
setup a .htaccess file on their domain

The .htaccess has a line that says:
ErrorDocument 404 /new.php

Which means when the page is not found display the page /new.php

Build your product look up and place it in the file new404.php

Be sure that the first line of new.php is

To: 
Sent: Friday, April 29, 2005 11:00 PM
Subject: [PHP-DB] URL question


> Hi there everyone,
>
>
>
> My client needs to be able to have their url www.blahblah.com
>   pickup the product number but I can't do it
the
> way I'd want (which would be www.blahblah.com/?mls=examplenumber, instead
> they said it MUST be www.blahblah.com/examplenumber - how can I grab the
> number AFTER the .com in PHP so that I can process it with MySQL without
it
> being assigned a variable name, just the number?
>
>
>
> Chris
>
>

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



Re: [PHP-DB] mime-type related to extension?

2005-04-27 Thread Mark Cain
The beginning of the jpeg file in hex looks like this:

FF D8 FF

perhaps you could test for that occurrence.  Be aware that the occurrence of
FF D8 FF must be in each jpg file -- it does not mean that the occurrence of
FF D8 FF is found only in a jpg file.

http://filext.com/detaillist.php?extdetail=JPG

you could also try http://www.jpeg.org/index.html


Mark Cain


- Original Message -
From: "mel list_php" <[EMAIL PROTECTED]>
To: 
Sent: Wednesday, April 27, 2005 4:03 AM
Subject: FW: [PHP-DB] mime-type related to extension?


> Hi I sent this on 21st of april and got no answer...
> there is no way to check the "real" mime type of a file?
> even a file without extension?
> thanks,
> melanie
>
>
> >From: "mel list_php" <[EMAIL PROTECTED]>
> >To: php-db@lists.php.net
> >Subject: [PHP-DB] mime-type related to extension?
> >Date: Thu, 21 Apr 2005 13:45:45 +
> >
> >Hi guys!
> >
> >I have a basic form to upload files, my problem is about the mime type.
> >I use $type= $_FILES[$file_uploaded]['type']; to check the mime-type of
the
> >fila as I want to allow only .jpeg.
> >I have then a test like:
> >if  ($type=="image/pjpeg" || $type=="image/jpeg")
> >{
> >...
> >}
> >
> >Upload working fine if I send "red.jpg".
> >However if I rename the file in "red", php recognizes it as
> >application/octet-stream and not jpeg.
> >I'm working under linux and for me the extension is not required for a
> >file, I thought the mime-type was encoded in the file itself and was
> >independent of the extension.
> >Any clue on that?
> >Any other php function I should look at?
> >The cookbook and pear both use $_FILES[ ] ['type'] so I have no idea
here.
> >
> >Thanks,
> >Melanie
> >
> >_
> >It's fast, it's easy and it's free. Get MSN Messenger today!
> >http://www.msn.co.uk/messenger
> >
> >--
> >PHP Database Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
> _
> Want to block unwanted pop-ups? Download the free MSN Toolbar now!
> http://toolbar.msn.co.uk/
>
> --
> 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] SQL or array ?

2005-04-23 Thread Mark Cain
explain the phrase "big array."

What is big to you might not be big to the server nor to me but then again
maybe it's bigger.  Are you talking dozens, hundreds, thousands, millions??

- Original Message -
From: "Paul Reilly" <[EMAIL PROTECTED]>
To: 
Sent: Saturday, April 23, 2005 5:05 PM
Subject: [PHP-DB] SQL or array ?


>
> I have a quick question about which would the best way to implement
> something in terms of performance. Using a database, or just creating
> a big array in memory?
>

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



Re: [PHP-DB] 'OR' logic in mySQL query

2005-04-17 Thread Mark Cain
You might want to pattern you SELECT statement in this manner:

SELECT * FROM `tablename` WHERE status = 3 OR status = 1

Notice I called the field name explicitly on each side of the OR.

Be sure to check the data type for the date field -- if it is a datetime
stamp or date stamp, it might complain with the use of "like"

You ought to check out:

http://dev.mysql.com/doc/mysql/en/where-optimizations.html

Mark Cain



- Original Message -
From: "Ron Piggott" <[EMAIL PROTECTED]>
To: "PHP DB" 
Sent: Sunday, April 17, 2005 4:04 PM
Subject: [PHP-DB] 'OR' logic in mySQL query


> Am I able to use the OR logic in mySQL queries?
>
> $query = "SELECT * FROM table WHERE date_received LIKE '$todays_date' OR
> '$yesterdays_date' ORDER BY prayer_request_reference ASC";
>
> In this above example will the " OR '$yesterdays_date' " work?
>
> In reality I am wanting to preview new entries to the database within the
> past 2 days
>
> Ron
>
> --
> 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] using POST data for a readfile

2005-04-11 Thread Mark Cain
Trap for the referral page in the callFile.php page.

Allow the proper referral page to pass (could be multiple pages if you
choose) but if the users modify the URL of the GET the referral page will be
blank or perhaps more precise the referrer var will be empty and
nonexistent.

Do a phpinfo and look for the var:

 _SERVER["HTTP_REFERER"]

this will allow them to try to modify the url and you will know who is
attempting it  --  if you'd care to know that info.

Mark Cain



- Original Message -
From: "mel list_php" <[EMAIL PROTECTED]>
To: 
Sent: Monday, April 11, 2005 5:59 AM
Subject: [PHP-DB] using POST data for a readfile


> Hi list,
> (mail problem you may get that one twice!)
>
> My problem: I protect my files by storing them out of the web root or
behind
> a htaccess.
> As I'm not using the htaccess authentication for my users, I use a
readfile
> to serve the file, basically something like:
>
> File to serve
>
> and in the script callFile something like
readfile(./protectedDir/test.pdf).
> this works fine, but I just would like to use a post instead of a get, to
> avoid my users trying to modify the url.
>
> I tried to use a function in the callFile script, something like:
>
> function getFile ($fileId)   {
>
> readfile($fileId);
>
> }
>
> if (isset($_POST['fileId']))
> {
> $fileId=$_POST['fileId'];
> getFile($fileId);
> }
>
> but it doesn't work.
> I also tried to do a require_once (callFile.php) and then later on call
the
> getFile function from the first script but no more success.
>
> Does anybody has any idea on how to do that?
>
> Thanks,
> Melanie
>
> _
> Want to block unwanted pop-ups? Download the free MSN Toolbar now!
> http://toolbar.msn.co.uk/
>
> --
> 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] eregi problem

2005-04-03 Thread Mark Cain
Almost.  But since this is not horseshoes nor hand grenades...

Here is a trap for A/N characters:

if (eregi("^[a-zA-Z0-9]+$",$GP[sifre])) {

corrections to your code:

Move the carat to the outside of the bracket -- I think the carat inside the
bracket means negation (I think). You want a starting character anchor so
that your code translates to "start with any of the following".

Add the plus sign after the brackets -- means "one or more of the preceding
characters"

Add the $ after the + sign  -- means "only the preceding character can be at
the end of the line."  Without the $ as an end anchor the user would be able
to put non-A/N characters at the end of the line of A/N characters and your
code would not trap it.

Mark Cain


- Original Message -
From: <[EMAIL PROTECTED]>
To: 
Sent: Sunday, April 03, 2005 11:18 AM
Subject: [PHP-DB] eregi problem


> I m trying to check $GP[sifre] variable, $GP[sifre] must consist of alpha
> numeric chars only. here, how I check the variable:
>
> if((eregi("[^a-zA-Z0-9]",$GP[sifre])
> echo 'true';
> else
> echo 'false';
>
> It works if variable starts with alphabetic chars only.
> for example this returns 'ok'
> $GP[sifre]='blabla234243';
> but this does not work: (if variable starts with numeric chars)
> $GP[sifre]='3243242blabla';
>
> second one returns false, couldnt figure out the problem here. any help ?
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



Re: [PHP-DB] File retrieval

2005-04-03 Thread Mark Cain
You could read this:

http://php.net/fread

or try this -- assuming that this is a non-windows OS:

 

Mark Cain


- Original Message - 
From: "Ron Piggott" <[EMAIL PROTECTED]>
To: "PHP DB" 
Sent: Friday, April 01, 2005 11:43 PM
Subject: [PHP-DB] File retrieval


> If I have a file named
> 
> "data.txt"  
> 
> Is it possible to load the contents of it into a variable search as
> 
> $contents
> 
> idealy I would like to know if I am able to do something like
> 
> $contents = data.txt;
> 
> Ron
> 
> -- 
> 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: Subject: Web Printing

2005-03-31 Thread Mark Cain
Let me encourage you to be open minded about the use of dynamic PDF
generation.  Don't think PDF as in storage and downloading -- think PDF in
the realm of format control.

google class.ezpdf.php

or just use this link:

http://www.google.com/search?hl=en&q=class.ezpdf.php&spell=1

Mark Cain


- Original Message -
From: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
To: "PHP DB List" 
Sent: Thursday, March 31, 2005 9:39 PM
Subject: [PHP-DB] Re: Subject: Web Printing


> hi all,
>
> thanx for all your suggestions. however, the css below doesn't seem to
help
> me solve my  problem. if my  is pretty short, the 
will
> still NOT appear at the bottom of my page but it appears where my 
> ends (which sometimes ends in the middle of my page). what else can i do??
>
> by the way, i cannot use PDFs to generate my reports as suggested by many
of
> you kind souls. This is because my clients just want to click on the
"Print
> Monthly Report" button and i am suppose to fetch the relevant data from
> MySQL DB and print out the report.. they don't need to save them in Excel
or
> PDF. It is restricted to printing off the IE browser.
>
> The problem that gives me the most headache is how can I know the total
> number of pages and the current page number, by using PHP?? I really need
> this because a report can be hundreds of pages so page number is very
> important to my clients.
>
> Please kindly help me! thank you s much!
>
> Hwee
>
> - Original Message -
> From: "Neil Smith [MVP, Digital media]" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Thursday, March 31, 2005 9:15 PM
> Subject: Subject: Web Printing
>
>
> > At 10:27 31/03/2005 +, you wrote:
> > >Message-ID: <[EMAIL PROTECTED]>
> > >From: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
> > >To: "PHP DB List" 
> > >Date: Thu, 31 Mar 2005 18:24:41 +0800
> > >Subject: Web Printing
> > >
> > >Hi all,
> > >
> > >i know i can print out a header and footer using HTML  and
> .
> > >However, the  doesn't always stay at the bottom of the page. For
> > >example, if the the last page only have 2 records, the  will
> appear
> > >pretty high on the page.
> > >
> > >i am wondering how can i use PHP to fix the position of my header and
> footer
> >
> > PHP cannot help you here, it's the wrong tool for the job (it's a
"hammer"
> > not a "screwdriver" so to speak).
> > You need to (*must* !!!) use CSS to position and specify the height and
> > dimensions of the thead and tfoot thus :
> >
> >
> > thead {
> >  display: table-header-group;
> >  position: absolute;
> >  top: 0;
> >  height: 36pt;
> >  width: 100%;
> > }
> >
> > tfoot {
> >  display: table-footer-group;
> >  position: absolute;
> >  bottom: 0;
> >  height: 36pt;
> >  width: 100%;
> > }
> >
> > These should apply *reasonably* well to position your thead and tfoot
row
> > groups in the same place on each printed page (adjust as desired). You
> > *cannot* use PHP to "guess" the height of the page areas reliably unless
> > you are using a fixed pitch font such as a dot matrix line printer. And
> > even then it's somewhat guesswork (I've done both).
> >
> > But if we're assuming that you're users have laser printers you *must*
use
> > CSS to do the print layout, PHP "line height guessing" will not work for
> you.
> >
> > Cheers - Neil
>
> --
> 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] Working with multiple tables...

2005-03-21 Thread Mark Cain
What is the nature of the userid?  is it something assigned by one of the
systems?  or is it chosen by the user himself?  or is it a constant such as
am employee ID?

Here's how I would approach it:

query the tables for the occurrence of the userid and obtain the system name
at the same time.

with the results, build a multidimensional associative array with userid and
system name such as

$prior[$row[system_name]][$row[userid]] = "grey";

Then in the code for the page loop though the systems with the userid such
as:

foreach ($prior as $system) {  // This will hit your systems one
after the other
  if ($prior[$system[$userid]]) {   // if this variable exists, it will
test as true
 $color = "grey";
  } else {
 $color = "black";
  };
};


That would be my starting stab at it.  I hope I understand enough of what
you're trying to do and that perhaps you understand what I am trying to do.
Let me know if this needs clarification.

Mark Cain



- Original Message -
From: "NIPP, SCOTT V (SBCSI)" <[EMAIL PROTECTED]>
To: 
Sent: Monday, March 21, 2005 2:44 PM
Subject: [PHP-DB] Working with multiple tables...


> I am working on revising a web request app that I have already
> developed.  The app basically provides a list of system names with
> checkboxes for a user to select to request accounts on the systems.  One
> feature I am intending to add is that the app should check a separate
> database of user accounts to see if the user already has an account on
> the system.  I think I could get it to work by making a query of the
> userid for each system, but this seems quite inefficient.  I would
> rather somehow have a single query that gets a list of system names and
> also checks the user account database at the same time to determine if
> the user already has an account.  Then I would like to display ALL of
> the systems, but "grey out" the ones that the user already has accounts
> on.  Can someone help me figure out the best way to go about this?
> Thanks in advance.
>
> Scott Nipp
> Phone:  (214) 858-1289
> E-mail:  [EMAIL PROTECTED]
> Web:  http:\\ldsa.sbcld.sbc.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] undefined function error

2005-03-18 Thread Mark Cain
It could be possible that mySQL is not enabled in your installation of PHP.

Let the server parse a page with phpinfo() in it and read the results.  Look
for mySQL enabled.

Perhaps the reason it runs fine on another server is that the php on that
server has mysql enabled.

HTH,

Mark Cain

- Original Message -
From: "Chip Wiegand" <[EMAIL PROTECTED]>
To: "PHP DB" 
Sent: Friday, March 18, 2005 4:53 PM
Subject: [PHP-DB] undefined function error


> I have a web site that connects to a mysql database using this connect
> script -
>
>mysql_select_db("simradusa",$db);
> ?>
>
> When I access the page it gives me this error -
>
> Fatal error: Call to undefined function: mysql_connect() in
> /usr/local/www/data-dist/connect on line 1
>
> Using mysql-4.1.10a for FreeBSD-5.3 with php-4.3.9
>
> Any idea why I'm getting this error? (the same connect string works fine
> on a differant web server running  FreeBSD-5.2.1/php-4.3.6/mysql-3.23.49)
>
> Thanks,
> Chip
>
> --
> 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] dynamic data manipulation in form

2005-03-18 Thread Mark Cain
You can try tinyMCE

http://moxiecode.com/downloads_tiny_mce.php

Mark Cain


- Original Message - 
From: "Doug Finch" <[EMAIL PROTECTED]>
To: "phpdb-list" 
Sent: Friday, March 18, 2005 4:42 PM
Subject: [PHP-DB] dynamic data manipulation in form


> I have a script that I have written in PHP that is a basic form that 
> inputs simple text into a mysql db.  One section is just a textarea 
> value that I would like to be able to add some dynamic formatting to the 
> text being entered if the user wants.  For example, I want to give the 
> user the ability to be able to highlight the text and click on a 
> paragraph tag and it automatically insert that tag - or a bold, itallic, 
> underline, etc.  I have searched the web but came up empty-handed.  Any 
> ideas?  I don't even know where to begin.
> thanks,
> Doug
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



Re: [PHP-DB] php and serial port

2005-03-16 Thread Mark Cain
You could try this code 

http://www.phpfreaks.com/quickcode/code/156.php

I found it by doing this search:

http://www.google.com/search?hl=en&q=php+serial+port

Mark Cain


- Original Message - 
From: "Rodrigo Cabeceiras" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, March 15, 2005 10:45 AM
Subject: [PHP-DB] php and serial port


> hi
> can php interact whit a serial port, (example com1 -> modem) and 
> exchange info whit a modem(hayscommand) ?
> has any one tried ?
> 
> thks
> 
> 
> rodrigo
> ---
> [This E-mail scanned for viruses by Declude Virus]
> 
> -- 
> 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] Error with "Where" Clause

2005-03-16 Thread Mark Cain
use backticks (read -- not single quotes, not double quotes, but backticks)
to quote your fields such as

where
 `1091vote038.state` = `109caucuses1.state`

It is possible that the code is interpreting the "109" part of your table
name as a integer.  That just might do it.

Mark Cain


- Original Message -
From: <[EMAIL PROTECTED]>
To: 
Sent: Monday, March 14, 2005 6:20 PM
Subject: [PHP-DB] Error with "Where" Clause


> I get only the table headings and text before and after the table, but not
> the table, when I add the "where" clause as below.  Without the "where"
> clause, the table does come up but (as expected) is repetitive and very
> long.  I'm using a template that I've used many times.  I've tried
> changing the $sort_field at the beginning with no success.  Any ideas as
> to a solution?
>
> Ken
>
> $get_data_query = "select concat(1091vote038.fn, ' ', 1091vote038.ln),
> 1091vote038.vote, 109caucuses1.party,
> 1091vote038.state, 1091vote038.cd, 109caucuses1.cbc, 109caucuses1.chc,
> 109caucuses1.prog, 109caucuses1.bdog,
> 109caucuses1.rsc
>  from 1091vote038, 109caucuses1
> where
> 1091vote038.state = 109caucuses1.state
> and
> 1091vote038.cd = 109caucuses1.cd
> order by $sort_field $sort_order";
>
> --
> 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] variable and MySQL

2005-03-16 Thread Mark Cain
I think I understand your question.  Perhaps what you want is not a variable
variable -- but a variable (determined from the context).
Variables always vary depending on the situation as opposed to a constant
which - uhh -- stays constant.  Combine the variable and the constant in a
new variable first with concatenation.

$question_pointer = $xxx . "_name_en";

$get_question_data[$question_pointer]

Mark Cain


- Original Message -
From: "simon" <[EMAIL PROTECTED]>
To: 
Sent: Monday, March 14, 2005 7:14 PM
Subject: [PHP-DB] variable and MySQL


> Hi, I'm trying to make a script but have a problem ...
>
> How could I do this:
>
> I'd like to use   $get_question_data[xxx_name_en]
>
> where xxx would be a variable variable according to the situation where
the
> script is called... how would I do this?
>
> tried :
>
> $get_question_data[$test_name_en]
> $get_question_data[{$test}_name_en]
> ${get_question_data[$test_name_en]}
>
> but nothing works  any help would be appreciated.
>
> --
> 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] Forms...

2005-03-09 Thread Mark Benson
Does anyone know if it is possible to have 'checkbox' elements in a 
form appear 'checked' or 'unchecked' when a page loads data from a 
MySQL data source? Can I use an attribute in the  tag to switch 
that?
--
Mark Benson

AIM - SilValleyPirate
MSN - [EMAIL PROTECTED]
Visit FlatPackMacs online: <http://fpm.68kmac.com>
Visit my Homepage: <http://homepage.mac.com/markbenson>
"Introducing Macintosh Classic II - pick one out on your way past the 
trash!"

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


[PHP-DB] Hyphens and MySQL

2005-01-28 Thread Mark Benson
I am having problems with entering data into MySQL from a PHP script. I am 
taking the data from an array generated by a CSV parsing routine. That in 
itself works great, however I have large number of data units with '-' 
characters in (hyphens) and it is causing the SQL queries to dump out with an 
error in the syntax. I can't get around it by putting a slash in front of them 
(using 'addcslashes'), it will just not at all accept them.
Are they the 'wrong' type of slash? Is there an easy way to search and 
replace/remove characters in a string in PHP?

-- 
Mark Benson

http://homepage.mac.com/markbenson

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



[PHP-DB] Re: MySQL version issue

2005-01-05 Thread Mark Benson

Doug, read my e-mail again, specifically the second and third paragraphs about 
what *version* of MySQL my host's server is using, then look at the manual 
entry again (specifically the first line you quoted).
The _mysql manual_ says... "If you specify the ON DUPLICATE KEY UPDATE clause 
(new in MySQL 4.1.0)" thus it only works in 4.1.0 and later, and my host is 
running MySQL 3.23.58 (not 3.25.58 as I previously said, not that it makes much 
odds!). Anyhoo thanks for giving it a shot, RBR (read before replying) in 
future, there's a good chap ;o)

Bastien, thanks sometimes one needs a new perspectiuve on these things, I was 
stuck in my mysql_query brackets. Putting mind to matter using your tips it 
would actually be fairly simple to do that. Again thank you for providing an 
exit() to my stuck loop ;o)

-- 
Mark Benson

http://homepage.mac.com/markbenson

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



[PHP-DB] MySQL version issue

2005-01-04 Thread Mark Benson
As some of you will recall, I enquired on this list about versions of MySQL and 
PHP a while back regarding and issue wit using the 'ON DUPLICATE KEY UPDATE' 
command in MySQL INSERT queries. Having upgraded our in-house system to PHP5 
and MySQL 4 the issue was no longer a problem.

However I have subsequently enquired with our out-of-house web host and they 
are still using PHP 4.1.2 and MySQL 3.25.58. As one of the purposes of asking 
them was to establish if I could easily upload from my database to the remote 
database, I now have a problem. I was planning to use a compare and update 
script that used 'ON DUPLICATE KEY UPDATE' command in MySQL INSERT queries to 
add or change items on the remote server. However I can't, as it's a MySQL4 
feature and the database to which I am writing ain't using MySQL4!

Any ideas about how I can create a MySQL3 compliant substitute for the 'ON 
DUPLICATE KEY UPDATE' Query action?

-- 
Mark Benson

http://homepage.mac.com/markbenson

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



[PHP-DB] Re: HTTP Auth for PHPMyAdmin

2004-12-23 Thread Mark Benson
Peter Lovatt:

>set auth type to cookies
>
>Peter

This presumably means that a cookie would remain allowing anyone who used the 
browser on my machine to access it after login. Again, if this is the case, 
this is not adequaterly secure, I require the phpMyAdmin pages to be locked at 
all times from all points of access.

-- 
Mark Benson

http://homepage.mac.com/markbenson

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



[PHP-DB] Re: HTTP Auth for PHPMyAdmin

2004-12-22 Thread Mark Benson
Martin Norland wrote:

>What do you mean proper HTTP authorization for PHPMyAdmin - do you want
>it to log you in automatically, or do you want to use .htaccess to
>protect your PHPMyAdmin scripts?
>
>By your statement of config file, and talking about PHPMyAdmin - I'm
>assuming that you've configured it to automatically log you in - in
>which case I would suggest you verify you can login with the same exact
>paramters on its normal login, as well as confirming that the parameters
>are indeed set when it attempts to check them.

Sorry I was being chased out of the building at the end of the day when I was 
writing that e-mail :)

What I meant was I want to setup phpMyAdmin so that a login is required when 
you access the pages (i.e. you must enter a u/n and pwd in a dialog).
Currently my config.inc.php is set so that the 
'$cfg['Servers'][$i]['auth_type'] = 'config'; and I supply the MySQL user 
and pwd in the config.inc.php and it connects automatically. This is not ideal 
as I'd like to prevent others accessing it, for security and integrity reasons.

If I set the config.inc.php value to '$cfg['Servers'][$i]['auth_type'] = 
'http';' then it will show a login dialog on connection but any u/n and pwd I 
try (based on the MySQL grant tables) is rejected.

What I need to know is what is the best way to limit access to the pages, do I 
ignore the config.inc.php and setup some other system or can i use the grant 
tables from my MySQL server?

Ideally I would want to log into the MySQL server as either my normal 'dbadmin' 
user OR 'root' as only 'root' has alteration rights on the grant tables so 
stuff that is outside the auspices of normal admin is easier to carry out (i.e. 
doesn't involve me hacking the config.inc.php all the time).

-- 
Mark Benson

http://homepage.mac.com/markbenson

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



[PHP-DB] HTTP Auth for PHPMyAdmin

2004-12-21 Thread Mark Benson
What do i need to do to enable proper HTTP authorisation for PHPMyAdmin?

I enabled it in the config  file, but it rejects my attempts to login.


-- 
Mark Benson

http://homepage.mac.com/markbenson

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



[PHP-DB] PHP, MySQL and phpMyAdmin versions...

2004-12-17 Thread Mark Benson
I am running MySQL 3.23.49 under Windows NT (XP Home). I also run PHP 4.3.9 on 
the same server, and use phpMyAdmin 2.6.0-pl2 for admin to my databases. I 
cannot upgrade to MySQL 4.x becuase apparently the MySQL API included with my 
PHP distro is not up to date enough to work with the revised security system in 
MySQL 4. I can't find a newer or better binary distro of PHP4 with a more 
suitable API, nor do i have the time, facilities or knowledge to bake my own 
from the source.

Any suggestions, as I really need some of the facilities in MySQL 4.1.x?

P.S. for Matrin Nowland - thanks for the help on the 'ON DUPLICATE KEY UPDATE' 
thing, I didn't realise it was a new thing in MySQL 4.1.0! 

-- 
Mark Benson

http://homepage.mac.com/markbenson

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



RE: [PHP-DB] Spot the deliberate mistake...

2004-12-16 Thread Mark Benson
 
On Thursday, December 16, 2004, at 05:21PM, Norland, Martin <[EMAIL PROTECTED]> 
wrote:

>"INSERT INTO `foobar2` SET part_no='$data[0]', foo_no='$data[1]',
>alt_no='$data[2]', descript='$data[3]', price='$data[4]',
>unit_sale='$data[5]', unit_issue='$data[6]', weight='$data[7]',
>brand='$data[8]', nla_tag='0' ON DUPLICATE KEY UPDATE;"
>
>It's implicit that you use the same data regardless, you're saying "if
>it's already there, just do an update statement with the data already
>provided".

If I try that it returns:

You have an error in your SQL syntax near 'ON DUPLICATE KEY UPDATE' at line 1

so I guess something doesn't work there. I also tried it with and without the 
line ending and it didn't work either way :).

-- 
Mark Benson

http://homepage.mac.com/markbenson

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


[PHP-DB] Spot the deliberate mistake...

2004-12-16 Thread Mark Benson
The following SQL statement returns an error. What is wrong with it? The error 
is stated as being near 'ON DUPLICATE KEY UPDATE foo_no='$data[1]', 
alt_no='$data[2]', descript='$data[3]', pr'

"INSERT INTO `foobar2` SET part_no='$data[0]', foo_no='$data[1]', 
alt_no='$data[2]', descript='$data[3]', price='$data[4]', unit_sale='$data[5]', 
unit_issue='$data[6]', weight='$data[7]', brand='$data[8]', nla_tag='0' ON 
DUPLICATE KEY UPDATE foo_no='$data[1]', alt_no='$data[2]', descript='$data[3]', 
price='$data[4]', unit_sale='$data[5]', unit_issue='$data[6]', 
weight='$data[7]', brand='$data[8]', nla_tag='0'"

This is passed in a PHP script so the line ending ';' is not present.

I'm getting better at writing SQL statements but sometimes it just throws me a 
total curved ball!

-- 
Mark Benson

http://homepage.mac.com/markbenson

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


RE: [PHP-DB] Using a loop on a result destroys array??

2004-11-24 Thread Mark Benson
 
On Wednesday, November 24, 2004, at 02:40PM, Norland, Martin <[EMAIL 
PROTECTED]> wrote:

>The real problem you're having is the statement says "while there are
>results in this query, grab them" - once you reach the end of the first
>while loop, there are no more results, so the second one is skipped
>right over - it's condition *never* evaluates true.

So by running a "while (mysql_fetch_array($result)" loop over a fetch array you 
effectively empty it?

>If the query isn't changing, and there aren't other conditions/etc. -
>then just grab all the data the first time through and put it where it
>needs to go.

OK, sounds like a plan...

Sorry (again) about the code gaffs :-S

-- 
Mark Benson

http://homepage.mac.com/markbenson

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



RE: [PHP-DB] Using a loop on a result destroys array??

2004-11-24 Thread Mark Benson
 
On Wednesday 24 November 2004 20:31, Mark Benson wrote:

>> From the above code,

>Actually the above code would result in a parse error. There are no 
>where-loops in PHP but there are while-loops. This is not being pedantic. If 
>you're going to post code, make sure it's verbatim by using "copy and paste" 
>your actual code.

I cannot possibly do this as I am working on a commercially sensitive project 
and am instructed by my managing bodies not to quote actual code in case it 
contains sensetive data. Sorry if that is not how you like it but that is how I 
have to work. I can understand it must be frustrating for experienced members 
but alas I'm tied, I try my best...

>You want people to focus on your real problem and not on 
>the mistakes you made in transcribing your actual code into your post.

I actually write (rather badly it would seem!) theoretical examples that would 
(or in this case wouldn't!!) end in the same situation as the problem in my 
code (as I see it). 

>> loop 2 returns a blank array, the output is simply 
>> "Array ()". If I remove the loop (by commentiung it out) that extracts
>> $crab the mysql $result array is suddenly full of the correct values. It
>> seems to me that loop 1 is destroying or somehow not resetting $result.
>> Very odd...

>mysql_data_seek() is what you need. Or you can consider storing the results 
>into an array the first time round then you can read results from the array 
>whenever next you need it.

Thanks I'll try that.

-- 
Mark Benson

http://homepage.mac.com/markbenson

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



[PHP-DB] Using a loop on a result destroys array??

2004-11-24 Thread Mark Benson
I have another issue. I have a fairly large script that requires data to be 
read for 2 separate purposes from the results of the same query. e.g.:

=







=

>From the above code, loop 2 returns a blank array, the output is simply "Array 
>()". If I remove the loop (by commentiung it out) that extracts $crab the 
>mysql $result array is suddenly full of the correct values. It seems to me 
>that loop 1 is destroying or somehow not resetting $result. Very odd...

-- 
Mark Benson

http://homepage.mac.com/markbenson

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



[PHP-DB] Currency and number types...

2004-11-19 Thread Mark Benson
I'm trying to display data calculated by my script as a currency. The problem I 
have is that PHP is treating the results of the math as a 'float' number (or 
'double') so I am getting results like:

12.0594393

in my table. I have tried using:

print round($foobar,2)

but that cuts off the trailing zero on numbers that comne out as, for example 
'12.10' or '12.00'.

Does anyone know a way to force PHP to print numbers to a set number of 
significant figures (i.e. 2) and stop the trailing zero suppression?

-- 
Mark Benson

http://homepage.mac.com/markbenson

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



[PHP-DB] perl module to filter data to prevent SQL injection

2004-11-07 Thread Mark-Walter
Hello,

I'am searching for a perl module to prevent SQL
injection. Target is a simple logfile I need to
analyse.

I read the manpage from DBI where the function
quote has been discussed, but not sure if this
is the correct way. 

-- 
Best Regards,

Mark

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



[PHP-DB] how to filter data to prevent SQL injection

2004-11-05 Thread Mark-Walter
Hi,

I'am searching for a perl module to prevent SQL
injection. Target is a simple logfile I need to
analyse.

I read the manpage from DBI where the function
quote has been discussed, but not sure if this
is the correct way. 

-- 
Best Regards,

Mark

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



[PHP-DB] Parsing CSV files into a MySQL Table

2004-11-02 Thread Mark Benson
Hi, newbie here, go easy on me I'm learning this as I go ;)

Got a bit of teaser here.

//http://foo.com/foolist.csv";);

foreach($csvfile as $line_no => $datastring) {
$data = explode (",", $datastring);
$foo1 = $data[0];
$foo2 = $data[1];
$foo3 = $data[2];
$foo4 = $data[3];
$foo5 = $data[4];
$foo6 = $data[5];
$foo7 = $data[6];

mysql_query ("INSERT INTO 'footable' (foo1, foo2, foo3, foo4, foo5, foo6, 
foo7) 
VALUES '$foo1', '$foo2', '$foo3', '$foo4', '$foo5', '$foo6', 
'$foo7')");
}

//?>

The result of the above is I get nothing INSERT-ed in 'footable'. No lines of data at 
all. I looked in the table using phpMyAdmin and zilch.

I have however dumped the contents of each variable in the 'foreach' loop to the 
screen in a table and it all maps out correctly as i was in the CSV file, so the CSV 
file is being parsed correctly. The fault seems to be in the MySQL query I think.
Privilages have no influence - I've tried both the database's 'regular' users and also 
the 'root' user and it makes no odds.
I've also tried dumping the list of single variables and using '($data[0], $data[1] 
etc...) and that has no effect.

It's probably something glaringly obvious to an expert but as I say I'm learning as I 
go so any help would be great :)

Thx.

-- 
Mark Benson

http://homepage.mac.com/markbenson

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



[PHP-DB] Insert and Update on same page

2004-11-01 Thread Bomgardner, Mark A
I've got a problem with trying to insert and updating on the same page.
Here is my problem:

 

I have a form that the user fills out.  Upon submission, I want the
information that was just inserted, to be pulled back out and shows to
the user with an unique number for that record other than the record ID
field.  I can use the ID field together with another value to get the
unique number that I want, but it would require a insert, select and
update in one shot.  Is this possible?

 

I hope I have not confused everybody  

 

Mark A. Bomgardner 
Technology Specialist 
KLETC 

 



[PHP-DB] Time Field

2004-10-28 Thread Bomgardner, Mark A
When creating a time field in MySQL, its purpose is for elapsed time,
not time of day.  Is it better to use this field or to combine it with
the date field when looking at inserting the start date and time of an
event? 

 

Mark A. Bomgardner 
Technology Specialist 
KLETC 

 



[PHP-DB] Date Question

2004-10-27 Thread Bomgardner, Mark A
I am having trouble converting a date from mm/dd/ to -mm-dd on a
user form.  I know there was post about this, but I keep getting an
error message when I try to search the archives.

 

I have looked at the manual, but I am not finding what I am looking for.

 

Mark A. Bomgardner 
Technology Specialist 
KLETC 

 



Re: [PHP-DB] delete time related data inside a table within 1 hour

2004-10-26 Thread Mark-Walter
Hi Martin,

> http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html says
> that's the right format.  Are you sure you're storing the time and not
> just the date?  I'd wager that it will delete immediately if you are
> only storing the date.

I agree as it is the right format but when I use INTERVAL 1 HOUR it 
deletes it immediately.

The used column is date and time related 2004-10-24 07:42:34 and
work's fine while using INTERVAL -1 DAY.

-- 
Best Regards,

Mark

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



[PHP-DB] delete time related data inside a table within 1 hour

2004-10-25 Thread Mark-Walter
Hello,

to delete old entries within 1 one day I use this:

$sql = ("DELETE FROM orders WHERE time_date < DATE_ADD(NOW(), INTERVAL
-1 DAY)");

Now I would like to delete within a timeframe of 1 hour.

But when I change the above statement to 1 hour or -1 hour it deletes 
immediately.

Maybe someone could help me at this point.

-- 
Best Regards,

Mark

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



RE: [PHP-DB] Importing Excel and Access data to MySQL

2004-10-08 Thread Bomgardner, Mark A
The best way I have found is convert the data to a comma separated value
file, use phpMyAdmin and insert the data into you database. A couple of
things that you have to watch out for is the number of records that you
are importing and that all your fields in your DB are of the correct
format and length.

Mark A. Bomgardner
Technology Specialist
KLETC


-Original Message-
From: Matthew Perry [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 07, 2004 9:46 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Importing Excel and Access data to MySQL

Simple question,
How does one import excel and access data to MySQL?
-- Matthew Perry

-- 
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] Error with addition of second

2004-09-18 Thread Mark

--- [EMAIL PROTECTED] wrote:

> Dear friends,
> 
> With 4 radio buttons and php snippet, it gives desired output,
> however when I 
> add second question in the html form and variable for the same like
> $variable =$_POST['q'] in Php snippet 
> it gives me error.
> 
> I have pasted php code when it works and when it gives error.

Did you read the error? It's pretty explicit.
> 
> Any guidance, please.
> 
>
--
> Error
>
--
> ---
> Parse error: parse error, unexpected ',' in
> C:\HOME\doctorbush\quiz.php on 
> line 10
>
--
> -
> php snnipet, code which it works with Q-1
>
---
>  
> $variable = $_POST['R']  ; 
> 
>  if ($variable == 3) {
> 
>   echo   "Score 1;
> 
>   }
>   else {
>   echo  "Score 0";
> 
>   };
> ?>
> --
> php snippet when it gives error with addition of second question
>

> 
> 
>  
> $variable = $_POST['R']  ; 
> $secondvar = $_POST['q']  ; 
> 
> 
> 
>  if ($variable == 3, $secondvar== 4) {

This is not a valid PHP statement. Do you mean AND, or OR? the error
said line 10, right? This must be line 10. There is only one comma in
it.

Depending on what you mean, either use:

1- if ($variable == 3 AND $secondvar== 4) {

or

2 if ($variable == 3 OR $secondvar== 4) {


> 
> 
> 
>   echo   "Score 1;
> 
>   }
>   else {
>   echo  "Score 0";
> 
>  ?>
> --
> Html form code
>
---
> 
> 
> 
>   
> 
> 
> 
> 
> 
> 
>  Q-1)Law of diminished return is ;
>  
> Medical concept  
>  
> Economic   
>   Agriculture   
>  
>   Computers 
>
> 

Also, you shouldn't have all of the radio buttons associated with the
same variable checked. In fact, if this is a quiz, none should be
checked.

And this last question doesn't even make sense :-)

> 
> Q-2)Once there is inflation ;
>  
> Government has to print extra currency  
>  
> Inflation is good for economy 
>   
> Inflation is diastrous for economy
>   
> Inflation is not of much concern 
> 
> 
> 
> 
> 
> 
> 
> 


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a "right" unless you are willing to fight to death to 
defend everyone else's right to the same thing.
***



__
Do you Yahoo!?
Y! Messenger - Communicate in real time. Download now. 
http://messenger.yahoo.com

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



Re: [PHP-DB] mysql_connect dies silently

2004-09-13 Thread Mark Boyle
If you have access to your php.ini file, take a look for the Error
Reporting settings. It may be set to none, to to log the errors to
syslogd or a file.

Mark


On Mon, 13 Sep 2004 12:48:33 +0200, Christian Schlaefcke
<[EMAIL PROTECTED]> wrote:
> Hi Folks,
> 
> I have a problem getting a php script running. It seems that the script
> just dies when calling the function mysql_connect("host", "username",
> "passwd"). I put two debugging echoes (one in front and one afterwards)
> in the script but only the first one appears.
> 
> There are no errormessages. How can I debug this problem?
> 
> PHP Version 4.3.8
> Option "--with-mysql=shared,/usr" is set.
> 
> Thanks & Regards,
> 
> Christian
> 
> --
> 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] Insert Query PROBLEMS

2004-09-10 Thread Mark

--- Aaron Todd <[EMAIL PROTECTED]> wrote:

> I'm trying to run an INSERT query on my mysql database and it isnt
> working.
> 
> Here is the query:
> $updatequery = "UPDATE `users`
>   SET 
>
('company','fname','lname','address1','address2','city','state','zip','phone','extension','fax','email')
> 
> =
>  
>
('".$_POST['company']."','".$_POST['fname']."','".$_POST['lname']."','".$_POST['address1']."','".$_POST['address2']."','".$_POST['city']."','".$_POST['state']."','".$_POST['zip']."','".$_POST['phone']."','".$_POST['extension']."','".$_POST['fax']."','".$_POST['email']."')
>   WHERE `ID`='".$_GET['record']."'";
> 
> When I echo this it looks fine, but nothing in the database
> reflects the 
> change.  I have tried cutting it down to only the first 2 colums
> and then it 
> works.  But I cant see a syntax error that would cause this not to
> work. 
> Does anyone have any idea why this might not be working.

1-You've got GET and POST mixed together in your query. Is this
intentional?

2-You're using single quotes on the field names. Did you intend to
use ticks?

3-Have you tried pasting the resulting query into either a command
line or admin tool to see if MySQL is choking on something? One thing
that had me pulling out my hair for a few hours was I had NOT NULL on
a field in the DB, and one of the fields being updated was being
populated with a NULL. 

Also, if PHP is not giving you an error message, check your reporting
level to make sure it should be giving you one.

Finally, just a suggestion - you might want to consider rewriting
queries like this to make them more readable:

$updatequery = 
"UPDATE users
SET company   = '".$_POST['company']."',".
"fname     = '".$_POST['fname']."',".
"lname = '".$_POST['lname']."',".
"address1  = '".$_POST['address1']."',".
"address2  = '".$_POST['address2']."',".
"city  = '".$_POST['city']."',".
"state = '".$_POST['state']."',".
"zip   = '".$_POST['zip']."',".
"phone = '".$_POST['phone']."',".
"extension = '".$_POST['extension']."',".
"fax   = '".$_POST['fax']."',".
"email = '".$_POST['email']."'".
"WHERE ID='".$_GET['record']."'";


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



=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a "right" unless you are willing to fight to death to 
defend everyone else's right to the same thing.
***



__
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail

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



Re[2]: [PHP-DB] Re: Building A Web Site Search Engine Using PHP / mySQL

2004-09-08 Thread Mark Wylie
Joseph> are you saying Orase uses phpdig?

No. Only that phpdig uses PHP & MySQL.

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



Re: [PHP-DB] Re: Building A Web Site Search Engine Using PHP / mySQL

2004-09-08 Thread Mark Wylie
http://www.phpdig.net/

Uses both PHP and MySQL.

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



Re: [PHP-DB] php-db@lists.php.net is currently protecting themselves from receiving junk mail using Spamcease Just this once, click the link below so I can receive your emails.

2004-08-05 Thread Mark
It is bogus. If you notice, your emails still go to the list. Someone
did this to php-general a bit ago. You can ignore it. There was
speculation that it was an email harvester, checking to verify that
return addresses are valid.


--- Colin Kettenacker <[EMAIL PROTECTED]> wrote:

> I got this for the PHP-General list. I think it's bogus but it
> would be nice
> to get a confirmation from the list admin.
> 
> ck
> -- 
> Cheap Domain Registration | Web Hosting | Email Packages | + more
> Fantastic prices -- Even better service.
> http://www.hosttohost.net
> 
> 
> Pablo M. Rivas [EMAIL PROTECTED] on 8/4/04 9:57 AM wrote:
> 
> > Hello Josh,
> > 
> > JAM> What is this?
> > 
> > JAM> I received this E-Mail, and the link goes to something other
> than PHP.net
> > 
> > JAM> [EMAIL PROTECTED] is currently protecting themselves from
> receiving
> > junk
> > JAM> mail using Spamcease Just this once, click the link below so
> I can
> > receive
> > JAM> your emails.
> > JAM> You won't have to do this again.
> > 
> > 
> > CLICK THE LINK SO HE CAN RECEIVE YOUR MAIL, and you won't have to
> > do this again ;)
> > 
> > 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a "right" unless you are willing to fight to death to 
defend everyone else's right to the same thing.
***



__
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

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



RE: [PHP-DB] LAMP

2004-08-03 Thread Galbreath, Mark A
SuSE 9.1 Pro

Mark

-Original Message-
From: Gavin Amm [mailto:[EMAIL PROTECTED]
Sent: Monday, August 02, 2004 8:40 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] LAMP


I'd really like to find a Linux distro that is a LAMP system right out
of the box.
(Linux, Apache, MySQL, PHP)
Are there any out there?

Cheers,
Gav

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

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



RE: [PHP-DB] PHP use in Federal Govt

2004-07-16 Thread Galbreath, Mark A
Thanks, David - I'm doing that at this moment   :-)

-Original Message-
From: David Orlovich [mailto:[EMAIL PROTECTED]
Sent: Friday, July 16, 2004 4:05 PM
To: Galbreath, Mark A
Cc: '[EMAIL PROTECTED]'
Subject: Re: [PHP-DB] PHP use in Federal Govt


Mark, a Google search with ".php .gov" turns up web pages in US 
government sites that use php.  It's trial and error, but I see 
government agencies appearing here and there.  HTH.  David.

On 17/07/2004, at 7:57 AM, Galbreath, Mark A wrote:

> Alls,
>
> My division at State is trying to get PHP 5.0 approved for use by 
> developers
> in the Department, and the Powers That Be are requesting evidence that 
> other
> Federal agencies/military are using PHP, and the extent of it's use.
>
> Anybody have a clue about this?  I sure would appreciate some help!
>
> tia,
> Mark
>
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Dr David Orlovich,
Department of Botany,
University of Otago,
P.O. Box 56,
Dunedin,
New Zealand.

Phone: +643 479 9060
Fax: +643 4769 7583

-- 
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] PHP use in Federal Govt

2004-07-16 Thread Galbreath, Mark A
Alls,

My division at State is trying to get PHP 5.0 approved for use by developers
in the Department, and the Powers That Be are requesting evidence that other
Federal agencies/military are using PHP, and the extent of it's use.

Anybody have a clue about this?  I sure would appreciate some help!

tia,
Mark

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



  1   2   3   4   >