Re: [PHP] Single Quotes in Form Inputs

2009-07-28 Thread Michael A. Peters

Ben Dunlap wrote:

 You can use http://us.php.net/mysql_real_escape_string to escape the
input.

[8<]

You should prep your data for insertion into the data by using a tool
that formats it strictly for the database.  In the ops case
mysql_real_escape_string() is the correct tool for the job.


What about using prepared statements? This is my preferred method of 
"escaping output" when I'm using variables in a database query. Of 
course the ease and convenience of this method will depend to a great 
extent on what version of PHP is available on the server.


For the OP, have you read up much on SQL injection? If not, here's a 
decent place to start: http://www.owasp.org/index.php/SQL_injection


Ben



Prepared statements are what I use.

-=-

The problem I have with htmlentities is that the entities are only 
guaranteed for html. Many of the entities do not work in other sgml or 
xml applications, it is better to just use the numbered entity (IE 
  for a non breaking space) or for things like smart quotes, 
possessive apostraphe's, etc. - the proper utf8 character directly (make 
sure to serve document as utf8 encoded and that your database is set to 
utf8)


I found that out the hard way, and had to redo a lot of stuff where I 
previously used the php htmlentities function. Using the function to 
spit out html is fine, but to write functions / classes you can re-use 
in non html documents, you should avoid it all together.


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



[PHP] Font problem

2009-07-28 Thread Dušan Novaković
Hi,

Is there a possibility that if there is no font installed on client
side somehow browser finds it and redirect that font form server to
client machine. For example: I have site that use Microsoft font and
that font is not available on Linux distributions. So when u open page
in FF on some Linux u get some default font (because browser doesn't
recognize that font). I hope that I've managed to explane a problem
:-) Does anyone has any solution for this problem??? Please it's very
urgent

Thanks,
Dusan

-- 
made by Dusan

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



Re: [PHP] Font problem

2009-07-28 Thread Ashley Sheridan
On Tue, 2009-07-28 at 12:07 +0200, Dušan Novaković wrote:

> Hi,
> 
> Is there a possibility that if there is no font installed on client
> side somehow browser finds it and redirect that font form server to
> client machine. For example: I have site that use Microsoft font and
> that font is not available on Linux distributions. So when u open page
> in FF on some Linux u get some default font (because browser doesn't
> recognize that font). I hope that I've managed to explane a problem
> :-) Does anyone has any solution for this problem??? Please it's very
> urgent
> 
> Thanks,
> Dusan
> 
> -- 
> made by Dusan
> 

Basically that's a big no. At the moment, there is no cross-browser way
to determine if a font is installed on an end system. The best you can
do is to use either a graphic in-place of the text, or use something
like siFr. Both of these methods are only suitable for headings though.

Have you looked at what standard fonts are available to you? The list at
http://www.ampsoft.net/webdesign-l/WindowsMacFonts.html is quite good at
showing these. You can use CSS to give fallback fonts in order of what
you prefer.

There are meant to be plans on how to handle these sorts of situations
in CSS3 though, but you may have to wait a year for the browsers to
adopt!

Thanks,
Ash
http://www.ashleysheridan.co.uk


[PHP] Re: Correct code ?? PHP Basic pw athentication with mysql

2009-07-28 Thread WebPat
Normally on a newsgroup you will have to give more information if you 
want people to respond. Most people don't simply want to read your code 
and figure out what you are finding wrong. You don't even say what the 
problem is. You are probably getting some kind of response to your code.


Also, look at your logs for Apache or whatever web server you are using, 
and for Mysql. They may tell you what is wrong.


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



[PHP] Making several variables into 1 variable

2009-07-28 Thread Miller, Terion
I need to take this:

   $pastDays = strtotime("-30 days");



$past_day = date("d", $pastDays);

$past_month = date("m", $pastDays);

$past_year =date("y", $pastDays);


And make it into one var to compare to a db field that is formatted like
00/00/00 


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



Re: [PHP] Making several variables into 1 variable

2009-07-28 Thread Ashley Sheridan
On Tue, 2009-07-28 at 09:32 -0400, Miller, Terion wrote:
> I need to take this:
> 
>$pastDays = strtotime("-30 days");
> 
> 
> 
> $past_day = date("d", $pastDays);
> 
> $past_month = date("m", $pastDays);
> 
> $past_year =date("y", $pastDays);
> 
> 
> And make it into one var to compare to a db field that is formatted like
> 00/00/00 
> 
> 
Erm, why don't you do this:

$pastDays = strtotime("-30 days");
$date = date("d/m/y", $pastDays);

The date() function allows you to mix in all sorts of characters into
the output it formats, and you can escape characters that have special
meaning with a slash '\' character.

Thanks,
Ash
http://www.ashleysheridan.co.uk


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



[PHP] Re: Making several variables into 1 variable

2009-07-28 Thread Jo�o C�ndido de Souza Neto
Why not this:

$pastDate = date("d/m/y", strtotime("-30 days"));


""Miller, Terion""  escreveu na mensagem 
news:c6946809.4183%kmille...@springfi.gannett.com...
I need to take this:

   $pastDays = strtotime("-30 days");



$past_day = date("d", $pastDays);

$past_month = date("m", $pastDays);

$past_year =date("y", $pastDays);


And make it into one var to compare to a db field that is formatted like
00/00/00



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



Re: [PHP] Making several variables into 1 variable

2009-07-28 Thread Richard S. Crawford
On Tue, Jul 28, 2009 at 6:32 AM, Miller,
Terion wrote:
> I need to take this:
>
>   $pastDays = strtotime("-30 days");
>
>
>
> $past_day = date("d", $pastDays);
>
> $past_month = date("m", $pastDays);
>
> $past_year =date("y", $pastDays);
>
>
> And make it into one var to compare to a db field that is formatted like
> 00/00/00

Try:

$past_date = date("m/d/y", $pastDays)

Or even:

$past_date = date ("m/d/y", time() - 2592000)

(where 2592000 is 30 * 86400, and 86400 is the number of seconds in one day.)




-- 
Richard S. Crawford (rscrawf...@mossroot.com)
http://www.mossroot.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)

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



Re: [PHP] Making several variables into 1 variable

2009-07-28 Thread Miller, Terion



On 7/28/09 8:35 AM, "Ashley Sheridan"  wrote:

$pastDays = strtotime("-30 days");
$date = date("d/m/y", $pastDays);

Well I tried and got no results from my query and I know there results with 
date ranges in the last 30 days, I basically need to count backward from now() 
30 days I thought strtotime() would work well..but the fields in the db are 
varchar not date fields they are all formatted the same though 00/00/00:

  $sql = "SELECT DISTINCT restaurants.ID, name, address, inDate FROM 
restaurants, inspections WHERE restaurants.name != '' AND inspections.inDate <= 
$date GROUP BY restaurants.ID ORDER BY 'name' ";

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



RE: [PHP] Making several variables into 1 variable

2009-07-28 Thread Bob McConnell
From: Ashley Sheridan
> On Tue, 2009-07-28 at 09:32 -0400, Miller, Terion wrote:
>> I need to take this:
>> 
>>$pastDays = strtotime("-30 days");
>> 
>> 
>> 
>> $past_day = date("d", $pastDays);
>> 
>> $past_month = date("m", $pastDays);
>> 
>> $past_year =date("y", $pastDays);
>> 
>> 
>> And make it into one var to compare to a db field that is formatted
like
>> 00/00/00 
>> 
>> 
> Erm, why don't you do this:
> 
> $pastDays = strtotime("-30 days");
> $date = date("d/m/y", $pastDays);
> 
> The date() function allows you to mix in all sorts of characters into
> the output it formats, and you can escape characters that have special
> meaning with a slash '\' character.

The problem with that is if that field is a string, and not formatted as
YY/MM/DD, then a simple compare won't work in January. You have to break
it down into the three components and compare each one in turn.

Bob McConnell

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



Re: [PHP] Making several variables into 1 variable

2009-07-28 Thread Ashley Sheridan
On Tue, 2009-07-28 at 09:42 -0400, Miller, Terion wrote:
> 
> 
> On 7/28/09 8:35 AM, "Ashley Sheridan"  wrote:
> 
> $pastDays = strtotime("-30 days");
> $date = date("d/m/y", $pastDays);
> 
> Well I tried and got no results from my query and I know there results with 
> date ranges in the last 30 days, I basically need to count backward from 
> now() 30 days I thought strtotime() would work well..but the fields in the db 
> are varchar not date fields they are all formatted the same though 00/00/00:
> 
>   $sql = "SELECT DISTINCT restaurants.ID, name, address, inDate FROM 
> restaurants, inspections WHERE restaurants.name != '' AND inspections.inDate 
> <= $date GROUP BY restaurants.ID ORDER BY 'name' ";
> 

I believe the query is suspect. From memory, don't you need to enclose
dates in single quotes in MySQL statements? Also, I believe it uses
American data format, so you might have to put the month before the day
like was in Richards example.

Thanks,
Ash
http://www.ashleysheridan.co.uk


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



Re: [PHP] Making several variables into 1 variable

2009-07-28 Thread Miller, Terion



On 7/28/09 8:41 AM, "Bob McConnell"  wrote:

From: Ashley Sheridan
> On Tue, 2009-07-28 at 09:32 -0400, Miller, Terion wrote:
>> I need to take this:
>>
>>$pastDays = strtotime("-30 days");
>>
>>
>>
>> $past_day = date("d", $pastDays);
>>
>> $past_month = date("m", $pastDays);
>>
>> $past_year =date("y", $pastDays);
>>
>>
>> And make it into one var to compare to a db field that is formatted
like
>> 00/00/00
>>
>>
> Erm, why don't you do this:
>
> $pastDays = strtotime("-30 days");
> $date = date("d/m/y", $pastDays);
>
> The date() function allows you to mix in all sorts of characters into
> the output it formats, and you can escape characters that have special
> meaning with a slash '\' character.

The problem with that is if that field is a string, and not formatted as
YY/MM/DD, then a simple compare won't work in January. You have to break
it down into the three components and compare each one in turn.

Bob McConnell

Hi Bob, they are all formatted in the db as mm/dd/yy

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



Re: [PHP] Font problem

2009-07-28 Thread Richard S. Crawford
2009/7/28 Dušan Novaković :
> Hi,
>
> Is there a possibility that if there is no font installed on client
> side somehow browser finds it and redirect that font form server to
> client machine. For example: I have site that use Microsoft font and
> that font is not available on Linux distributions. So when u open page
> in FF on some Linux u get some default font (because browser doesn't
> recognize that font). I hope that I've managed to explane a problem
> :-) Does anyone has any solution for this problem??? Please it's very
> urgent

Not really, no. The choice of font is up to the user's browser.

However, you can, with CSS, set some basic parameters. If, say, you
want to ensure that the users sees a sans-serif font on their browser,
you can use:

font-family: arial, helvetica, verdana, sans-serif

This basically says, ensure that the browser uses arial; if arial
isn't available, use helvetica; if helvetica isn't available, use
verdana; and if verdana isn't available, use whatever sans-serif font
the user has installed on their computer.

Look up the font-family attribute for CSS on the web. There's too much
detail to go into and this is a PHP list, not a CSS list.


-- 
Richard S. Crawford (rscrawf...@mossroot.com)
http://www.mossroot.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)

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



RE: [PHP] Making several variables into 1 variable

2009-07-28 Thread Ashley Sheridan
On Tue, 2009-07-28 at 09:41 -0400, Bob McConnell wrote:
> From: Ashley Sheridan
> > On Tue, 2009-07-28 at 09:32 -0400, Miller, Terion wrote:
> >> I need to take this:
> >> 
> >>$pastDays = strtotime("-30 days");
> >> 
> >> 
> >> 
> >> $past_day = date("d", $pastDays);
> >> 
> >> $past_month = date("m", $pastDays);
> >> 
> >> $past_year =date("y", $pastDays);
> >> 
> >> 
> >> And make it into one var to compare to a db field that is formatted
> like
> >> 00/00/00 
> >> 
> >> 
> > Erm, why don't you do this:
> > 
> > $pastDays = strtotime("-30 days");
> > $date = date("d/m/y", $pastDays);
> > 
> > The date() function allows you to mix in all sorts of characters into
> > the output it formats, and you can escape characters that have special
> > meaning with a slash '\' character.
> 
> The problem with that is if that field is a string, and not formatted as
> YY/MM/DD, then a simple compare won't work in January. You have to break
> it down into the three components and compare each one in turn.
> 
> Bob McConnell
> 
I assumed that the date field in MySQL was a date or datetime type. It
would be a little silly to store dates in the database any other way?

Thanks,
Ash
http://www.ashleysheridan.co.uk


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



Re: [PHP] Making several variables into 1 variable

2009-07-28 Thread Miller, Terion



On 7/28/09 8:44 AM, "Ashley Sheridan"  wrote:

On Tue, 2009-07-28 at 09:42 -0400, Miller, Terion wrote:
>
>
> On 7/28/09 8:35 AM, "Ashley Sheridan"  wrote:
>
> $pastDays = strtotime("-30 days");
> $date = date("d/m/y", $pastDays);
>
> Well I tried and got no results from my query and I know there results with 
> date ranges in the last 30 days, I basically need to count backward from 
> now() 30 days I thought strtotime() would work well..but the fields in the db 
> are varchar not date fields they are all formatted the same though 00/00/00:
>
>   $sql = "SELECT DISTINCT restaurants.ID, name, address, inDate FROM 
> restaurants, inspections WHERE restaurants.name != '' AND inspections.inDate 
> <= $date GROUP BY restaurants.ID ORDER BY 'name' ";
>

I believe the query is suspect. From memory, don't you need to enclose
dates in single quotes in MySQL statements? Also, I believe it uses
American data format, so you might have to put the month before the day
like was in Richards example.

Thanks,
Ash
http://www.ashleysheridan.co.uk



Ah ha bet that's it didn't notice the euro/brit date formatting there. Lol 
thanks guys!

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



Re: [PHP] Making several variables into 1 variable

2009-07-28 Thread Ashley Sheridan
On Tue, 2009-07-28 at 06:46 -0700, Miller, Terion wrote:

> 
> 
> On 7/28/09 8:44 AM, "Ashley Sheridan"  wrote:
> 
> On Tue, 2009-07-28 at 09:42 -0400, Miller, Terion wrote:
> >
> >
> > On 7/28/09 8:35 AM, "Ashley Sheridan"  wrote:
> >
> > $pastDays = strtotime("-30 days");
> > $date = date("d/m/y", $pastDays);
> >
> > Well I tried and got no results from my query and I know there results with 
> > date ranges in the last 30 days, I basically need to count backward from 
> > now() 30 days I thought strtotime() would work well..but the fields in the 
> > db are varchar not date fields they are all formatted the same though 
> > 00/00/00:
> >
> >   $sql = "SELECT DISTINCT restaurants.ID, name, address, inDate FROM 
> > restaurants, inspections WHERE restaurants.name != '' AND 
> > inspections.inDate <= $date GROUP BY restaurants.ID ORDER BY 'name' ";
> >
> 
> I believe the query is suspect. From memory, don't you need to enclose
> dates in single quotes in MySQL statements? Also, I believe it uses
> American data format, so you might have to put the month before the day
> like was in Richards example.
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 
> 
> 
> Ah ha bet that's it didn't notice the euro/brit date formatting there. Lol 
> thanks guys!
> 

Euro/Brit date formatting? Nah, it's proper data formatting, not what
you crazy Yanks do! ;)


Thanks,
Ash
http://www.ashleysheridan.co.uk


Re: [PHP] Making several variables into 1 variable

2009-07-28 Thread Bastien Koert
On Tue, Jul 28, 2009 at 9:46 AM, Miller,
Terion wrote:
>
>
>
> On 7/28/09 8:44 AM, "Ashley Sheridan"  wrote:
>
> On Tue, 2009-07-28 at 09:42 -0400, Miller, Terion wrote:
>>
>>
>> On 7/28/09 8:35 AM, "Ashley Sheridan"  wrote:
>>
>> $pastDays = strtotime("-30 days");
>> $date = date("d/m/y", $pastDays);
>>
>> Well I tried and got no results from my query and I know there results with 
>> date ranges in the last 30 days, I basically need to count backward from 
>> now() 30 days I thought strtotime() would work well..but the fields in the 
>> db are varchar not date fields they are all formatted the same though 
>> 00/00/00:
>>
>>   $sql = "SELECT DISTINCT restaurants.ID, name, address, inDate FROM 
>> restaurants, inspections WHERE restaurants.name != '' AND inspections.inDate 
>> <= $date GROUP BY restaurants.ID ORDER BY 'name' ";
>>
>
> I believe the query is suspect. From memory, don't you need to enclose
> dates in single quotes in MySQL statements? Also, I believe it uses
> American data format, so you might have to put the month before the day
> like was in Richards example.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
> Ah ha bet that's it didn't notice the euro/brit date formatting there. Lol 
> thanks guys!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Also check out Mysql sql date formating / date sub stuff, might make
things easier

-- 

Bastien

Cat, the other other white meat

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



Re: [PHP] Making several variables into 1 variable

2009-07-28 Thread Miller, Terion



On 7/28/09 8:52 AM, "Ashley Sheridan"  wrote:

On Tue, 2009-07-28 at 06:46 -0700, Miller, Terion wrote:



On 7/28/09 8:44 AM, "Ashley Sheridan"  wrote:

On Tue, 2009-07-28 at 09:42 -0400, Miller, Terion wrote:
>
>
> On 7/28/09 8:35 AM, "Ashley Sheridan"  wrote:
>
> $pastDays = strtotime("-30 days");
> $date = date("d/m/y", $pastDays);
>
> Well I tried and got no results from my query and I know there results with 
> date ranges in the last 30 days, I basically need to count backward from 
> now() 30 days I thought strtotime() would work well..but the fields in the db 
> are varchar not date fields they are all formatted the same though 00/00/00:
>
>   $sql = "SELECT DISTINCT restaurants.ID, name, address, inDate FROM 
> restaurants, inspections WHERE restaurants.name != '' AND inspections.inDate 
> <= $date GROUP BY restaurants.ID ORDER BY 'name' ";
>

I believe the query is suspect. From memory, don't you need to enclose
dates in single quotes in MySQL statements? Also, I believe it uses
American data format, so you might have to put the month before the day
like was in Richards example.

Thanks,
Ash
http://www.ashleysheridan.co.uk



Ah ha bet that's it didn't notice the euro/brit date formatting there. Lol 
thanks guys!

Euro/Brit date formatting? Nah, it's proper data formatting, not what you crazy 
Yanks do! ;)


Thanks,
Ash
http://www.ashleysheridan.co.uk

LOL I know we yanks bastardize everything...anyways it still didn't 
work...argh...so the boss thought he'd give me something harder...lovely, now I 
have to figure out how to reverse publish things to quarkget ready guys I 
may be blowing the list up soon with questions (like I don't already)
Terion

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



Re: [PHP] Making several variables into 1 variable

2009-07-28 Thread Ian
> On Tue, 2009-07-28 at 09:42 -0400, Miller, Terion wrote:
> > 
> > 
> > On 7/28/09 8:35 AM, "Ashley Sheridan"  wrote:
> > 
> > $pastDays = strtotime("-30 days");
> > $date = date("d/m/y", $pastDays);
> > 
> > Well I tried and got no results from my query and I know there results with 
> > date ranges in the last 30 days, I basically need to count backward from 
> > now() 30 days I thought strtotime() would work well..but the fields in the 
> > db are varchar not date fields they are all formatted the same though 
> > 00/00/00:
> > 
> >   $sql = "  SELECT DISTINCT restaurants.ID, name, address, inDate 
>>  FROM restaurants, inspections 
>>  WHERE restaurants.name != '' AND inspections.inDate <= $date 
>>  GROUP BY restaurants.ID ORDER BY 'name' ";
> > 
> 
> I believe the query is suspect. From memory, don't you need to enclose
> dates in single quotes in MySQL statements? Also, I believe it uses
> American data format, so you might have to put the month before the day
> like was in Richards example.

Hi,

Instead of using php to work out the 30 days part you could just let the 
database do it:

$sql = "SELECT DISTINCT restaurants.ID, name, address, inDate 
FROM restaurants, inspections 
WHERE restaurants.name != '' AND 

CAST(inspections.inDate AS DATE)<=  

DATE_SUB(NOW(),INTERVAL 30 DAYS)

GROUP BY restaurants.ID ORDER BY 'name' ";

You will have to check that the CAST function is working properly on your 
varchar'ed date 
fields before testing this query.  It should point you in the right direction 
though.

Regards

Ian
-- 



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



Re: [PHP] Making several variables into 1 variable

2009-07-28 Thread Floyd Resler


On Jul 28, 2009, at 9:55 AM, Miller, Terion wrote:





On 7/28/09 8:52 AM, "Ashley Sheridan"   
wrote:


On Tue, 2009-07-28 at 06:46 -0700, Miller, Terion wrote:



On 7/28/09 8:44 AM, "Ashley Sheridan"   
wrote:


On Tue, 2009-07-28 at 09:42 -0400, Miller, Terion wrote:



On 7/28/09 8:35 AM, "Ashley Sheridan"   
wrote:


$pastDays = strtotime("-30 days");
$date = date("d/m/y", $pastDays);

Well I tried and got no results from my query and I know there  
results with date ranges in the last 30 days, I basically need to  
count backward from now() 30 days I thought strtotime() would work  
well..but the fields in the db are varchar not date fields they are  
all formatted the same though 00/00/00:


 $sql = "SELECT DISTINCT restaurants.ID, name, address, inDate FROM  
restaurants, inspections WHERE restaurants.name != '' AND  
inspections.inDate <= $date GROUP BY restaurants.ID ORDER BY 'name'  
";




I believe the query is suspect. From memory, don't you need to enclose
dates in single quotes in MySQL statements? Also, I believe it uses
American data format, so you might have to put the month before the  
day

like was in Richards example.

Thanks,
Ash
http://www.ashleysheridan.co.uk



Ah ha bet that's it didn't notice the euro/brit date formatting  
there. Lol thanks guys!


Euro/Brit date formatting? Nah, it's proper data formatting, not  
what you crazy Yanks do! ;)



Thanks,
Ash
http://www.ashleysheridan.co.uk

LOL I know we yanks bastardize everything...anyways it still didn't  
work...argh...so the boss thought he'd give me something  
harder...lovely, now I have to figure out how to reverse publish  
things to quarkget ready guys I may be blowing the list up soon  
with questions (like I don't already)

Terion

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




You can also do this right within MySQL without needing to create a  
variable.  This should work:
$sql = "SELECT DISTINCT restaurants.ID, name, address, inDate FROM  
restaurants, inspections WHERE restaurants.name != '' AND  
datediff(curdate(),inspections.inDate)>=30 GROUP BY restaurants.ID  
ORDER BY 'name' ";


Take care,
Floyd


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



[PHP] Multiple MySQL Queries

2009-07-28 Thread sono-io
	This may be more of a MySQL question than PHP, but I'm hoping someone  
can point me in the right direction.  I have working code (below) that  
pulls data from a particular category in our db.  I'd like to be able  
to pull data from multiple categories in the same db and place them on  
the same page.


	I've been working on this for the last 4 days with no luck.  Some  
pages say that you can't do multiple MySQL queries while others say  
there is a workaround but I haven't found it.  Does anyone know how to  
do this?


Thanks,
Frank



 // in header

	$result = mysql_query("SELECT itemid,description,unitprice FROM  
catalog WHERE categories='" . $cat1 . "'  ORDER BY itemid",$db);


while ($item = mysql_fetch_assoc($result))
{
$item_list .= "" . $item['itemid'] . "
	$item['itemid'] . "=1\">". $item['description'] ."

$". money_format('%i', $item['unitprice']) ."
";
}
echo "Item IDDescription>(Click for more info)Price Eachth>Purchase$item_list";

?>

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



Re: [PHP] Multiple MySQL Queries

2009-07-28 Thread Bastien Koert
On Tue, Jul 28, 2009 at 10:11 AM,  wrote:
>        This may be more of a MySQL question than PHP, but I'm hoping someone
> can point me in the right direction.  I have working code (below) that pulls
> data from a particular category in our db.  I'd like to be able to pull data
> from multiple categories in the same db and place them on the same page.
>
>        I've been working on this for the last 4 days with no luck.  Some
> pages say that you can't do multiple MySQL queries while others say there is
> a workaround but I haven't found it.  Does anyone know how to do this?
>
> Thanks,
> Frank
>
> 
>
>  // in header
>
>         $item_list = "";
>        $cat1 = "01100-01200-01300-06403";
>        $result = mysql_query("SELECT itemid,description,unitprice FROM
> catalog WHERE categories='" . $cat1 . "'  ORDER BY itemid",$db);
>
> while ($item = mysql_fetch_assoc($result))
> {
> $item_list .= "" . $item['itemid'] . "
>         $item['itemid'] . "=1\">". $item['description'] ."
>        $". money_format('%i', $item['unitprice'])
> ."
>        ";
> }
> echo "Item IDDescription size=\"-1\">(Click for more info)Price
> EachPurchase$item_list";
> ?>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

change it to an IN clause for the categories

$result = mysql_query("SELECT itemid,description,unitprice FROM
catalog WHERE categories in('$cat1',"$cat2',$cat3','$catN')  ORDER BY
itemid",$db);


-- 

Bastien

Cat, the other other white meat

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



[PHP] Re: Making several variables into 1 variable

2009-07-28 Thread Carlos Medina

Miller, Terion schrieb:

I need to take this:

   $pastDays = strtotime("-30 days");



$past_day = date("d", $pastDays);

$past_month = date("m", $pastDays);

$past_year =date("y", $pastDays);


And make it into one var to compare to a db field that is formatted like
00/00/00 



$result = date("d/m/y", $pastDays);



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



RE: [PHP] Making several variables into 1 variable

2009-07-28 Thread Bob McConnell
From: Miller, Terion
On 7/28/09 8:35 AM, "Ashley Sheridan"  wrote:

> $pastDays = strtotime("-30 days");
> $date = date("d/m/y", $pastDays);
> 
> Well I tried and got no results from my query and I know there
> results with date ranges in the last 30 days, I basically need
> to count backward from now() 30 days I thought strtotime() would
> work well..but the fields in the db are varchar not date fields
> they are all formatted the same though 00/00/00:

If the dates are really stored as varchar, you are doing a lexical
comparison on a field that is meaningless in that context. You will need
to break the string down somewhere and do three separate comparisons.

Bob McConnell

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



Re: [PHP] Making several variables into 1 variable

2009-07-28 Thread Miller, Terion



<,snip>
>

You can also do this right within MySQL without needing to create a
variable.  This should work:
$sql = "SELECT DISTINCT restaurants.ID, name, address, inDate FROM
restaurants, inspections WHERE restaurants.name != '' AND
datediff(curdate(),inspections.inDate)>=30 GROUP BY restaurants.ID
ORDER BY 'name' ";

Take care,
Floyd



Ok I have to do the same thing again but with even more variables posted from a 
form
I have a form where a user can choose a date range currently the form returns 6 
variables (bmonth, bday, byear, emonth, eday, eyear) now I have to take those 
and get them all formatted together (well the bmonth, bday, byear together) in 
the mm/dd/yy format

Wait can't I.
$month = $date(m, $bmonth) like that but then I still end up with 3

$month, $day, $year Does that work like that $date(m/d/y, $month, $day, 
$year)

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



Re: [PHP] Making several variables into 1 variable

2009-07-28 Thread Bastien Koert
On Tue, Jul 28, 2009 at 10:34 AM, Bob McConnell wrote:
> From: Miller, Terion
> On 7/28/09 8:35 AM, "Ashley Sheridan"  wrote:
>
>> $pastDays = strtotime("-30 days");
>> $date = date("d/m/y", $pastDays);
>>
>> Well I tried and got no results from my query and I know there
>> results with date ranges in the last 30 days, I basically need
>> to count backward from now() 30 days I thought strtotime() would
>> work well..but the fields in the db are varchar not date fields
>> they are all formatted the same though 00/00/00:
>
> If the dates are really stored as varchar, you are doing a lexical
> comparison on a field that is meaningless in that context. You will need
> to break the string down somewhere and do three separate comparisons.
>
> Bob McConnell
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Teri,

have you considered making the field a date/ datetime type? You could
add the column, then copy the data over with a sql statement casting
it to the correct date format you require and then drop the original
column

-- 

Bastien

Cat, the other other white meat

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



Re: [PHP] Making several variables into 1 variable

2009-07-28 Thread Miller, Terion



On 7/28/09 9:40 AM, "Bastien Koert"  wrote:

On Tue, Jul 28, 2009 at 10:34 AM, Bob McConnell wrote:
> From: Miller, Terion
> On 7/28/09 8:35 AM, "Ashley Sheridan"  wrote:
>
>> $pastDays = strtotime("-30 days");
>> $date = date("d/m/y", $pastDays);
>>
>> Well I tried and got no results from my query and I know there
>> results with date ranges in the last 30 days, I basically need
>> to count backward from now() 30 days I thought strtotime() would
>> work well..but the fields in the db are varchar not date fields
>> they are all formatted the same though 00/00/00:
>
> If the dates are really stored as varchar, you are doing a lexical
> comparison on a field that is meaningless in that context. You will need
> to break the string down somewhere and do three separate comparisons.
>
> Bob McConnell
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Teri,

have you considered making the field a date/ datetime type? You could
add the column, then copy the data over with a sql statement casting
it to the correct date format you require and then drop the original
column

--

Bastien

Cat, the other other white meat

I don't think I can this data is being pulled from our county health site, so 
it comes in how they put it on their page (scraping here)  and I'm grabbing it 
using regex. (and this is totally public info so it's legit-my employer tells 
me)



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



Re: [PHP] Making several variables into 1 variable

2009-07-28 Thread Bastien Koert
On Tue, Jul 28, 2009 at 10:40 AM, Miller,
Terion wrote:
>
>
>
> <,snip>
>>
>
> You can also do this right within MySQL without needing to create a
> variable.  This should work:
> $sql = "SELECT DISTINCT restaurants.ID, name, address, inDate FROM
> restaurants, inspections WHERE restaurants.name != '' AND
> datediff(curdate(),inspections.inDate)>=30 GROUP BY restaurants.ID
> ORDER BY 'name' ";
>
> Take care,
> Floyd
>
>
>
> Ok I have to do the same thing again but with even more variables posted from 
> a form
> I have a form where a user can choose a date range currently the form returns 
> 6 variables (bmonth, bday, byear, emonth, eday, eyear) now I have to take 
> those and get them all formatted together (well the bmonth, bday, byear 
> together) in the mm/dd/yy format
>
> Wait can't I.
> $month = $date(m, $bmonth) like that but then I still end up with 3
>
> $month, $day, $year Does that work like that $date(m/d/y, $month, $day, 
> $year)
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Use strtotime to convert a text string into a time value that php can
then use to figure out a date.

$date = date('m/d/y', strtotime("$month/$day/$year");

-- 

Bastien

Cat, the other other white meat

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



Re: [PHP] Making several variables into 1 variable

2009-07-28 Thread Bastien Koert
On Tue, Jul 28, 2009 at 10:43 AM, Miller,
Terion wrote:
>
>
>
> On 7/28/09 9:40 AM, "Bastien Koert"  wrote:
>
> On Tue, Jul 28, 2009 at 10:34 AM, Bob McConnell wrote:
>> From: Miller, Terion
>> On 7/28/09 8:35 AM, "Ashley Sheridan"  wrote:
>>
>>> $pastDays = strtotime("-30 days");
>>> $date = date("d/m/y", $pastDays);
>>>
>>> Well I tried and got no results from my query and I know there
>>> results with date ranges in the last 30 days, I basically need
>>> to count backward from now() 30 days I thought strtotime() would
>>> work well..but the fields in the db are varchar not date fields
>>> they are all formatted the same though 00/00/00:
>>
>> If the dates are really stored as varchar, you are doing a lexical
>> comparison on a field that is meaningless in that context. You will need
>> to break the string down somewhere and do three separate comparisons.
>>
>> Bob McConnell
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
> Teri,
>
> have you considered making the field a date/ datetime type? You could
> add the column, then copy the data over with a sql statement casting
> it to the correct date format you require and then drop the original
> column
>
> --
>
> Bastien
>
> Cat, the other other white meat
>
> I don't think I can this data is being pulled from our county health site, so 
> it comes in how they put it on their page (scraping here)  and I'm grabbing 
> it using regex. (and this is totally public info so it's legit-my employer 
> tells me)
>
>
>

Yep, if you are not in control of the data and are just screenscraping
a site, then you don't have too many choices.

-- 

Bastien

Cat, the other other white meat

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



Re: [PHP] Font problem

2009-07-28 Thread Jim Lucas
Dušan Novaković wrote:
> Hi,
> 
> Is there a possibility that if there is no font installed on client
> side somehow browser finds it and redirect that font form server to
> client machine. For example: I have site that use Microsoft font and
> that font is not available on Linux distributions. So when u open page
> in FF on some Linux u get some default font (because browser doesn't
> recognize that font). I hope that I've managed to explane a problem
> :-) Does anyone has any solution for this problem??? Please it's very
> urgent
> 
> Thanks,
> Dusan
> 

It is possible, but you have to use the proper type of font file.

It is usually referred to as "Font Embedding" or "Embedding Fonts" using CSS

here are a few pages that show examples of how to do this with CSS

http://www.alistapart.com/articles/cssatten
http://www.webdeveloper.com/forum/archive/index.php/t-37552.html
http://home.tiscali.nl/developerscorner/fdc-varia/font-embedding.htm
http://www.cameraontheroad.com/index.php?p=524



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



Re: [PHP] Making several variables into 1 variable

2009-07-28 Thread Shawn McKenzie
Bastien Koert wrote:
> On Tue, Jul 28, 2009 at 10:43 AM, Miller,
> Terion wrote:
>>
>>
>> On 7/28/09 9:40 AM, "Bastien Koert"  wrote:
>>
>> On Tue, Jul 28, 2009 at 10:34 AM, Bob McConnell wrote:
>>> From: Miller, Terion
>>> On 7/28/09 8:35 AM, "Ashley Sheridan"  wrote:
>>>
 $pastDays = strtotime("-30 days");
 $date = date("d/m/y", $pastDays);

 Well I tried and got no results from my query and I know there
 results with date ranges in the last 30 days, I basically need
 to count backward from now() 30 days I thought strtotime() would
 work well..but the fields in the db are varchar not date fields
 they are all formatted the same though 00/00/00:
>>> If the dates are really stored as varchar, you are doing a lexical
>>> comparison on a field that is meaningless in that context. You will need
>>> to break the string down somewhere and do three separate comparisons.
>>>
>>> Bob McConnell
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>> Teri,
>>
>> have you considered making the field a date/ datetime type? You could
>> add the column, then copy the data over with a sql statement casting
>> it to the correct date format you require and then drop the original
>> column
>>
>> --
>>
>> Bastien
>>
>> Cat, the other other white meat
>>
>> I don't think I can this data is being pulled from our county health site, 
>> so it comes in how they put it on their page (scraping here)  and I'm 
>> grabbing it using regex. (and this is totally public info so it's legit-my 
>> employer tells me)
>>
>>
>>
> 
> Yep, if you are not in control of the data and are just screenscraping
> a site, then you don't have too many choices.
> 

Why?  If you're scraping it then you can cast it into whatever form you
want before you store it in the db.  Scrape it, strtotime(), store it?

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] First of my Quark/php generated Questions

2009-07-28 Thread Miller, Terion
Okay I have to echo onto my reverse pub page this chunk of code that is for
generating the page in Quark, it has to echo as is...but I'm getting
errors--I've tried in brackets, in paraenthesis, double quotes, single
quotes etc:

echo "
@Normal=
@.LIST
Bold=
@.BODY=[S"",
".BODY"]<*J*h"Standard"*kn0*kt0*ra0*rb0*d0*p(0,7,0,10,0,0,G,"U.S.
English")Ps100t-2h100z9.4k0b0cKf"PoynterOSTextTwoNL-Roman">
@Normal=[S".BODY
",".BODY","Normal"]<>
@.GLANCE Hed
100K=[S"",""]<*L*h"Headline"*kn0*kt0*ra0*rb0*d0*p(0,0,0,+0,10,0,g,"U.S.
English")Ps100t-4h100z16k0b0cKf"InterstateNL-BlackCondensed">
@.GLANCE Text
normal=[S"",".GLANCE Text
normal"]<*L*h"Standard"*kn0*kt0*ra0*rb0*d0*p(0,5.25,0,10,0,0,G,"U.S.
English")Ps100t-2h110.001z9.4k0b0cKf"InterstateNL-LightCondensed">
@.LIST
Subtopic 
label=[S"",""]<*C*h"Standard"*kn0*kt0*ra0*rb0*d0*p(0,0,0,10,4,2,g,"U.S.
English")PKs100t-3h100z8.7k0b0cKf"InterstateNL-BlackCondensed">
@.LIST Body
no indents=[S"",".LIST Body no
indents"]<*L*h"Standard"*kn0*kt0*ra0*rb0*d0*p(0,0,0,+0,0,3,g,"U.S.
English")Ps100t-4h110.001z8.7k0b0cKf"InterstateNL-LightCondensed">"
;


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



Re: [PHP] Multiple MySQL Queries

2009-07-28 Thread Jim Lucas
Bastien Koert wrote:
> On Tue, Jul 28, 2009 at 10:11 AM,  wrote:
>>This may be more of a MySQL question than PHP, but I'm hoping someone
>> can point me in the right direction.  I have working code (below) that pulls
>> data from a particular category in our db.  I'd like to be able to pull data
>> from multiple categories in the same db and place them on the same page.
>>
>>I've been working on this for the last 4 days with no luck.  Some
>> pages say that you can't do multiple MySQL queries while others say there is
>> a workaround but I haven't found it.  Does anyone know how to do this?
>>
>> Thanks,
>> Frank
>>
>> 
>>
>>  // in header
>>
>> >$item_list = "";
>>$cat1 = "01100-01200-01300-06403";
>>$result = mysql_query("SELECT itemid,description,unitprice FROM
>> catalog WHERE categories='" . $cat1 . "'  ORDER BY itemid",$db);
>>
>> while ($item = mysql_fetch_assoc($result))
>> {
>> $item_list .= "" . $item['itemid'] . "
>>> $item['itemid'] . "=1\">". $item['description'] ."
>>$". money_format('%i', $item['unitprice'])
>> ."
>>";
>> }
>> echo "Item IDDescription> size=\"-1\">(Click for more info)Price
>> EachPurchase$item_list";
>> ?>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> 
> change it to an IN clause for the categories
> 
> $result = mysql_query("SELECT itemid,description,unitprice FROM
> catalog WHERE categories in('$cat1',"$cat2',$cat3','$catN')  ORDER BY
> itemid",$db);
> 
> 

Or if you want the results in separate "tables", do this.

 // in header


Item ID
Description
(Click for more info)
Price Each
Purchase

HTML;
while ( $item = mysql_fetch_assoc($result) ) {
$price = money_format('%i', $item['unitprice']);
echo <<
{$item['itemid']}

{$item['description']}
{$price}


ROW;
}
echo '';
} else {
echo "No results for category #{$cat}!";
}
}

?>



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



RE: [PHP] First of my Quark/php generated Questions

2009-07-28 Thread Ford, Mike
> -Original Message-
> From: Miller, Terion [mailto:tmil...@springfi.gannett.com]
> Sent: 28 July 2009 17:06
> 
> Okay I have to echo onto my reverse pub page this chunk of code that
> is for
> generating the page in Quark, it has to echo as is...but I'm getting
> errors--I've tried in brackets, in paraenthesis, double quotes,
> single
> quotes etc:
> 
> echo "
> @Normal=
> @.LIST
> Bold=
> @.BODY=[S"",
> ".BODY"]<*J*h"Standard"*kn0*kt0*ra0*rb0*d0*p(0,7,0,10,0,0,G,"U.S.
> English")Ps100t-2h100z9.4k0b0cKf"PoynterOSTextTwoNL-Roman">
> @Normal=[S".BODY
> ",".BODY","Normal"]<>
> @.GLANCE Hed
> 100K=[S"",""]<*L*h"Headline"*kn0*kt0*ra0*rb0*d0*p(0,0,0,+0,10,0,g,"U
> .S.
> English")Ps100t-4h100z16k0b0cKf"InterstateNL-BlackCondensed">
> @.GLANCE Text
> normal=[S"",".GLANCE Text
> normal"]<*L*h"Standard"*kn0*kt0*ra0*rb0*d0*p(0,5.25,0,10,0,0,G,"U.S.
> English")Ps100t-2h110.001z9.4k0b0cKf"InterstateNL-LightCondensed">
> @.LIST
> Subtopic
> label=[S"",""]<*C*h"Standard"*kn0*kt0*ra0*rb0*d0*p(0,0,0,10,4,2,g,"U
> .S.
> English")PKs100t-3h100z8.7k0b0cKf"InterstateNL-BlackCondensed">
> @.LIST Body
> no indents=[S"",".LIST Body no
> indents"]<*L*h"Standard"*kn0*kt0*ra0*rb0*d0*p(0,0,0,+0,0,3,g,"U.S.
> English")Ps100t-4h110.001z8.7k0b0cKf"InterstateNL-LightCondensed">"
> ;

The problem here is you have a string to output with lots of double quotes 
embedded in it, and you have also tried to quote it with double quotes. There 
are several things you could do:

(i) Insert a backslash in front of every double quote; I don't recommend this, 
as you're bound to miss one and it's very ugly to read.

(ii) Enclose it in single quotes instead; this is good as it prevents nearly 
all interpolation/escaping, but it has the disadvantage that you then have to 
backslash any single quotes.

(iii) Use a Heredoc http://php.net/heredoc; this avoids the need to backslash 
internal double quotes, but might be a problem if your text ever contains $ 
signs as it does variable interpolation.

(iv) If you are on PHP 5.3, use a Nowdoc http://php.net/nowdoc.

Whatever option you choose, you will always have to backslash-escape any 
backslashes; on a quick scan, I can't see any in that text block, but it's best 
to be aware ;)


Cheers!

Mike
 -- 
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,  
Leeds Metropolitan University,  C507, 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] First of my Quark/php generated Questions (RESOLVED)

2009-07-28 Thread Miller, Terion



On 7/28/09 11:05 AM, "Miller, Terion"  wrote:


echo "
@Normal=
@.LIST
Bold=
@.BODY=[S"",
".BODY"]<*J*h"Standard"*kn0*kt0*ra0*rb0*d0*p(0,7,0,10,0,0,G,"U.S.
English")Ps100t-2h100z9.4k0b0cKf"PoynterOSTextTwoNL-Roman">
@Normal=[S".BODY
",".BODY","Normal"]<>
@.GLANCE Hed
100K=[S"",""]<*L*h"Headline"*kn0*kt0*ra0*rb0*d0*p(0,0,0,+0,10,0,g,"U.S.
English")Ps100t-4h100z16k0b0cKf"InterstateNL-BlackCondensed">
@.GLANCE Text
normal=[S"",".GLANCE Text
normal"]<*L*h"Standard"*kn0*kt0*ra0*rb0*d0*p(0,5.25,0,10,0,0,G,"U.S.
English")Ps100t-2h110.001z9.4k0b0cKf"InterstateNL-LightCondensed">
@.LIST
Subtopic
label=[S"",""]<*C*h"Standard"*kn0*kt0*ra0*rb0*d0*p(0,0,0,10,4,2,g,"U.S.
English")PKs100t-3h100z8.7k0b0cKf"InterstateNL-BlackCondensed">
@.LIST Body
no indents=[S"",".LIST Body no
indents"]<*L*h"Standard"*kn0*kt0*ra0*rb0*d0*p(0,0,0,+0,0,3,g,"U.S.
English")Ps100t-4h110.001z8.7k0b0cKf"InterstateNL-LightCondensed">"
;


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



Re: [PHP] First of my Quark/php generated Questions (RESOLVED)

2009-07-28 Thread Jim Lucas
Miller, Terion wrote:
> 
> 
> On 7/28/09 11:05 AM, "Miller, Terion"  wrote:
> 
> 
> echo "
> @Normal=
> @.LIST
> Bold=
> @.BODY=[S"",
> ".BODY"]<*J*h"Standard"*kn0*kt0*ra0*rb0*d0*p(0,7,0,10,0,0,G,"U.S.
> English")Ps100t-2h100z9.4k0b0cKf"PoynterOSTextTwoNL-Roman">
> @Normal=[S".BODY
> ",".BODY","Normal"]<>
> @.GLANCE Hed
> 100K=[S"",""]<*L*h"Headline"*kn0*kt0*ra0*rb0*d0*p(0,0,0,+0,10,0,g,"U.S.
> English")Ps100t-4h100z16k0b0cKf"InterstateNL-BlackCondensed">
> @.GLANCE Text
> normal=[S"",".GLANCE Text
> normal"]<*L*h"Standard"*kn0*kt0*ra0*rb0*d0*p(0,5.25,0,10,0,0,G,"U.S.
> English")Ps100t-2h110.001z9.4k0b0cKf"InterstateNL-LightCondensed">
> @.LIST
> Subtopic
> label=[S"",""]<*C*h"Standard"*kn0*kt0*ra0*rb0*d0*p(0,0,0,10,4,2,g,"U.S.
> English")PKs100t-3h100z8.7k0b0cKf"InterstateNL-BlackCondensed">
> @.LIST Body
> no indents=[S"",".LIST Body no
> indents"]<*L*h"Standard"*kn0*kt0*ra0*rb0*d0*p(0,0,0,+0,0,3,g,"U.S.
> English")Ps100t-4h110.001z8.7k0b0cKf"InterstateNL-LightCondensed">"
> ;
> 
> 

It is always nice to have a solution presented to the list for the
archives...

How about posting your solution?


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



Re: [PHP] First of my Quark/php generated Questions (RESOLVED)

2009-07-28 Thread Miller, Terion
Oh sorry, apparently that time it took the boss standing over me telling me to 
try the single quotes again(pretty sure I had tried them-I may have caching 
problems on my dumb computer) anyways so putting it in single quotes not double 
worked like a charm.


On 7/28/09 11:52 AM, "Jim Lucas"  wrote:

Miller, Terion wrote:
>
>
> On 7/28/09 11:05 AM, "Miller, Terion"  wrote:
>
>
> echo "
> @Normal=
> @.LIST
> Bold=
> @.BODY=[S"",
> ".BODY"]<*J*h"Standard"*kn0*kt0*ra0*rb0*d0*p(0,7,0,10,0,0,G,"U.S.
> English")Ps100t-2h100z9.4k0b0cKf"PoynterOSTextTwoNL-Roman">
> @Normal=[S".BODY
> ",".BODY","Normal"]<>
> @.GLANCE Hed
> 100K=[S"",""]<*L*h"Headline"*kn0*kt0*ra0*rb0*d0*p(0,0,0,+0,10,0,g,"U.S.
> English")Ps100t-4h100z16k0b0cKf"InterstateNL-BlackCondensed">
> @.GLANCE Text
> normal=[S"",".GLANCE Text
> normal"]<*L*h"Standard"*kn0*kt0*ra0*rb0*d0*p(0,5.25,0,10,0,0,G,"U.S.
> English")Ps100t-2h110.001z9.4k0b0cKf"InterstateNL-LightCondensed">
> @.LIST
> Subtopic
> label=[S"",""]<*C*h"Standard"*kn0*kt0*ra0*rb0*d0*p(0,0,0,10,4,2,g,"U.S.
> English")PKs100t-3h100z8.7k0b0cKf"InterstateNL-BlackCondensed">
> @.LIST Body
> no indents=[S"",".LIST Body no
> indents"]<*L*h"Standard"*kn0*kt0*ra0*rb0*d0*p(0,0,0,+0,0,3,g,"U.S.
> English")Ps100t-4h110.001z8.7k0b0cKf"InterstateNL-LightCondensed">"
> ;
>
>

It is always nice to have a solution presented to the list for the
archives...

How about posting your solution?




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



[PHP] str_to_date equivalent in PHP

2009-07-28 Thread Thodoris

Hi gang,
   I've been looking for a str_to_date (mysql) equivalent in PHP. I've 
noticed that these are matching the description:


http://www.php.net/manual/en/datetime.createfromformat.php
http://www.php.net/manual/en/function.date-create-from-format.php

but I don't have PHP 5.3.0 installed in any of my systems to test it and 
the function/method is not well documented yet. So I will have to write 
a workaround this.


Has anybody tried this?

--
Thodoris


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



Re: [PHP] str_to_date equivalent in PHP

2009-07-28 Thread Jim Lucas
Thodoris wrote:
> Hi gang,
>I've been looking for a str_to_date (mysql) equivalent in PHP. I've
> noticed that these are matching the description:
> 
> http://www.php.net/manual/en/datetime.createfromformat.php
> http://www.php.net/manual/en/function.date-create-from-format.php
> 
> but I don't have PHP 5.3.0 installed in any of my systems to test it and
> the function/method is not well documented yet. So I will have to write
> a workaround this.
> 
> Has anybody tried this?
> 

You will probably want a combination of strtotime() and date()

example:
$date = date('Y/m/d', strtotime('yesterday'));

Jim Lucas


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



Re: [PHP] str_to_date equivalent in PHP

2009-07-28 Thread Richard S. Crawford
2009/7/28 Thodoris :
> Hi gang,
>   I've been looking for a str_to_date (mysql) equivalent in PHP. I've
> noticed that these are matching the description:
>
> http://www.php.net/manual/en/datetime.createfromformat.php
> http://www.php.net/manual/en/function.date-create-from-format.php
>
> but I don't have PHP 5.3.0 installed in any of my systems to test it and the
> function/method is not well documented yet. So I will have to write a
> workaround this.
>
> Has anybody tried this?

Does strtotime() not work for you?

-- 
Richard S. Crawford (rscrawf...@mossroot.com)
http://www.mossroot.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)

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



Re: [PHP] str_to_date equivalent in PHP

2009-07-28 Thread Jim Lucas
Richard S. Crawford wrote:
> 2009/7/28 Thodoris :
>> Hi gang,
>>   I've been looking for a str_to_date (mysql) equivalent in PHP. I've
>> noticed that these are matching the description:
>>
>> http://www.php.net/manual/en/datetime.createfromformat.php
>> http://www.php.net/manual/en/function.date-create-from-format.php
>>
>> but I don't have PHP 5.3.0 installed in any of my systems to test it and the
>> function/method is not well documented yet. So I will have to write a
>> workaround this.
>>
>> Has anybody tried this?
> 
> Does strtotime() not work for you?
> 

he is talking about to /MySQL/ date string format


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



Re: [PHP] str_to_date equivalent in PHP

2009-07-28 Thread Thodoris



2009/7/28 Thodoris :
  

Hi gang,
  I've been looking for a str_to_date (mysql) equivalent in PHP. I've
noticed that these are matching the description:

http://www.php.net/manual/en/datetime.createfromformat.php
http://www.php.net/manual/en/function.date-create-from-format.php

but I don't have PHP 5.3.0 installed in any of my systems to test it and the
function/method is not well documented yet. So I will have to write a
workaround this.

Has anybody tried this?



Does strtotime() not work for you?

  
Well actually it doesn't basically because I need to define the date's 
format. This is because strtotime will use for this date:

7/8/2009
the *month/day/year* format but in Greece we usually write dates in 
*day/**month/year* so this is causing me trouble.


I have written this in case there is an active database handler around:

function db_date2mysql($date_str,$date_format="%d/%m/%Y",$dbh=null) {
   if (isset($dbh)) {
   $sql = "SELECT STR_TO_DATE('$date_str','$date_format') AS `date`";
   $ar = $dbh->query($sql)->fetch(PDO::FETCH_ASSOC);
   return $ar['date'];
   } else {
   return null;
   }
}

but I will need something more solid.

--
Thodoris



Re: [PHP] str_to_date equivalent in PHP

2009-07-28 Thread Richard S. Crawford
On Tue, Jul 28, 2009 at 10:09 AM, Jim Lucas wrote:
> Richard S. Crawford wrote:
>> 2009/7/28 Thodoris :
>>> Hi gang,
>>>   I've been looking for a str_to_date (mysql) equivalent in PHP. I've
>>> noticed that these are matching the description:
>>>
>>> http://www.php.net/manual/en/datetime.createfromformat.php
>>> http://www.php.net/manual/en/function.date-create-from-format.php
>>>
>>> but I don't have PHP 5.3.0 installed in any of my systems to test it and the
>>> function/method is not well documented yet. So I will have to write a
>>> workaround this.
>>>
>>> Has anybody tried this?
>>
>> Does strtotime() not work for you?
>>
>
> he is talking about to /MySQL/ date string format
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
 Hm, probably $date =  date('Y-m-d',strtotime($string)) then.



-- 
Richard S. Crawford (rscrawf...@mossroot.com)
http://www.mossroot.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)

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



Re: [PHP] str_to_date equivalent in PHP

2009-07-28 Thread Ashley Sheridan
On Tue, 2009-07-28 at 20:10 +0300, Thodoris wrote:

> > 2009/7/28 Thodoris :
> >   
> >> Hi gang,
> >>   I've been looking for a str_to_date (mysql) equivalent in PHP. I've
> >> noticed that these are matching the description:
> >>
> >> http://www.php.net/manual/en/datetime.createfromformat.php
> >> http://www.php.net/manual/en/function.date-create-from-format.php
> >>
> >> but I don't have PHP 5.3.0 installed in any of my systems to test it and 
> >> the
> >> function/method is not well documented yet. So I will have to write a
> >> workaround this.
> >>
> >> Has anybody tried this?
> >> 
> >
> > Does strtotime() not work for you?
> >
> >   
> Well actually it doesn't basically because I need to define the date's 
> format. This is because strtotime will use for this date:
> 7/8/2009
> the *month/day/year* format but in Greece we usually write dates in 
> *day/**month/year* so this is causing me trouble.
> 
> I have written this in case there is an active database handler around:
> 
> function db_date2mysql($date_str,$date_format="%d/%m/%Y",$dbh=null) {
> if (isset($dbh)) {
> $sql = "SELECT STR_TO_DATE('$date_str','$date_format') AS `date`";
> $ar = $dbh->query($sql)->fetch(PDO::FETCH_ASSOC);
> return $ar['date'];
> } else {
> return null;
> }
> }
> 
> but I will need something more solid.
> 

I've always used strtotime from the output I get from the database, and
it's always worked for me, and before you ask, I live in the UK where
the date formats make sense :p



Thanks
Ash
www.ashleysheridan.co.uk


Re: [PHP] str_to_date equivalent in PHP

2009-07-28 Thread Thodoris



On Tue, 2009-07-28 at 20:10 +0300, Thodoris wrote:

> 2009/7/28 Thodoris mailto:t...@kinetix.gr>>:
>   
>> Hi gang,

>>   I've been looking for a str_to_date (mysql) equivalent in PHP. I've
>> noticed that these are matching the description:
>>
>> http://www.php.net/manual/en/datetime.createfromformat.php
>> http://www.php.net/manual/en/function.date-create-from-format.php
>>
>> but I don't have PHP 5.3.0 installed in any of my systems to test it and the
>> function/method is not well documented yet. So I will have to write a
>> workaround this.
>>
>> Has anybody tried this?
>> 
>

> Does strtotime() not work for you?
>
>   
Well actually it doesn't basically because I need to define the date's 
format. This is because strtotime will use for this date:

7/8/2009
the *month/day/year* format but in Greece we usually write dates in 
*day/**month/year* so this is causing me trouble.


I have written this in case there is an active database handler around:

function db_date2mysql($date_str,$date_format="%d/%m/%Y",$dbh=null) {
if (isset($dbh)) {
$sql = "SELECT STR_TO_DATE('$date_str','$date_format') AS `date`";
$ar = $dbh->query($sql)->fetch(PDO::FETCH_ASSOC);
return $ar['date'];
} else {
return null;
}
}

but I will need something more solid.


I've always used strtotime from the output I get from the database, 
and it's always worked for me, and before you ask, I live in the UK 
where the date formats make sense :p




Thanks
Ash
www.ashleysheridan.co.uk



Well it does make sense if you leave in UK :-) . But I was asking about 
how to change a day/month/year formated date (or a date in any format I 
like) to mysql format. The basic problem is that I need to define the 
format that the date is in.


Sorry if I didn't make that clear before.

--
Thodoris



Re: [PHP] str_to_date equivalent in PHP

2009-07-28 Thread Jim Lucas
Thodoris wrote:
> 
>> 2009/7/28 Thodoris :
>>  
>>> Hi gang,
>>>   I've been looking for a str_to_date (mysql) equivalent in PHP. I've
>>> noticed that these are matching the description:
>>>
>>> http://www.php.net/manual/en/datetime.createfromformat.php
>>> http://www.php.net/manual/en/function.date-create-from-format.php
>>>
>>> but I don't have PHP 5.3.0 installed in any of my systems to test it
>>> and the
>>> function/method is not well documented yet. So I will have to write a
>>> workaround this.
>>>
>>> Has anybody tried this?
>>> 
>>
>> Does strtotime() not work for you?
>>
>>   
> Well actually it doesn't basically because I need to define the date's
> format. This is because strtotime will use for this date:
> 7/8/2009
> the *month/day/year* format but in Greece we usually write dates in
> *day/**month/year* so this is causing me trouble.
> 
> I have written this in case there is an active database handler around:
> 
> function db_date2mysql($date_str,$date_format="%d/%m/%Y",$dbh=null) {
>if (isset($dbh)) {
>$sql = "SELECT STR_TO_DATE('$date_str','$date_format') AS `date`";
>$ar = $dbh->query($sql)->fetch(PDO::FETCH_ASSOC);
>return $ar['date'];
>} else {
>return null;
>}
> }
> 
> but I will need something more solid.
> 

Just a side question about your function.

Is there a PDO::FETCH_OBJECT  that could be used in place of the
PDO::FETCH_ASSOC that you show.

If so, could you shorten that by one line by doing this

return $dbh->query($sql)->fetch(PDO::FETCH_OBJECT)->date;


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



Re: [PHP] str_to_date equivalent in PHP

2009-07-28 Thread Ashley Sheridan
On Tue, 2009-07-28 at 20:38 +0300, Thodoris wrote:
> > On Tue, 2009-07-28 at 20:10 +0300, Thodoris wrote:
> >> > 2009/7/28 Thodoris mailto:t...@kinetix.gr>>:
> >> >   
> >> >> Hi gang,
> >> >>   I've been looking for a str_to_date (mysql) equivalent in PHP. I've
> >> >> noticed that these are matching the description:
> >> >>
> >> >> http://www.php.net/manual/en/datetime.createfromformat.php
> >> >> http://www.php.net/manual/en/function.date-create-from-format.php
> >> >>
> >> >> but I don't have PHP 5.3.0 installed in any of my systems to test it 
> >> >> and the
> >> >> function/method is not well documented yet. So I will have to write a
> >> >> workaround this.
> >> >>
> >> >> Has anybody tried this?
> >> >> 
> >> >
> >> > Does strtotime() not work for you?
> >> >
> >> >   
> >> Well actually it doesn't basically because I need to define the date's 
> >> format. This is because strtotime will use for this date:
> >> 7/8/2009
> >> the *month/day/year* format but in Greece we usually write dates in 
> >> *day/**month/year* so this is causing me trouble.
> >>
> >> I have written this in case there is an active database handler around:
> >>
> >> function db_date2mysql($date_str,$date_format="%d/%m/%Y",$dbh=null) {
> >> if (isset($dbh)) {
> >> $sql = "SELECT STR_TO_DATE('$date_str','$date_format') AS `date`";
> >> $ar = $dbh->query($sql)->fetch(PDO::FETCH_ASSOC);
> >> return $ar['date'];
> >> } else {
> >> return null;
> >> }
> >> }
> >>
> >> but I will need something more solid.
> >>
> >> 
> > I've always used strtotime from the output I get from the database, 
> > and it's always worked for me, and before you ask, I live in the UK 
> > where the date formats make sense :p
> >
> >
> >
> > Thanks
> > Ash
> > www.ashleysheridan.co.uk
> >
> 
> Well it does make sense if you leave in UK :-) . But I was asking about 
> how to change a day/month/year formated date (or a date in any format I 
> like) to mysql format. The basic problem is that I need to define the 
> format that the date is in.
> 
> Sorry if I didn't make that clear before.
> 

Why not use mktime() and date() along with a few substrings?

Thanks
Ash
www.ashleysheridan.co.uk


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



Re: [PHP] str_to_date equivalent in PHP

2009-07-28 Thread Thodoris



Thodoris wrote:
  

2009/7/28 Thodoris :
 
  

Hi gang,
  I've been looking for a str_to_date (mysql) equivalent in PHP. I've
noticed that these are matching the description:

http://www.php.net/manual/en/datetime.createfromformat.php
http://www.php.net/manual/en/function.date-create-from-format.php

but I don't have PHP 5.3.0 installed in any of my systems to test it
and the
function/method is not well documented yet. So I will have to write a
workaround this.

Has anybody tried this?



Does strtotime() not work for you?

  
  

Well actually it doesn't basically because I need to define the date's
format. This is because strtotime will use for this date:
7/8/2009
the *month/day/year* format but in Greece we usually write dates in
*day/**month/year* so this is causing me trouble.

I have written this in case there is an active database handler around:

function db_date2mysql($date_str,$date_format="%d/%m/%Y",$dbh=null) {
   if (isset($dbh)) {
   $sql = "SELECT STR_TO_DATE('$date_str','$date_format') AS `date`";
   $ar = $dbh->query($sql)->fetch(PDO::FETCH_ASSOC);
   return $ar['date'];
   } else {
   return null;
   }
}

but I will need something more solid.




Just a side question about your function.

Is there a PDO::FETCH_OBJECT  that could be used in place of the
PDO::FETCH_ASSOC that you show.

If so, could you shorten that by one line by doing this

return $dbh->query($sql)->fetch(PDO::FETCH_OBJECT)->date;


  


Thanks Jim !! That is a very good suggestion.

How did I miss that :-)

--
Thodoris



Re: [PHP] str_to_date equivalent in PHP

2009-07-28 Thread Thodoris




Well it does make sense if you leave in UK :-) . But I was asking about 
how to change a day/month/year formated date (or a date in any format I 
like) to mysql format. The basic problem is that I need to define the 
format that the date is in.


Sorry if I didn't make that clear before.




Why not use mktime() and date() along with a few substrings?

Thanks
Ash
www.ashleysheridan.co.uk

  


I know that this works (as a workaround) which gets me back to my 
initial question: Can I use date_create_from_format()??

Does this works the way I need (because I don't have PHP 5.3.0 to test it)?

http://www.php.net/manual/en/function.date-create-from-format.php

--
Thodoris



RE: [PHP] Font problem

2009-07-28 Thread HallMarc Websites


> -Original Message-
> From: Jim Lucas [mailto:li...@cmsws.com]
> Sent: Tuesday, July 28, 2009 11:52 AM
> To: Dušan Novaković
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] Font problem
> 
> Dušan Novaković wrote:
> > Hi,
> >
> > Is there a possibility that if there is no font installed on client
> > side somehow browser finds it and redirect that font form server to
> > client machine. For example: I have site that use Microsoft font and
> > that font is not available on Linux distributions. So when u open
> page
> > in FF on some Linux u get some default font (because browser doesn't
> > recognize that font). I hope that I've managed to explane a problem
> > :-) Does anyone has any solution for this problem??? Please it's very
> > urgent
> >
> > Thanks,
> > Dusan
> >
> 
> It is possible, but you have to use the proper type of font file.
> 
> It is usually referred to as "Font Embedding" or "Embedding Fonts"
> using CSS
> 
> here are a few pages that show examples of how to do this with CSS
> 
> http://www.alistapart.com/articles/cssatten
> http://www.webdeveloper.com/forum/archive/index.php/t-37552.html
> http://home.tiscali.nl/developerscorner/fdc-varia/font-embedding.htm
> http://www.cameraontheroad.com/index.php?p=524
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> __ Information from ESET Smart Security, version of virus
> signature database 4285 (20090728) __
> 
> The message was checked by ESET Smart Security.
> 
> http://www.eset.com
> 



Jim has listed some nice alternatives, however, they are limited in their 
scope. I will point you to a solution called Cufon. This by far the best I have 
found to date (IMHO). This is a JavaScript solution. It will render ANY ttf or 
rtf font. The common issue you run into is the legal issue. Most of the fonts 
we want to use need to be purchased by the end user. The developers of Cufon 
are in talks with the Font Foundries to find a solution that will protect the 
font from being stolen. As of this writing the Foundries fear that the 
JavaScript file that is produced from the original fonts could be reverse 
engineered and give the font away for free. I have tried to put this file 
outside of the root folder of the site and found that I cannot call it. I 
haven't spent too much time on this yet. I'm sure there is a way, I just 
haven't found it yet.

Here is the link to Cufon
http://wiki.github.com/sorccu/cufon/about
the javascript generator can be found here 
http://cufon.shoqolate.com/generate/

One more thing and I can't stress this enough - USE AT YOUR OWN RISK!!! In the 
US Intellectual Property Theft is one of those laws whereby you are guilty 
until proven innocent ad each incident can cost you $100k!

[HallMarc Websites] 
 

__ Information from ESET Smart Security, version of virus signature 
database 4286 (20090728) __

The message was checked by ESET Smart Security.

http://www.eset.com
 


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



[PHP] Creating/printing array issues

2009-07-28 Thread Allen McCabe
I found a php script to find all file types with a file-name formula and put
them into an array. I then wanted to echo this array (possibly with links to
the files).

I want my default page to look for and list all php files with
"survey_*.php", the asterisk being any number, so the results should be:
survey_01.php, survey_02.php, etc.

Here is my code:


);
$aryExt = array("php");
$propid = $_REQUEST['mlsid']; // I assume the id will be in the querystring
// get the proper match pattern according to our Extension criteria
foreach ($aryExt as $e) {
 $aryPattern[] = $propid."_*.$e";
}
$pattern = join(",", $aryPattern); // comma separated list
// Get the filenames
$aryPhotos = 
rglob("./surveys","\\{$pattern}",GLOB_BRACE);

//print out our array
print_r($aryPhotos);


?>


Also, it would be nice to have an if/else statement to say there are no
"surveys" (survey_*.php files) available if there are none in the /surveys
directory.

Any and all help would be greatly appreciated!

-Allen McCabe


[PHP] Re: Creating/printing array issues

2009-07-28 Thread Allen McCabe
By the way, I was getting a PHP error with an unexpected ")" on line 47
($aryPhotos), so I added the two \\ before {survey*_.php and now the page
won't load, won't even display a PHP error.



On Tue, Jul 28, 2009 at 11:06 AM, Allen McCabe wrote:

> I found a php script to find all file types with a file-name formula and
> put them into an array. I then wanted to echo this array (possibly with
> links to the files).
>
> I want my default page to look for and list all php files with
> "survey_*.php", the asterisk being any number, so the results should be:
> survey_01.php, survey_02.php, etc.
>
> Here is my code:
>
>  /**
> * Recursive version of glob
> *
> * @return array containing all pattern-matched files.
> *
> * @param string $sDir  Directory to start with.
> * @param string $sPattern  Pattern to glob for.
> * @param int $nFlags   Flags sent to glob.
> */
> function rglob($sDir, $sPattern, $nFlags = NULL)
> {
>  $sDir = escapeshellcmd($sDir);
>  // Get the list of all matching files currently in the
>  // directory.
>  $aFiles = glob("$sDir/$sPattern", $nFlags);
>  // Then get a list of all directories in this directory, and
>  // run ourselves on the resulting array.  This is the
>  // recursion step, which will not execute if there are no
>  // directories.
>  foreach (glob("$sDir/*", GLOB_ONLYDIR) as $sSubDir)
>  {
>   $aSubFiles = rglob($sSubDir, $sPattern, $nFlags);
>   $aFiles = array_merge($aFiles, $aSubFiles);
>  }
>  // The array we return contains the files we found, and the
>  // files all of our children found.
>  return $aFiles;
> }
> $aryPhotos = rglob("./surveys","\\{survey_*.php}",GLOB_BRACE);
> $aryExt = array("php");
> $propid = $_REQUEST['mlsid']; // I assume the id will be in the querystring
>
> // get the proper match pattern according to our Extension criteria
> foreach ($aryExt as $e) {
>  $aryPattern[] = $propid."_*.$e";
> }
> $pattern = join(",", $aryPattern); // comma separated list
> // Get the filenames
> $aryPhotos = rglob("./surveys","\\{$pattern}",GLOB_BRACE);
> //print out our array
> print_r($aryPhotos);
>
>
> ?>
>
>
> Also, it would be nice to have an if/else statement to say there are no
> "surveys" (survey_*.php files) available if there are none in the /surveys
> directory.
>
> Any and all help would be greatly appreciated!
>
> -Allen McCabe
>


Re: [PHP] Multiple MySQL Queries

2009-07-28 Thread Jim Lucas
sono...@fannullone.us wrote:
> Hi Jim,
> 
>> Take a look inside your money_format() function look for the problem.
> 
> I apologize for replying too quickly.
> 
> The money_format() function looks just like the one I had before, so
> that's fine.
> 
> Upon closer inspection, I found a few problems:
> 
> 1] WHERE categories='{$cat}"'
> should be
> WHERE categories='{$cat}'

Sorry, my bad

> 
> 2] if ( ( $results = mysql_query($SQL, $db) !== false ) {
> should be
> if ( $results = mysql_query($SQL, $db) !== false ) {
> 

But, you do want the first line, expect with the closing bracket.

if ( ( $results = mysql_query($SQL, $db) ) !== false ) {

You want to have the inner portion processed then the comparison done.
Not the other way around.

> With those fixed, the page is rendering now, but giving me this error:
> Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL
> result resource
> 
> for this line:
> while ( $item = mysql_fetch_assoc($result) ) {
> 

Should be
while ( $item = mysql_fetch_assoc($results) ) {

> and the tables are blank.  Only the table headers show.  So...
> everything except the while statement appears to be working.
> 
> I've Googled that error message but can't find the casue.  Any help
> would be much appreciated.
> 
> Frank

Sorry about the other typo's!

Jim


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



Re: [PHP] Font problem

2009-07-28 Thread Ashley Sheridan
On Tue, 2009-07-28 at 08:52 -0700, Jim Lucas wrote:
> Dušan Novaković wrote:
> > Hi,
> > 
> > Is there a possibility that if there is no font installed on client
> > side somehow browser finds it and redirect that font form server to
> > client machine. For example: I have site that use Microsoft font and
> > that font is not available on Linux distributions. So when u open page
> > in FF on some Linux u get some default font (because browser doesn't
> > recognize that font). I hope that I've managed to explane a problem
> > :-) Does anyone has any solution for this problem??? Please it's very
> > urgent
> > 
> > Thanks,
> > Dusan
> > 
> 
> It is possible, but you have to use the proper type of font file.
> 
> It is usually referred to as "Font Embedding" or "Embedding Fonts" using CSS
> 
> here are a few pages that show examples of how to do this with CSS
> 
> http://www.alistapart.com/articles/cssatten
> http://www.webdeveloper.com/forum/archive/index.php/t-37552.html
> http://home.tiscali.nl/developerscorner/fdc-varia/font-embedding.htm
> http://www.cameraontheroad.com/index.php?p=524
> 
> 
> 

There are issues with those you mentioned.

The first uses images instead of text, which can be made accessible with
the CSS method they use, but it's no good for a whole page of text, and
only small bits and headings.

The second, well, browser support just isn't up to scratch yet. IE has
its own font format to use, not everone has upgraded to the latest
Firefox, Chrome doesn't even support it yet, etc. Same goes for the
third way, which seems to be a cross of 1 & 2.

Basically, there is no way to guarantee what it will look like, which is
annoying really. Wait a bit until all the browsers support it and are in
common use.



Thanks
Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Font problem

2009-07-28 Thread Michael A. Peters

Dušan Novaković wrote:

Hi,

Is there a possibility that if there is no font installed on client
side somehow browser finds it and redirect that font form server to
client machine. For example: I have site that use Microsoft font and
that font is not available on Linux distributions. So when u open page
in FF on some Linux u get some default font (because browser doesn't
recognize that font). I hope that I've managed to explane a problem
:-) Does anyone has any solution for this problem??? Please it's very
urgent

Thanks,
Dusan



Stick to either core web or adobe base35 and most Linux distributions 
will handle it just fine.


Embedding fonts only works in Linux with the latest version of Firefox 
(3.5) and I'm not sure that embedding fonts the way that works in FF 3.5 
will work with Internet Exploder.


Example of how to set up a proper css for best compatability:

font-family: helvetica, arial, sans-serif;

Linux will map helvetica to the proper URW clone if helvetica is not 
installed. Mac I believe has helvetica. Windows will either map 
helvetica to arial (a helvetica clone) or skip the helvetica declaration 
and go straight to arial.


Systems that don't have helvetica or arial or are configured to use a 
suitable clone will use the systems default sans-serif font.


You can not do web design dependent upon a particular font being 
installed. Even with embedded fonts, the end user may not allow 
installation of embedded fonts.


If you really need a particular font, use PDF and embed the font in the 
PDF - or (such as in the case of classical languages with special fonts) 
give a link to where a suitable font can be downloaded.


Almost desktop Linux systems have equivalents to the Adobe Base 35 fonts 
(or in my case have both type 1 and ttf variants of the Adobe Base 35 
fonts installed) and many Desktop Linux systems have the Microsoft "Core 
Web" fonts installed - but don't use Comic Sans MS as some characters 
(such as the lower case m) do not properly render in Linux.


If embedding fonts, make sure you have license to do so.

The bitsream vera fonts are open source, you can embed them - and most 
linux systems have them installed and won't need to use embedded versions.


http://www.bitstream.com/font_rendering/products/dev_fonts/vera.html

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



[PHP] Broken IF behavior? (Changing the branch changes the evaluation)

2009-07-28 Thread Matt Neimeyer
Background: I'm converting a webapp from Visual FoxPro as a backend to
MySQL... However one part of our app (a system status checker) is
common code between the versions.

I've got the following function... In English (in case it's not
apparent), if the version of the app is 2.0 or higher, then use MySQL
functions, otherwise use the ODBTP function to connect to VFP.

function my_fetch_array($result)
{
global $Version;
if(version_compare($Version,"2.0",">="))
{ $Ret = mysql_fetch_array($result); if(!$Ret) { } else { 
return $Ret; } }
else{ $Ret = odbtp_fetch_array($result); if(!$Ret) { } else { 
return $Ret; } }
}

This feels like a hack but works perfectly. Data is returned and all
is right with the world. Until I added in extra "error reporting".
When I change the if(!$Ret) portion as such...

if(!$Ret) { die("myError".mysql_error()); } else { return $Ret; }

It ALWAYS dies... and I see "myError" on the screen... If I change it
like such...

if(!$Ret) { } else { echo "notError"; return $Ret; }

I always see the "notError" on the screen and $Ret gets returned.

WHY does adding the die() inside the { } change the way the if is evaluated?

By the way I've tested this on 4.4.x on OSX and Windows, and on 5.2.5
on Windows...

Thanks

Matt

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



RE: [PHP] Font problem

2009-07-28 Thread Bob McConnell
From: Ashley Sheridan
> On Tue, 2009-07-28 at 08:52 -0700, Jim Lucas wrote:
>> Dušan Novaković wrote:
>> > Hi,
>> > 
>> > Is there a possibility that if there is no font installed on client
>> > side somehow browser finds it and redirect that font form server to
>> > client machine. For example: I have site that use Microsoft font and
>> > that font is not available on Linux distributions. So when u open page
>> > in FF on some Linux u get some default font (because browser doesn't
>> > recognize that font). I hope that I've managed to explane a problem
>> > :-) Does anyone has any solution for this problem??? Please it's very
>> > urgent
>> 
>> It is possible, but you have to use the proper type of font file.
>> 
>> It is usually referred to as "Font Embedding" or "Embedding Fonts" using CSS
>> 
> Basically, there is no way to guarantee what it will look like, which is
> annoying really. Wait a bit until all the browsers support it and are in
> common use.

If you really need this level of control HTML is the wrong medium. You should 
be using PDF, page sized images or other locked down formats. HTML was designed 
so the browser and user have ultimate control over layout, appearance, fonts, 
colors and other details. Nothing you can do should ever make any difference 
there.

Bob McConnell

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



Re: [PHP] Broken IF behavior? (Changing the branch changes the evaluation)

2009-07-28 Thread Eddie Drapkin
On Tue, Jul 28, 2009 at 2:48 PM, Matt Neimeyer wrote:
> Background: I'm converting a webapp from Visual FoxPro as a backend to
> MySQL... However one part of our app (a system status checker) is
> common code between the versions.
>
> I've got the following function... In English (in case it's not
> apparent), if the version of the app is 2.0 or higher, then use MySQL
> functions, otherwise use the ODBTP function to connect to VFP.
>
> function my_fetch_array($result)
>        {
>        global $Version;
>        if(version_compare($Version,"2.0",">="))
>                { $Ret = mysql_fetch_array($result); if(!$Ret) { } else { 
> return $Ret; } }
>        else    { $Ret = odbtp_fetch_array($result); if(!$Ret) { } else { 
> return $Ret; } }
>        }
>
> This feels like a hack but works perfectly. Data is returned and all
> is right with the world. Until I added in extra "error reporting".
> When I change the if(!$Ret) portion as such...
>
>        if(!$Ret) { die("myError".mysql_error()); } else { return $Ret; }
>
> It ALWAYS dies... and I see "myError" on the screen... If I change it
> like such...
>
>        if(!$Ret) { } else { echo "notError"; return $Ret; }
>
> I always see the "notError" on the screen and $Ret gets returned.
>
> WHY does adding the die() inside the { } change the way the if is evaluated?
>
> By the way I've tested this on 4.4.x on OSX and Windows, and on 5.2.5
> on Windows...
>
> Thanks
>
> Matt
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

What's the output of var_dump($Ret) right before that if statement?

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



Re: [PHP] Broken IF behavior? (Changing the branch changes the evaluation)

2009-07-28 Thread Matt Neimeyer
It's exactly what I would expect... The content of the row... But in
any case, what does changing the content of the { } branch have to do
with how the IF() itself is evaluated?

array(4) {
  [0]=>
  string(8) "CustName"
  ["config"]=>
  string(8) "CustName"
  [1]=>
  string(11) "Sample Cust"
  ["value"]=>
  string(11) "Sample Cust"
}


On Tue, Jul 28, 2009 at 2:56 PM, Eddie Drapkin wrote:
> On Tue, Jul 28, 2009 at 2:48 PM, Matt Neimeyer wrote:
>> Background: I'm converting a webapp from Visual FoxPro as a backend to
>> MySQL... However one part of our app (a system status checker) is
>> common code between the versions.
>>
>> I've got the following function... In English (in case it's not
>> apparent), if the version of the app is 2.0 or higher, then use MySQL
>> functions, otherwise use the ODBTP function to connect to VFP.
>>
>> function my_fetch_array($result)
>>        {
>>        global $Version;
>>        if(version_compare($Version,"2.0",">="))
>>                { $Ret = mysql_fetch_array($result); if(!$Ret) { } else { 
>> return $Ret; } }
>>        else    { $Ret = odbtp_fetch_array($result); if(!$Ret) { } else { 
>> return $Ret; } }
>>        }
>>
>> This feels like a hack but works perfectly. Data is returned and all
>> is right with the world. Until I added in extra "error reporting".
>> When I change the if(!$Ret) portion as such...
>>
>>        if(!$Ret) { die("myError".mysql_error()); } else { return $Ret; }
>>
>> It ALWAYS dies... and I see "myError" on the screen... If I change it
>> like such...
>>
>>        if(!$Ret) { } else { echo "notError"; return $Ret; }
>>
>> I always see the "notError" on the screen and $Ret gets returned.
>>
>> WHY does adding the die() inside the { } change the way the if is evaluated?
>>
>> By the way I've tested this on 4.4.x on OSX and Windows, and on 5.2.5
>> on Windows...
>>
>> Thanks
>>
>> Matt
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
> What's the output of var_dump($Ret) right before that if statement?
>

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



[PHP] Nitro PDF Form Element

2009-07-28 Thread Dare Williams
Dear Forum Experts.

I have an already created PDF Document that has a Form Element in it that was 
created with NITROPDF. But the problem is just that I need a way to pass value 
or populate the Document Form Element with value store in a Session Variable 
before the form is displayed to user.

Can you please give me a tip of Ideas.

Thank you.

Williams.



  

Re: [PHP] Nitro PDF Form Element

2009-07-28 Thread Ashley Sheridan
On Tue, 2009-07-28 at 12:16 -0700, Dare Williams wrote:
> Dear Forum Experts.
> 
> I have an already created PDF Document that has a Form Element in it that was 
> created with NITROPDF. But the problem is just that I need a way to pass 
> value or populate the Document Form Element with value store in a Session 
> Variable before the form is displayed to user.
> 
> Can you please give me a tip of Ideas.
> 
> Thank you.
> 
> Williams.
> 
> 
> 
>   
I think this is only possible at the time it is created, as the PDF is
entirely separate from your web page, and could very well be opened from
someones desktop.

Thanks
Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Nitro PDF Form Element

2009-07-28 Thread Dare Williams
Dear Forum,

I have an already created PDF Document that has a Form Element in it that was 
created with NITROPDF. But the problem is just that I need a way to pass value 
or populate the Document Form Element with value store in a Session Variable 
before the form is displayed to user.

There is a process that the document must follow before it is finally allowed 
to be display to user.

1.   A default PDF design Document with Form Element on the Server.
2.   PHP opens the document first and populate the Form Element with Session 
Information.
3.   PHP Save the Document with the populated value on the Server DIR.
4.   PHP picks up the new filled documents and display it to the User on 
Browser.

Any tips for this options.

Williams.
-




--- On Tue, 7/28/09, Ashley Sheridan  wrote:

From: Ashley Sheridan 
Subject: Re: [PHP] Nitro PDF Form Element
To: "Dare Williams" 
Cc: php-general@lists.php.net
Date: Tuesday, July 28, 2009, 3:21 PM

On Tue, 2009-07-28 at 12:16 -0700, Dare Williams wrote:
> Dear Forum Experts.
> 
> I have an already created PDF Document that has a Form Element in it that was 
> created with NITROPDF. But the problem is just that I need a way to pass 
> value or populate the Document Form Element with value store in a Session 
> Variable before the form is displayed to user.
> 
> Can you please give me a tip of Ideas.
> 
> Thank you.
> 
> Williams.
> 
> 
> 
>       
I think this is only possible at the time it is created, as the PDF is
entirely separate from your web page, and could very well be opened from
someones desktop.

Thanks
Ash
www.ashleysheridan.co.uk



  

Re: [PHP] Nitro PDF Form Element

2009-07-28 Thread Bastien Koert
On Tue, Jul 28, 2009 at 3:31 PM, Dare Williams wrote:
> Dear Forum,
>
> I have an already created PDF Document that has a Form Element in it that was 
> created with NITROPDF. But the problem is just that I need a way to pass 
> value or populate the Document Form Element with value store in a Session 
> Variable before the form is displayed to user.
>
> There is a process that the document must follow before it is finally allowed 
> to be display to user.
>
> 1.   A default PDF design Document with Form Element on the Server.
> 2.   PHP opens the document first and populate the Form Element with Session 
> Information.
> 3.   PHP Save the Document with the populated value on the Server DIR.
> 4.   PHP picks up the new filled documents and display it to the User on 
> Browser.
>
> Any tips for this options.
>
> Williams.
> -
>
>
>
>
> --- On Tue, 7/28/09, Ashley Sheridan  wrote:
>
> From: Ashley Sheridan 
> Subject: Re: [PHP] Nitro PDF Form Element
> To: "Dare Williams" 
> Cc: php-general@lists.php.net
> Date: Tuesday, July 28, 2009, 3:21 PM
>
> On Tue, 2009-07-28 at 12:16 -0700, Dare Williams wrote:
>> Dear Forum Experts.
>>
>> I have an already created PDF Document that has a Form Element in it that 
>> was created with NITROPDF. But the problem is just that I need a way to pass 
>> value or populate the Document Form Element with value store in a Session 
>> Variable before the form is displayed to user.
>>
>> Can you please give me a tip of Ideas.
>>
>> Thank you.
>>
>> Williams.
>>
>>
>>
>>
> I think this is only possible at the time it is created, as the PDF is
> entirely separate from your web page, and could very well be opened from
> someones desktop.
>
> Thanks
> Ash
> www.ashleysheridan.co.uk
>
>
>
>

I do something similar with the PDFs and classic ASP. I use the fdf
toolkit (which i beleive is part of php) that lets you have scripting
access to the pdf form fields

http://ca2.php.net/manual/en/book.fdf.php

-- 

Bastien

Cat, the other other white meat

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



[PHP] Argh Date problems

2009-07-28 Thread Miller, Terion
Well I was going along smoothly from this morningbut it came down to
having to change the field type to date in the mySQL..so now I have this
which returns a scraped value formatted like this 0/00/00 m/d/y

 $inDate = $results[3][$i];

Which date function can I use to format for the db so that I will be able to
use range references...there are so many get_date, date_modifyI'm
lost...

My full code is this:

preg_match_all('/(.+)(.+).+(\d+\/\d+\/\d+)\s(.+)(.+).+Critical
Violations Found:.+(\d+)(.+)Noncritical Violations Found:.+(\d+)/imsSU',
utf8_encode($url), $results);



for ($i=0; $i < count($results[0]); $i++)
{
$name1 = strtolower($results[1][$i]);

$name =
ltrim($name1);

$address = strtolower($results[2][$i]);

$inDate
= $results[3][$i];

$inType = $results[4][$i];

$notes =
trim($results[5][$i]);
 
$critical = trim($results[6][$i]);


$cviolations = $results[7][$i];

$noncritical = $results[8][$i];

//trying to manipulate different field data

$cleanViolations =
str_replace('*', '', $cviolations);
$ucName = ucwords($name);

$ucAddress = ucwords($address);


$mysql_name =
mysql_escape_string($ucName);
$mysql_address =
mysql_escape_string($ucAddress);
$mysql_inDate =
mysql_escape_string($inDate);
$mysql_inType =
mysql_escape_string($inType);
$mysql_notes =
mysql_escape_string($notes);
$mysql_critical =
mysql_escape_string($critical);
$mysql_cviolations =
mysql_escape_string($cleanViolations);
$mysql_noncritical =
mysql_escape_string($noncritical);
   
echo "$ucName ";

echo "$ucAddress ";
echo "$inDate ";
echo "$inType
";
echo "$notes ";
echo "$critical ";

//echo "$cviolations ";
echo "$cleanViolations ";

echo "$noncritical ";



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



[PHP] Re: Argh Date problems

2009-07-28 Thread Jo�o C�ndido de Souza Neto
In mySql you have date_format which I think´ll solve your problem.


""Miller, Terion""  escreveu na mensagem 
news:c694bead.41f4%kmille...@springfi.gannett.com...
Well I was going along smoothly from this morningbut it came down to
having to change the field type to date in the mySQL..so now I have this
which returns a scraped value formatted like this 0/00/00 m/d/y

 $inDate = $results[3][$i];

Which date function can I use to format for the db so that I will be able to
use range references...there are so many get_date, date_modifyI'm
lost...

My full code is this:

preg_match_all('/(.+)(.+).+(\d+\/\d+\/\d+)\s(.+)(.+).+Critical
Violations Found:.+(\d+)(.+)Noncritical Violations Found:.+(\d+)/imsSU',
utf8_encode($url), $results);



for ($i=0; $i < count($results[0]); $i++)
{
$name1 = strtolower($results[1][$i]);

$name =
ltrim($name1);

$address = strtolower($results[2][$i]);

$inDate
= $results[3][$i];

$inType = $results[4][$i];

$notes =
trim($results[5][$i]);

$critical = trim($results[6][$i]);


$cviolations = $results[7][$i];

$noncritical = $results[8][$i];

//trying to manipulate different field data

$cleanViolations =
str_replace('*', '', $cviolations);
$ucName = ucwords($name);

$ucAddress = ucwords($address);


$mysql_name =
mysql_escape_string($ucName);
$mysql_address =
mysql_escape_string($ucAddress);
$mysql_inDate =
mysql_escape_string($inDate);
$mysql_inType =
mysql_escape_string($inType);
$mysql_notes =
mysql_escape_string($notes);
$mysql_critical =
mysql_escape_string($critical);
$mysql_cviolations =
mysql_escape_string($cleanViolations);
$mysql_noncritical =
mysql_escape_string($noncritical);

echo "$ucName ";

echo "$ucAddress ";
echo "$inDate ";
echo "$inType
";
echo "$notes ";
echo "$critical ";

//echo "$cviolations ";
echo "$cleanViolations ";

echo "$noncritical ";




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



Re: [PHP] Multiple MySQL Queries

2009-07-28 Thread Jim Lucas
Please, click "Reply All"  so the list may benefit from our talking.

Read below for further information.

sono...@fannullone.us wrote:
> Jim,
> 
>> if ( ( $results = mysql_query($SQL, $db) ) !== false ) {
>>
>> You want to have the inner portion processed then the comparison done.
>> Not the other way around.
> 
> Of course, that makes sense. =:\
> 
>> Sorry about the other typo's!
> 
> No problem.  That just helps to keep me on my toes! =;)
> 
> If I may bother you for a little more help.  How would I go about
> making the 2nd category display in a column in the same table as the 1st
> category, instead of a separate table, i.e.
> 
> instead of displaying the products like this:
> 
> itemid
> 14367C4
> 14487C4
> 14547C4
> 18247C4
> A14367C4
> A14487C4
> A14547C4
> A18247C4
> ...
> 
> they would be displayed side by side in a single table like this:
> 
> itemiditemid
> 14367C4A14367C4
> 14487C4A14487C4
> 14547C4A14547C4
> 18247C4A18247C4
> ...
> 
> or am I asking too much now?
> 
> Thanks again.  I really do appreciate your help.  I'm so much closer
> than I ever would have been on my own!
> 
> Frank
> 
> --
> 
> FYI  Here's the full code that works:
> 
>  $item_list = "";
> $cats = array('01100-01200-01300-06403', '01100-02201-01300-06403');
> 
> foreach ( $cats AS $cat ) {
> $cat = mysql_real_escape_string($cat, $db);
> $SQL = "SELECT itemid,description,unitprice
> FROM catalog
> WHERE categories='$cat'
> ORDER BY itemid";
> 
> if ( ($result = mysql_query($SQL, $db)) !== false ) {
> echo << 
> 
> Item ID
> Description
> (Click for more info)
> Price Each
> Purchase
> 
> HTML;
> while ( $item = mysql_fetch_assoc($result) ) {
> $price = money_format('%i', $item['unitprice']);
> echo << 
> {$item['itemid']}
> 
> {$item['description']}
>  {$price}
> 
>  name="addToCartButton" alt="Add To Cart" />
>  value="{$item['itemid']}" />
>  size="4" />
> 
>   
> 
> 
> ROW;
> }
> echo '';
> } else {
> echo "No results for category #{$cat}!";
> }
> }
> 
> ?>


';
echo '';
foreach ( $cats AS $cat ) {
echo ''.htmlspecialchars($cat).'';
}
echo '';
foreach ( $cats AS $cat ) {
echo '';
$cat = mysql_real_escape_string($cat, $db);
$SQL = "SELECT  itemid,description,unitprice
FROMcatalog
WHERE   categories='$cat'
ORDER BY itemid";

if ( ($result = mysql_query($SQL, $db)) !== false ) {
while ( $item = mysql_fetch_assoc($result) ) {
$price = money_format('%i', $item['unitprice']);
echo <<{$item['description']}

ROW;
}
} else {
echo "No results for category #{$cat}!";
}
echo '';
}
echo '';

?>


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



Re: [PHP] Argh Date problems

2009-07-28 Thread Miller, Terion
Ok so I got the
$inDate = strtotime($results[3][$i]);

Giving me the unix date now I am trying all the different date functions that 
will put it in the -00-00 like sql stores it because I ran it with the unix 
stamp and it just stored 00 in the db

Hoping something like this works?
 $formatDate = date('ymd', $inDate);


On 7/28/09 2:41 PM, "Miller, Terion"  wrote:

Well I was going along smoothly from this morningbut it came down to
having to change the field type to date in the mySQL..so now I have this
which returns a scraped value formatted like this 0/00/00 m/d/y

 $inDate = $results[3][$i];

Which date function can I use to format for the db so that I will be able to
use range references...there are so many get_date, date_modifyI'm
lost...

My full code is this:

preg_match_all('/(.+)(.+).+(\d+\/\d+\/\d+)\s(.+)(.+).+Critical
Violations Found:.+(\d+)(.+)Noncritical Violations Found:.+(\d+)/imsSU',
utf8_encode($url), $results);



for ($i=0; $i < count($results[0]); $i++)
{
$name1 = strtolower($results[1][$i]);

$name =
ltrim($name1);

$address = strtolower($results[2][$i]);

$inDate
= $results[3][$i];

$inType = $results[4][$i];

$notes =
trim($results[5][$i]);

$critical = trim($results[6][$i]);


$cviolations = $results[7][$i];

$noncritical = $results[8][$i];

//trying to manipulate different field data

$cleanViolations =
str_replace('*', '', $cviolations);
$ucName = ucwords($name);

$ucAddress = ucwords($address);


$mysql_name =
mysql_escape_string($ucName);
$mysql_address =
mysql_escape_string($ucAddress);
$mysql_inDate =
mysql_escape_string($inDate);
$mysql_inType =
mysql_escape_string($inType);
$mysql_notes =
mysql_escape_string($notes);
$mysql_critical =
mysql_escape_string($critical);
$mysql_cviolations =
mysql_escape_string($cleanViolations);
$mysql_noncritical =
mysql_escape_string($noncritical);

echo "$ucName ";

echo "$ucAddress ";
echo "$inDate ";
echo "$inType
";
echo "$notes ";
echo "$critical ";

//echo "$cviolations ";
echo "$cleanViolations ";

echo "$noncritical ";



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




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



Re: [PHP] Argh Date problems (RESOLVED)

2009-07-28 Thread Miller, Terion
OMG AND I FIGURED IT OUT MYSELF...dang I just may be learning some php..


On 7/28/09 3:02 PM, "Miller, Terion"  wrote:

Ok so I got the
$inDate = strtotime($results[3][$i]);

Giving me the unix date now I am trying all the different date functions that 
will put it in the -00-00 like sql stores it because I ran it with the unix 
stamp and it just stored 00 in the db

Hoping something like this works?
 $formatDate = date('ymd', $inDate);


On 7/28/09 2:41 PM, "Miller, Terion"  wrote:

Well I was going along smoothly from this morningbut it came down to
having to change the field type to date in the mySQL..so now I have this
which returns a scraped value formatted like this 0/00/00 m/d/y

 $inDate = $results[3][$i];

Which date function can I use to format for the db so that I will be able to
use range references...there are so many get_date, date_modifyI'm
lost...

My full code is this:

preg_match_all('/(.+)(.+).+(\d+\/\d+\/\d+)\s(.+)(.+).+Critical
Violations Found:.+(\d+)(.+)Noncritical Violations Found:.+(\d+)/imsSU',
utf8_encode($url), $results);



for ($i=0; $i < count($results[0]); $i++)
{
$name1 = strtolower($results[1][$i]);

$name =
ltrim($name1);

$address = strtolower($results[2][$i]);

$inDate
= $results[3][$i];

$inType = $results[4][$i];

$notes =
trim($results[5][$i]);

$critical = trim($results[6][$i]);


$cviolations = $results[7][$i];

$noncritical = $results[8][$i];

//trying to manipulate different field data

$cleanViolations =
str_replace('*', '', $cviolations);
$ucName = ucwords($name);

$ucAddress = ucwords($address);


$mysql_name =
mysql_escape_string($ucName);
$mysql_address =
mysql_escape_string($ucAddress);
$mysql_inDate =
mysql_escape_string($inDate);
$mysql_inType =
mysql_escape_string($inType);
$mysql_notes =
mysql_escape_string($notes);
$mysql_critical =
mysql_escape_string($critical);
$mysql_cviolations =
mysql_escape_string($cleanViolations);
$mysql_noncritical =
mysql_escape_string($noncritical);

echo "$ucName ";

echo "$ucAddress ";
echo "$inDate ";
echo "$inType
";
echo "$notes ";
echo "$critical ";

//echo "$cviolations ";
echo "$cleanViolations ";

echo "$noncritical ";



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






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



[PHP] Re: Broken IF behavior? (Changing the branch changes the evaluation)

2009-07-28 Thread Shawn McKenzie
Matt Neimeyer wrote:
> Background: I'm converting a webapp from Visual FoxPro as a backend to
> MySQL... However one part of our app (a system status checker) is
> common code between the versions.
> 
> I've got the following function... In English (in case it's not
> apparent), if the version of the app is 2.0 or higher, then use MySQL
> functions, otherwise use the ODBTP function to connect to VFP.
> 
> function my_fetch_array($result)
>   {
>   global $Version;
>   if(version_compare($Version,"2.0",">="))
>   { $Ret = mysql_fetch_array($result); if(!$Ret) { } else { 
> return $Ret; } }
>   else{ $Ret = odbtp_fetch_array($result); if(!$Ret) { } else { 
> return $Ret; } }
>   }
> 
> This feels like a hack but works perfectly. Data is returned and all
> is right with the world. Until I added in extra "error reporting".
> When I change the if(!$Ret) portion as such...
> 
>   if(!$Ret) { die("myError".mysql_error()); } else { return $Ret; }
> 
> It ALWAYS dies... and I see "myError" on the screen... If I change it
> like such...
> 
>   if(!$Ret) { } else { echo "notError"; return $Ret; }
> 
> I always see the "notError" on the screen and $Ret gets returned.
> 
> WHY does adding the die() inside the { } change the way the if is evaluated?
> 
> By the way I've tested this on 4.4.x on OSX and Windows, and on 5.2.5
> on Windows...
> 
> Thanks
> 
> Matt

I'm assuming that you are calling my_fetch_array() in a loop of some
sort and so at some point there are no more records in the result.


-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Argh Date problems

2009-07-28 Thread Bastien Koert
On Tue, Jul 28, 2009 at 4:02 PM, Miller,
Terion wrote:
> Ok so I got the
> $inDate = strtotime($results[3][$i]);
>
> Giving me the unix date now I am trying all the different date functions that 
> will put it in the -00-00 like sql stores it because I ran it with the 
> unix stamp and it just stored 00 in the db
>
> Hoping something like this works?
>  $formatDate = date('ymd', $inDate);
>
>
> On 7/28/09 2:41 PM, "Miller, Terion"  wrote:
>
> Well I was going along smoothly from this morningbut it came down to
> having to change the field type to date in the mySQL..so now I have this
> which returns a scraped value formatted like this 0/00/00 m/d/y
>
>  $inDate = $results[3][$i];
>
> Which date function can I use to format for the db so that I will be able to
> use range references...there are so many get_date, date_modifyI'm
> lost...
>
> My full code is this:
>
> preg_match_all('/(.+)(.+).+(\d+\/\d+\/\d+)\s(.+)(.+).+Critical
> Violations Found:.+(\d+)(.+)Noncritical Violations Found:.+(\d+)/imsSU',
> utf8_encode($url), $results);
>
>
>
> for ($i=0; $i < count($results[0]); $i++)
> {
>    $name1 = strtolower($results[1][$i]);
>
>    $name =
> ltrim($name1);
>
>    $address = strtolower($results[2][$i]);
>
>    $inDate
> = $results[3][$i];
>
>    $inType = $results[4][$i];
>
>    $notes =
> trim($results[5][$i]);
>
>    $critical = trim($results[6][$i]);
>
>
> $cviolations = $results[7][$i];
>
>    $noncritical = $results[8][$i];
>
>    //trying to manipulate different field data
>
>    $cleanViolations =
> str_replace('*', '', $cviolations);
>    $ucName = ucwords($name);
>
> $ucAddress = ucwords($address);
>
>
>    $mysql_name =
> mysql_escape_string($ucName);
>    $mysql_address =
> mysql_escape_string($ucAddress);
>    $mysql_inDate =
> mysql_escape_string($inDate);
>    $mysql_inType =
> mysql_escape_string($inType);
>    $mysql_notes =
> mysql_escape_string($notes);
>    $mysql_critical =
> mysql_escape_string($critical);
>    $mysql_cviolations =
> mysql_escape_string($cleanViolations);
>    $mysql_noncritical =
> mysql_escape_string($noncritical);
>
>        echo "$ucName ";
>
> echo "$ucAddress ";
>        echo "$inDate ";
>        echo "$inType
> ";
>        echo "$notes ";
>        echo "$critical ";
>
> //echo "$cviolations ";
>        echo "$cleanViolations ";
>
> echo "$noncritical ";
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Can't you just explode the string and put it back together in the
/MM/DD format that you need?

-- 

Bastien

Cat, the other other white meat

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



Re: [PHP] Argh Date problems

2009-07-28 Thread Miller, Terion



On 7/28/09 3:48 PM, "Bastien Koert"  wrote:

On Tue, Jul 28, 2009 at 4:02 PM, Miller,
Terion wrote:
> Ok so I got the
> $inDate = strtotime($results[3][$i]);
>
> Giving me the unix date now I am trying all the different date functions that 
> will put it in the -00-00 like sql stores it because I ran it with the 
> unix stamp and it just stored 00 in the db
>
> Hoping something like this works?
>  $formatDate = date('ymd', $inDate);
>
>
> On 7/28/09 2:41 PM, "Miller, Terion"  wrote:
>
> Well I was going along smoothly from this morningbut it came down to
> having to change the field type to date in the mySQL..so now I have this
> which returns a scraped value formatted like this 0/00/00 m/d/y
>
>  $inDate = $results[3][$i];
>
> Which date function can I use to format for the db so that I will be able to
> use range references...there are so many get_date, date_modifyI'm
> lost...
>
> My full code is this:
>
> preg_match_all('/(.+)(.+).+(\d+\/\d+\/\d+)\s(.+)(.+).+Critical
> Violations Found:.+(\d+)(.+)Noncritical Violations Found:.+(\d+)/imsSU',
> utf8_encode($url), $results);
>
>
>
> for ($i=0; $i < count($results[0]); $i++)
> {
>$name1 = strtolower($results[1][$i]);
>
>$name =
> ltrim($name1);
>
>$address = strtolower($results[2][$i]);
>
>$inDate
> = $results[3][$i];
>
>$inType = $results[4][$i];
>
>$notes =
> trim($results[5][$i]);
>
>$critical = trim($results[6][$i]);
>
>
> echo "$noncritical ";
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Can't you just explode the string and put it back together in the
/MM/DD format that you need?

--

Bastien

Cat, the other other white meat


Well I got it all formatted and going in the db right and now I'm able to use 
the BETWEEN in my sql and it works like a charm but when I echo the date for 
the page I need to put it back in mm/dd/ order and that part is giving me 
problems...
Not getting why since I figured I could do this again:

$date = $row['inDate'];$formatDate = date('mdy', $Date);

But at any rate it's nearly beer o'clock here hooray, and I'm feeling like 
today I have earned one or two!!
Until tomorrow
Terion

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



Re: [PHP] Multiple MySQL Queries

2009-07-28 Thread sono-io


On Jul 28, 2009, at 12:48 PM, Jim Lucas wrote:


';
echo '';
foreach ( $cats AS $cat ) {
echo ''.htmlspecialchars($cat).'';
}
echo '';
foreach ( $cats AS $cat ) {
echo '';
$cat = mysql_real_escape_string($cat, $db);
$SQL = "SELECT itemid,description,unitprice
FROMcatalog
WHERE   categories='$cat'
ORDER BY itemid";

if ( ($result = mysql_query($SQL, $db)) !== false ) {
while ( $item = mysql_fetch_assoc($result) ) {
$price = money_format('%i', $item['unitprice']);
echo <<{$item['description']}

ROW;
}
} else {
echo "No results for category #{$cat}!";
}
echo '';
}
echo '';

?>


	We're getting close!  This now displays everything in 2 columns.   
Ultimately, what I need is a display like this:


Starter Units Add-On Units

Item#Description   Price  Item#Description   Price
18247C4    $85.89 A18247C4  ---  $76.32
18367C4    $97.37 A18367C4  ---  $82.55

I got the headers to work with this code:

...
foreach ( $cats AS $cat ) {
echo 'Item ID';
echo 'Description';
echo '(Click for more info)';
echo 'Price Each';
echo 'Purchase';
}
echo '';
...

(I don't need to show the category #'s in the header fields) but I  
can't get the rest of the data to flow like I want it.


Thanks,
Frank

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



Re: [PHP] Multiple MySQL Queries

2009-07-28 Thread sono-io


On Jul 28, 2009, at 12:48 PM, Jim Lucas wrote:


';
echo '';
foreach ( $cats AS $cat ) {
echo ''.htmlspecialchars($cat).'';
}
echo '';
foreach ( $cats AS $cat ) {
echo '';
$cat = mysql_real_escape_string($cat, $db);
$SQL = "SELECT itemid,description,unitprice
FROMcatalog
WHERE   categories='$cat'
ORDER BY itemid";

if ( ($result = mysql_query($SQL, $db)) !== false ) {
while ( $item = mysql_fetch_assoc($result) ) {
$price = money_format('%i', $item['unitprice']);
echo <<{$item['description']}

ROW;
}
} else {
echo "No results for category #{$cat}!";
}
echo '';
}
echo '';

?>


	We're getting close!  This now displays everything in 2 columns.   
Ultimately, what I need is a display like this:


Starter Units Add-On Units

Item#Description   Price  Item#Description   Price
18247C4    $85.89 A18247C4  ---  $76.32
18367C4    $97.37 A18367C4  ---  $82.55


	I just noticed something.  This code places all items in a single  
 block.  Each item needs to be separated, so using my example  
data above the html output would need to look like this:


  
Starter Units
Add-On Units
  
  
Item#
Description
Price
Item#
Description
Price
  
  
18247C4  <-- starter unit info
   " "
$85.89 " "
A18247C4  <-- add-on unit info
---" "
$76.32 " "
  
  
18367C4  <-- starter unit info
   " "
$97.37 " "
A18367C4  <-- add-on unit info
---" "
$82.55 " "
  

Thanks,
Frank

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



[PHP] GeoIP Character Encoding

2009-07-28 Thread APseudoUtopia
Hey,

I'm using the PECL GeoIP module on php 5.2.10. When I look up an IP
address, the geoip_record_by_name() function is giving me a string
that contains "special" characters, such as the following:

'Portugal, 09, Vila Real De Santo António'
'Norway, 08, Ålesund'
'Portugal, 04, Vila Nova De Famalicão'

(Note the ó, Å, and ã).

I'm using PostgreSQL as my database. The database's encoding is UTF8,
and the locale is C.

When I try to insert the above strings into a VARCHAR column, I get
errors similar to the following:

ERROR:  invalid byte sequence for encoding "UTF8": 0xf36e696f
ERROR:  invalid byte sequence for encoding "UTF8": 0xc56c
ERROR:  invalid byte sequence for encoding "UTF8": 0xe36f2c

Now, I believe I can solve the problem by changing the client_encoding
of my postgresql client (Right now, it is set to UTF8). However, I'm
trying to figure out what encoding the GeoIP function is returning to
me so that I can set the client_encoding appropriately. Is it LATIN1?
How can I figure it out? And can I change it to UTF8?

Thank you for your time.

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



Re: [PHP] Multiple MySQL Queries

2009-07-28 Thread Jim Lucas
sono...@fannullone.us wrote:
> 
> On Jul 28, 2009, at 12:48 PM, Jim Lucas wrote:
> 
>> > $item_list = "";
>> $cats = array('01100-01200-01300-06403', '01100-02201-01300-06403');
>>
>> echo '';
>> echo '';
>> foreach ( $cats AS $cat ) {
>> echo ''.htmlspecialchars($cat).'';
>> }
>> echo '';
>> foreach ( $cats AS $cat ) {
>> echo '';
>> $cat = mysql_real_escape_string($cat, $db);
>> $SQL = "SELECTitemid,description,unitprice
>> FROMcatalog
>> WHEREcategories='$cat'
>> ORDER BY itemid";
>>
>> if ( ($result = mysql_query($SQL, $db)) !== false ) {
>> while ( $item = mysql_fetch_assoc($result) ) {
>> $price = money_format('%i', $item['unitprice']);
>> echo <<>
>> > >{$item['description']}
>>
>> ROW;
>> }
>> } else {
>> echo "No results for category #{$cat}!";
>> }
>> echo '';
>> }
>> echo '';
>>
>> ?>
> 
> We're getting close!  This now displays everything in 2 columns. 
> Ultimately, what I need is a display like this:
> 
> Starter Units  Add-On Units
> 
> Item#Description   Price  Item#Description   Price
> 18247C4    $85.89 A18247C4  ---  $76.32
> 18367C4    $97.37 A18367C4  ---  $82.55
> 
> I got the headers to work with this code:
> 
> ...
> foreach ( $cats AS $cat ) {
> echo 'Item ID';
> echo 'Description';
> echo '(Click for more info)';
> echo 'Price Each';
> echo 'Purchase';
> }
> echo '';
> ...
> 
> (I don't need to show the category #'s in the header fields) but I can't
> get the rest of the data to flow like I want it.
> 
> Thanks,
> Frank
> 

After Thought!

I saw your other email before sending.  The problem with the way you
show you want it there is that each result set would have to be the same
size.  I'm going to assume that they won't be, so my solution below show
take care of it.


...


Well, this makes things a little more complicated.

But, here is another round...

';
echo '';
foreach ( $cats AS $cat ) {
echo <<


Item#
Description
Price


START;

$cat = mysql_real_escape_string($cat, $db);
$SQL = "SELECTitemid,description,unitprice
FROMcatalog
WHEREcategories='$cat'
ORDER BY itemid";

if ( ($result = mysql_query($SQL, $db)) !== false ) {
while ( $item = mysql_fetch_assoc($result) ) {
$price = money_format('%i', $item['unitprice']);
echo <<
{$item['itemid']}
{$item['description']}
{$item['price']}


ROW;
}

} else {
echo "No results for category #{$cat}!";
}
echo '';
}
echo '';

?>


I think all the above is correct.  Give it a try and let us know.


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



RE: [PHP] Font problem {CORRECTION}

2009-07-28 Thread HallMarc Websites
> 
> Jim has listed some nice alternatives, however, they are limited in
> their scope. I will point you to a solution called Cufon. This by far
> the best I have found to date (IMHO). This is a JavaScript solution. It
> will render ANY ttf or rtf font. The common issue you run into is the
> legal issue. Most of the fonts we want to use need to be purchased by
> the end user. The developers of Cufon are in talks with the Font
> Foundries to find a solution that will protect the font from being
> stolen. As of this writing the Foundries fear that the JavaScript file
> that is produced from the original fonts could be reverse engineered
> and give the font away for free. I have tried to put this file outside
> of the root folder of the site and found that I cannot call it. I
> haven't spent too much time on this yet. I'm sure there is a way, I
> just haven't found it yet.
> 
> Here is the link to Cufon
> http://wiki.github.com/sorccu/cufon/about
> the javascript generator can be found here
> http://cufon.shoqolate.com/generate/
> 
> One more thing and I can't stress this enough - USE AT YOUR OWN RISK!!!
> In the US Intellectual Property Theft is one of those laws whereby you
> are guilty until proven innocent ad each incident can cost you $100k!
> 
> [HallMarc Websites]
> 
> 

Argh! I see a typo that I have no excuses for. It should read "any ttf or otf" 
not rtf. Sorry bout that 



[HallMarc Websites] 
 

__ Information from ESET Smart Security, version of virus signature 
database 4286 (20090728) __

The message was checked by ESET Smart Security.

http://www.eset.com
 


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



[PHP] Message Board Recommendations

2009-07-28 Thread tedd

Hi gang:

I have a client who is looking for a "Message Board for Subscribers" 
to be installed on his site -- one with a good admin. Any 
recommendations?


Thanks,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] Access Denied

2009-07-28 Thread Ernie Kemp
 

Line in Program:

//connect to server and select database

//connect to server and select database

$mysqli = mysqli_connect("localhost", "jdoe", "doepass", "testdb");

 

//create and issue the query

$sql = "SELECT f_name, l_name FROM auth_users WHERE username =
'".$_POST["username"]."' AND password = PASSWORD('".$_POST["password"]."')";

$result = mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));

 

 

Record in mySQl database:
UsersPASSWORD

id f_name l_name email username password
 Edit
 Delete1 John Doe j...@doe.com jdoe
*0AAD744979343D58A7F17A50E514E6AD6533D04B

 

 

Message from Firefox Browser:

Warning: mysqli_connect() [function.mysqli-connect
 ]: (28000/1045):
Access denied for user 'jdoe'@'localhost' (using password: YES) in
C:\wamp\www\rogers\userlogin.php on line 9

Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in
C:\wamp\www\rogers\userlogin.php on line 13

Warning: mysqli_error() expects parameter 1 to be mysqli, boolean given in
C:\wamp\www\rogers\userlogin.php on line 13

 

This one has got me.  

Please Help.

 

/Ernie



[PHP] Recall: Access Denied

2009-07-28 Thread Ernie Kemp
Ernie Kemp would like to recall the message, "Access Denied".

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

Re: [PHP] Access Denied

2009-07-28 Thread Jim Lucas

Ernie Kemp wrote:
 


Line in Program:

//connect to server and select database

//connect to server and select database

$mysqli = mysqli_connect("localhost", "jdoe", "doepass", "testdb");

 


//create and issue the query

$sql = "SELECT f_name, l_name FROM auth_users WHERE username =
'".$_POST["username"]."' AND password = PASSWORD('".$_POST["password"]."')";

$result = mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));

 

 


Record in mySQl database:
UsersPASSWORD

id f_name l_name email username password
 Edit
 Delete1 John Doe j...@doe.com jdoe
*0AAD744979343D58A7F17A50E514E6AD6533D04B

 

 


Message from Firefox Browser:

Warning: mysqli_connect() [function.mysqli-connect
 ]: (28000/1045):
Access denied for user 'jdoe'@'localhost' (using password: YES) in
C:\wamp\www\rogers\userlogin.php on line 9



Ok, not to be harsh, but I thought I would point it out before others jumped on 
this one.

The answer to your question is in the question itself.

Access denied for user 'jdoe'@'localhost' (using password: YES) in
C:\wamp\www\rogers\userlogin.php on line 9

So, since line 9 is your mysqli_connect() call, I would suggest looking at the 
manual page for that.

http://php.net/mysqli_connect

Plus look at mysql documentation on how to create a new user, grant them privileges, and flush the 
privileges table.


http://dev.mysql.com/doc/refman/5.1/en/adding-users.html

A simple Google search would have brought you to these pages.

As for the reset of the errors.  Fix the first one and the others might be 
fixed also.

Jim


Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in
C:\wamp\www\rogers\userlogin.php on line 13

Warning: mysqli_error() expects parameter 1 to be mysqli, boolean given in
C:\wamp\www\rogers\userlogin.php on line 13

 

This one has got me.  


Please Help.

 


/Ernie





--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

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



RE: [PHP] Access Denied

2009-07-28 Thread Ernie Kemp
Please ignore.

 

Newbie error solved

Thanks

 

From: Ernie Kemp [mailto:ernie.k...@sympatico.ca] 
Sent: July-28-09 9:34 PM
To: php-general@lists.php.net
Subject: [PHP] Access Denied

 

Line in Program:

//connect to server and select database

//connect to server and select database

$mysqli = mysqli_connect("localhost", "jdoe", "doepass", "testdb");

 

//create and issue the query

$sql = "SELECT f_name, l_name FROM auth_users WHERE username =
'".$_POST["username"]."' AND password = PASSWORD('".$_POST["password"]."')";

$result = mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));

 

 

Record in mySQl database:
UsersPASSWORD

id f_name l_name email username password
 Edit
 Delete1 John Doe j...@doe.com jdoe
*0AAD744979343D58A7F17A50E514E6AD6533D04B

 

 

Message from Firefox Browser:

Warning: mysqli_connect() [function.mysqli-connect
 ]: (28000/1045):
Access denied for user 'jdoe'@'localhost' (using password: YES) in
C:\wamp\www\rogers\userlogin.php on line 9

Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in
C:\wamp\www\rogers\userlogin.php on line 13

Warning: mysqli_error() expects parameter 1 to be mysqli, boolean given in
C:\wamp\www\rogers\userlogin.php on line 13

 

This one has got me.  

Please Help.

 

/Ernie



Re: [PHP] Multiple MySQL Queries

2009-07-28 Thread sono-io


On Jul 28, 2009, at 4:38 PM, Jim Lucas wrote:


I saw your other email before sending.  The problem with the way you
show you want it there is that each result set would have to be the  
same

size.  I'm going to assume that they won't be...


	Well, they SHOULD be but you never know.  Thanks for thinking about  
that.



But, here is another round...

I think all the above is correct.  Give it a try and let us know.


It works!  The only thing I had to change was:

{$item['price']}
to
{$price}

Jim, I can't thank you enough.  This is exactly what I was hoping for.

Regards,
Frank

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



[PHP] How to Install Roadsend Compiler on Fedora

2009-07-28 Thread Javed Khan
Can something please show me to install Roadsend Compiler on Fedora 10. 
Thank you, 
J.K