Re: [PHP] What's wrong with this code?

2010-06-05 Thread David Mehler
Hello everyone,
Much thanks. Sometimes when you stare at code for so long it blurs
together, that's how it is with me at least. That was my problem, case
sensitive variable.
Thanks a lot.
Dave.


On 6/5/10, Mari Masuda  wrote:
> Could it be that you are not using the same variable name?  In the if
> statement you are using $row['EndDate'] and when attempting to print you are
> using $row['enddate'].  I think you need to be consistent about which
> capitalization you use (and make sure it matches what is in the db).
>
 if (!empty($row['EndDate'])) {
 echo "" . $row['enddate'] . "";
 }
>
>
>
> On Jun 5, 2010, at 5:43 PM, David Mehler wrote:
>
>> Hi,
>> Thanks. I took out the entire else section including the exit call, it
>> now all processes, however $row['enddate'] is not displayed on the two
>> records where it is set.
>> Thanks.
>> Dave.
>>
>>
>> On 6/5/10, Karl DeSaulniers  wrote:
>>> Could the exit() be terminating it? Do you need this exit() as the
>>> else for that if statement? Try deleting just the else {}.
>>>
>>> JAT
>>>
>>> Karl
>>>
>>> Sent from losPhone
>>>
>>> On Jun 5, 2010, at 6:54 PM, David Mehler  wrote:
>>>
 Hello,
 I've got a while loop outputting values from a database. Briefly it
 looks like this:

 while($row = mysql_fetch_array($result3))
 {
 echo "";
 echo "" . $row['name'] . "";
 echo "" . $row['type'] . "";
 echo "" . $row['startdate'] . "";
 if (!empty($row['EndDate'])) {
 echo "" . $row['enddate'] . "";
 } else {
 exit();
 }
 echo "" . $row['location'] . "";
 echo "" . $row['summary'] . "";
 echo "" . $row['description'] . "";
 echo "";
 }

 That's not the whole code, but it is the problem code. Some output has
 the ending date set, one or two records i can't remember how many i
 entered with one, most do not, i want the echo to be conditional. The
 output stops right before the if statement, echoes startdate and
 that's it, comment out the if block and it works fine.
 Thanks.
 Dave.

 --
 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 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] What's wrong with this code?

2010-06-05 Thread Mari Masuda
Could it be that you are not using the same variable name?  In the if statement 
you are using $row['EndDate'] and when attempting to print you are using 
$row['enddate'].  I think you need to be consistent about which capitalization 
you use (and make sure it matches what is in the db).

>>> if (!empty($row['EndDate'])) {
>>> echo "" . $row['enddate'] . "";
>>> }



On Jun 5, 2010, at 5:43 PM, David Mehler wrote:

> Hi,
> Thanks. I took out the entire else section including the exit call, it
> now all processes, however $row['enddate'] is not displayed on the two
> records where it is set.
> Thanks.
> Dave.
> 
> 
> On 6/5/10, Karl DeSaulniers  wrote:
>> Could the exit() be terminating it? Do you need this exit() as the
>> else for that if statement? Try deleting just the else {}.
>> 
>> JAT
>> 
>> Karl
>> 
>> Sent from losPhone
>> 
>> On Jun 5, 2010, at 6:54 PM, David Mehler  wrote:
>> 
>>> Hello,
>>> I've got a while loop outputting values from a database. Briefly it
>>> looks like this:
>>> 
>>> while($row = mysql_fetch_array($result3))
>>> {
>>> echo "";
>>> echo "" . $row['name'] . "";
>>> echo "" . $row['type'] . "";
>>> echo "" . $row['startdate'] . "";
>>> if (!empty($row['EndDate'])) {
>>> echo "" . $row['enddate'] . "";
>>> } else {
>>> exit();
>>> }
>>> echo "" . $row['location'] . "";
>>> echo "" . $row['summary'] . "";
>>> echo "" . $row['description'] . "";
>>> echo "";
>>> }
>>> 
>>> That's not the whole code, but it is the problem code. Some output has
>>> the ending date set, one or two records i can't remember how many i
>>> entered with one, most do not, i want the echo to be conditional. The
>>> output stops right before the if statement, echoes startdate and
>>> that's it, comment out the if block and it works fine.
>>> Thanks.
>>> Dave.
>>> 
>>> --
>>> 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 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] What's wrong with this code?

2010-06-05 Thread Karl DeSaulniers

So your code looks like this?

while($row = mysql_fetch_array($result3))
{
echo "";
echo "" . $row['name'] . "";
echo "" . $row['type'] . "";
echo "" . $row['startdate'] . "";
if (!empty($row['EndDate'])) {  //This should probably be $row 
['enddate']

echo "" . $row['enddate'] . "";
}

echo "" . $row['location'] . "";
echo "" . $row['summary'] . "";
echo "" . $row['description'] . "";
echo "";
}


Not to mention, you have a $row['EndDate'] and a $row['enddate'].
Probably need to choose one or the other.

HTH,

Karl



On Jun 5, 2010, at 7:43 PM, David Mehler wrote:


Hi,
Thanks. I took out the entire else section including the exit call, it
now all processes, however $row['enddate'] is not displayed on the two
records where it is set.
Thanks.
Dave.


On 6/5/10, Karl DeSaulniers  wrote:

Could the exit() be terminating it? Do you need this exit() as the
else for that if statement? Try deleting just the else {}.

JAT

Karl

Sent from losPhone

On Jun 5, 2010, at 6:54 PM, David Mehler   
wrote:



Hello,
I've got a while loop outputting values from a database. Briefly it
looks like this:

while($row = mysql_fetch_array($result3))
{
echo "";
echo "" . $row['name'] . "";
echo "" . $row['type'] . "";
echo "" . $row['startdate'] . "";
if (!empty($row['EndDate'])) {
echo "" . $row['enddate'] . "";
} else {
exit();
}
echo "" . $row['location'] . "";
echo "" . $row['summary'] . "";
echo "" . $row['description'] . "";
echo "";
}

That's not the whole code, but it is the problem code. Some  
output has

the ending date set, one or two records i can't remember how many i
entered with one, most do not, i want the echo to be conditional.  
The

output stops right before the if statement, echoes startdate and
that's it, comment out the if block and it works fine.
Thanks.
Dave.

--
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] What's wrong with this code?

2010-06-05 Thread David Mehler
Hi,
Thanks. I took out the entire else section including the exit call, it
now all processes, however $row['enddate'] is not displayed on the two
records where it is set.
Thanks.
Dave.


On 6/5/10, Karl DeSaulniers  wrote:
> Could the exit() be terminating it? Do you need this exit() as the
> else for that if statement? Try deleting just the else {}.
>
> JAT
>
> Karl
>
> Sent from losPhone
>
> On Jun 5, 2010, at 6:54 PM, David Mehler  wrote:
>
>> Hello,
>> I've got a while loop outputting values from a database. Briefly it
>> looks like this:
>>
>> while($row = mysql_fetch_array($result3))
>> {
>> echo "";
>> echo "" . $row['name'] . "";
>> echo "" . $row['type'] . "";
>> echo "" . $row['startdate'] . "";
>> if (!empty($row['EndDate'])) {
>> echo "" . $row['enddate'] . "";
>> } else {
>> exit();
>> }
>> echo "" . $row['location'] . "";
>> echo "" . $row['summary'] . "";
>> echo "" . $row['description'] . "";
>> echo "";
>> }
>>
>> That's not the whole code, but it is the problem code. Some output has
>> the ending date set, one or two records i can't remember how many i
>> entered with one, most do not, i want the echo to be conditional. The
>> output stops right before the if statement, echoes startdate and
>> that's it, comment out the if block and it works fine.
>> Thanks.
>> Dave.
>>
>> --
>> 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] What's wrong with this code?

2010-06-05 Thread Karl DeSaulniers
Could the exit() be terminating it? Do you need this exit() as the  
else for that if statement? Try deleting just the else {}.


JAT

Karl

Sent from losPhone

On Jun 5, 2010, at 6:54 PM, David Mehler  wrote:


Hello,
I've got a while loop outputting values from a database. Briefly it
looks like this:

while($row = mysql_fetch_array($result3))
{
echo "";
echo "" . $row['name'] . "";
echo "" . $row['type'] . "";
echo "" . $row['startdate'] . "";
if (!empty($row['EndDate'])) {
echo "" . $row['enddate'] . "";
} else {
exit();
}
echo "" . $row['location'] . "";
echo "" . $row['summary'] . "";
echo "" . $row['description'] . "";
echo "";
}

That's not the whole code, but it is the problem code. Some output has
the ending date set, one or two records i can't remember how many i
entered with one, most do not, i want the echo to be conditional. The
output stops right before the if statement, echoes startdate and
that's it, comment out the if block and it works fine.
Thanks.
Dave.

--
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] unlink()?

2010-06-05 Thread Ashley Sheridan
On Sat, 2010-06-05 at 18:55 -0400, tedd wrote:

> Hi gang:
> 
> Never-mind.
> 
> I didn't change the parent directory permissions to unlink the file -- duh!
> 
> Cheers,
> 
> tedd
> 
> --- I asked:
> 
> Hi gang:
> 
> I use unlink() to delete files on my server by using the statement:
> 
> unlink($filename);
> 
> where $filename is the physical path to the file plus file name, such as:
> 
> $filename = '/var/www/vhosts/domain.com/httpdocs/a-dir/a-text.txt';
> 
> Now, I can read, write, and even create the file -- so I have the 
> path and permissions correct. But if I unlink() the file and then 
> examine the contents of the parent directory afterwards, I find the 
> file remains -- what's up with that?
> 
> This reminds me of the process of deleting files on your local hard 
> disk, which basically sets the disk-space allocated to the file as 
> "available for writing" without actually deleting the file.
> 
> So what am I not understanding here?
> 
> Cheers,
> 
> tedd
> 
> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 


I was just about to mention this! It's one of the bizarre security
loopholes in Linux. If you have write permissions to a directory but not
a file within it, you can still delete the file. I believe you can
change this behaviour with filesystem security mods, but I've not tried
that.

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




[PHP] What's wrong with this code?

2010-06-05 Thread David Mehler
Hello,
I've got a while loop outputting values from a database. Briefly it
looks like this:

while($row = mysql_fetch_array($result3))
 {
 echo "";
 echo "" . $row['name'] . "";
 echo "" . $row['type'] . "";
 echo "" . $row['startdate'] . "";
if (!empty($row['EndDate'])) {
 echo "" . $row['enddate'] . "";
} else {
exit();
}
 echo "" . $row['location'] . "";
 echo "" . $row['summary'] . "";
 echo "" . $row['description'] . "";
 echo "";
}

That's not the whole code, but it is the problem code. Some output has
the ending date set, one or two records i can't remember how many i
entered with one, most do not, i want the echo to be conditional. The
output stops right before the if statement, echoes startdate and
that's it, comment out the if block and it works fine.
Thanks.
Dave.

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



[PHP] unlink()?

2010-06-05 Thread tedd

Hi gang:

Never-mind.

I didn't change the parent directory permissions to unlink the file -- duh!

Cheers,

tedd

--- I asked:

Hi gang:

I use unlink() to delete files on my server by using the statement:

unlink($filename);

where $filename is the physical path to the file plus file name, such as:

$filename = '/var/www/vhosts/domain.com/httpdocs/a-dir/a-text.txt';

Now, I can read, write, and even create the file -- so I have the 
path and permissions correct. But if I unlink() the file and then 
examine the contents of the parent directory afterwards, I find the 
file remains -- what's up with that?


This reminds me of the process of deleting files on your local hard 
disk, which basically sets the disk-space allocated to the file as 
"available for writing" without actually deleting the file.


So what am I not understanding here?

Cheers,

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



Re: [PHP] unlink()?

2010-06-05 Thread Richard Quadling
On 5 June 2010 23:45, tedd  wrote:
> Hi gang:
>
> I use unlink() to delete files on my server by using the statement:
>
> unlink($filename);
>
> where $filename is the physical path to the file plus file name, such as:
>
> $filename = '/var/www/vhosts/domain.com/httpdocs/a-dir/a-text.txt';
>
> Now, I can read, write, and even create the file -- so I have the path and
> permissions correct. But if I unlink() the file and then examine the
> contents of the parent directory afterwards, I find the file remains --
> what's up with that?
>
> This reminds me of the process of deleting files on your local hard disk,
> which basically sets the disk-space allocated to the file as "available for
> writing" without actually deleting the file.
>
> So what am I not understanding here?
>
> Cheers,
>
> 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
>
>

What is the result of the unlink()? Enable errors/warnings.



-- 
-
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



[PHP] unlink()?

2010-06-05 Thread tedd

Hi gang:

I use unlink() to delete files on my server by using the statement:

unlink($filename);

where $filename is the physical path to the file plus file name, such as:

$filename = '/var/www/vhosts/domain.com/httpdocs/a-dir/a-text.txt';

Now, I can read, write, and even create the file -- so I have the 
path and permissions correct. But if I unlink() the file and then 
examine the contents of the parent directory afterwards, I find the 
file remains -- what's up with that?


This reminds me of the process of deleting files on your local hard 
disk, which basically sets the disk-space allocated to the file as 
"available for writing" without actually deleting the file.


So what am I not understanding here?

Cheers,

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



Re: [PHP] CakePHP, alternatives?

2010-06-05 Thread Larry Garfield
One other thing I will add:

Don't just learn PHP.  Learn Javascript as well.  Don't treat it as PHP 
without dollar signs, but learn Javascript as Javascript, and PHP as PHP.  
Then after you've gotten some time with those, take some time to learn, or at 
least learn about even if you never work with it, Erlang.  Or Haskel. Or some 
other stricter, purely functional language.  Something that works totally 
differently than PHP.

Even if you don't ever use it, the perspective you gain from approaching a 
problem from a different angle will help you learn about the strengths and 
weaknesses of different languages, different ways of thinking, different ways 
of 
leveraging your tools well, etc.

The 6 hours or so I spent reading about Erlang and purely functional languages 
helped my PHP skills considerably, even though I never wrote a single line of 
Erlang.  (I was already very solid in PHP at the time, but it made me even 
better.)

--Larry Garfield

On Saturday 05 June 2010 12:51:47 am Shreyas wrote:
> @ All - Points duly noted. Thanks for all the mighty advice.
> 
> As the owner of the thread, I consider the thread closed for now unless
> anyone has anything to add.
> 
> --Shreyas
> 
> On Sat, Jun 5, 2010 at 1:02 AM, Adam Richardson wrote:
> > > I am reading this PHP for Dummies and then I plan to read Head First
> > > with PHP, MySQL, and Apache. Do you know any books that I can read
> > > online or I can buy? I would be happy to do that.
> >
> > Hi  Shreyas,
> >
> > I think you've received some excellent advice.
> >
> > I like the Head First Books quite a bit.  I attended grad school for
> > cognitive psychology, and I can tell you that the Head First Books do a
> > great job of integrating methods shown to enhance learning.
> >
> > I own several of the books in the series, including those on iPhone
> > development and Design Patterns, and while I don't own the PHP book, I've
> > reviewed it at the book store and recommend it to some friends who have
> > taken up PHP, too, and they've been very pleased with the resource.
> >
> > I hope you have an enriching, enjoyable experience as you learn PHP.
> >
> > Adam
> >
> > --
> > Nephtali:  PHP web framework that functions beautifully
> > http://nephtaliproject.com
> 

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



php-general@lists.php.net

2010-06-05 Thread Ashley Sheridan
On Sat, 2010-06-05 at 12:46 -0400, Brandon Rampersad wrote:

> Those are POST parameters and not GET.
> 
> On Fri, Jun 4, 2010 at 10:55 AM, Paul M Foster wrote:
> 
> > On Fri, Jun 04, 2010 at 06:54:34AM -0700, Michael Calkins wrote:
> >
> > >
> > > I would google this but I have no idea what this method is or how it
> > works.
> > > app.php?ph=cus&id=4
> > > Can some tell me what this either called or how it works?Can I get a
> > tutorial for it please?
> >
> > This is standard HTTP/HTML terminology, not unique to PHP. What is means
> > is that the script being executed (app.php) has been supplied two
> > parameters: "ph" and "id".
> >
> > app.php is a script that can perform various functions, depending on the
> > parameters passed to it. For example, app.php may display a record from
> > a database. And in this case, app.php may be tasked to display a
> > customer record, and the customer record it should display is the one
> > where the customer number is 4.
> >
> > Syntax-wise, after the name of the script (app.php), are whatever
> > parameters, if any, the script requires. The first question mark begins
> > the list of parameters. Each parameter normally will be in the form
> >
> > parameter=value
> >
> > In between each of these parameter/value pairs, you will find an
> > ampersand (&). So in this case, you have two parameters being passed.
> > The first is "ph", and its value is "cus". The second is "id" and its
> > value is "4". What these parameters mean exactly to the script depends
> > on the script. There's no universal guide for parameters, what they're
> > called or what their values can be. You'd have to look at the script
> > itself to see what the parameters make the script do.
> >
> > In PHP, if you want to use these parameters, you would query the
> > parameters this way:
> >
> > $page_type = $_GET['ph'];
> > $which_item = $_GET['id'];
> >
> > If executed this way, you would find that $page_type has a value of
> > 'cus', and $which_item = '4'.
> >
> > You might have code inside app.php which would look like the following:
> >
> > $type = $_GET['ph'];
> > $id = $_GET['id'];
> >
> > if ($type == 'cus')
> >show_customer_page($id);
> >
> > Hope that helps.
> >
> > Paul
> >
> > --
> > Paul M. Foster
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> 


Erm, no, they're definitely get variables and not post. Get data is sent
as part of the query string portion of the URL, post data is sent as
part of the header request.

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




php-general@lists.php.net

2010-06-05 Thread Brandon Rampersad
Those are POST parameters and not GET.

On Fri, Jun 4, 2010 at 10:55 AM, Paul M Foster wrote:

> On Fri, Jun 04, 2010 at 06:54:34AM -0700, Michael Calkins wrote:
>
> >
> > I would google this but I have no idea what this method is or how it
> works.
> > app.php?ph=cus&id=4
> > Can some tell me what this either called or how it works?Can I get a
> tutorial for it please?
>
> This is standard HTTP/HTML terminology, not unique to PHP. What is means
> is that the script being executed (app.php) has been supplied two
> parameters: "ph" and "id".
>
> app.php is a script that can perform various functions, depending on the
> parameters passed to it. For example, app.php may display a record from
> a database. And in this case, app.php may be tasked to display a
> customer record, and the customer record it should display is the one
> where the customer number is 4.
>
> Syntax-wise, after the name of the script (app.php), are whatever
> parameters, if any, the script requires. The first question mark begins
> the list of parameters. Each parameter normally will be in the form
>
> parameter=value
>
> In between each of these parameter/value pairs, you will find an
> ampersand (&). So in this case, you have two parameters being passed.
> The first is "ph", and its value is "cus". The second is "id" and its
> value is "4". What these parameters mean exactly to the script depends
> on the script. There's no universal guide for parameters, what they're
> called or what their values can be. You'd have to look at the script
> itself to see what the parameters make the script do.
>
> In PHP, if you want to use these parameters, you would query the
> parameters this way:
>
> $page_type = $_GET['ph'];
> $which_item = $_GET['id'];
>
> If executed this way, you would find that $page_type has a value of
> 'cus', and $which_item = '4'.
>
> You might have code inside app.php which would look like the following:
>
> $type = $_GET['ph'];
> $id = $_GET['id'];
>
> if ($type == 'cus')
>show_customer_page($id);
>
> Hope that helps.
>
> Paul
>
> --
> Paul M. Foster
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
A Brandon_R Production