Re: [PHP] Netbeans IDE 6.5

2009-10-28 Thread James McLean
On Thu, Oct 29, 2009 at 4:05 AM, Skip Evans  wrote:
> Now, if I can just get rid of that red line at the 80 column mark. I haven't
> bothered with 80 columns since I wrote assembly on a terminal connected to a
> PDP-11 in college.

I myself and I'm sure many others will agree that sticking to 'around'
80 chars is best-practice, it's handy for those times when you need to
fix code in an emergency in an 80 col terminal, among other reasons.
Personally the 80 col marker (I set it to 78 cols actually) is one of
the first things I enable in Eclipse PDT..

Zend would (mostly) agree:
http://framework.zend.com/manual/en/coding-standard.php-file-formatting.html

Cheers,

James

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



Re: [PHP] Re: Create a screenshot of a website

2009-10-28 Thread Manuel Lemos
Hello,

on 10/28/2009 06:37 PM Paul M Foster said the following:
>> Anyway, if you are that sensitive to design issues, why don't you
>> participate in the contest to propose a better design instead of just
>> complaining against the work that others do to help the PHP community?
>>
>> You can earn prizes and start helping instead of just putting down what
>> others do.
>>
>> http://www.phpclasses.org/blog/post/104-Submit-your-site-redesign-proposal-for-the-contest.html
> 
> Here's a free suggestion. You don't even have to give me a prize. You
> know those random words which are underlined on that page, and when you
> mouse over them, you get the random advertisement on a completely
> unrelated subject, which also emits a *sound* on my computer? Get rid of
> them completely. They are beyond annoying. I get that you need to make
> money with this site, but those obnoxious ads are the exact opposite
> wrong way to do it.

I suppose you are not familiar with the site publishing business.

This site, like many other, is a relatively small site, with only 2
million page view a month.

If you do not have sites with at least 20 million page view a month, you
are considered a small publisher, so you do not have a bugdet to pay for
an advertising sales team. Therefore you need to work with ad agencies
with take a big cut to sell ad space to advertisers.

Those ads you see are placed by agencies like that. They were supposed
to be contextual, so they would be relevant and related with the site
content. If they do not look relevant is because that is the advertisers
they are getting now.

We are still in the middle of a big crisis that will probably not end
before 2012. Many governments are saying they have exited the crisis,
but I am afraid that is just wishful thinking with the purpose of
spreading optimism and help recovering the market.

If the ads you see are not very related, that means that the related
advertising have closed their business or are afraid to spend.

Unfortunately, we small site owners need to be patient and wait for the
market to return.


> Also, while I wouldn't have expressed it quite as crassly as Robert, I
> have to agree on his evaluation of the site's look. I have a logon on
> your site and have been to it many times. I just figured you liked it
> like that. But in truth, it needs a serious and complete makeover. But
> like Robert, I have no end of things to take care of, quite outside of
> redisigning phpclasses.net. I'd suggest you scrap the contest and go
> find a good free CSS template. But that's just me.

That would not solve anything. The vast majority of the users does not
really care. The problem is that those that care always want something
different that changes every year.

Picking up any other template will not solve any problem. Complainers
will keep complaining, probably forever.

The point of the contest is to let those that are sensitive to design
issues to propose something they believe it is better, instead of just
complaining.

It is impossible to please everybody. Whatever design will win, there
will always be people complaining. To make sure the change will be more
liked than disliking it, I am making it democratic. People that care
will decide.

This way complainers will not have anymore excuse to blame the site for
not having a better design. The majority decides. I will be like
Pilates, I will wash my hands, and pay the prizes, of course.

The main prize is not huge, but it is not cheap either. USD $3,000, a
big elePHPant and a lifetime premium subscription. Runner ups will also
get prizes from sponsors.

http://www.phpclasses.org/award/design/

So, now it is not time to complain. If you care about the site and the
current design bugs you, this is your chance to propose something better
and even earn prizes.

The submission period will last till the end of November. If you are
interested, you may start here:

http://www.phpclasses.org/design.html


-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



Re: [PHP] Textarea to road a text file

2009-10-28 Thread Jean Lee
Thank you, Jay Blanchard and Andrew Ballard!!!

Could you explain what was my fault concerned about this case?
Thanks in advance!
My codes were


.
..

" . $contents . "";

?>






""Jay Blanchard""  wrote in message 
news:31454d514ff9a949b1fdfe294d5d1d80080...@ygex01wal.onecall.local...
[snip]I want to use Textarea as the text-file viewer and editor of my
homepage. But Textarea doesn't work exactly as i intended.
In sometimes, TextArea doesn't show up and moreover the some parts of
the file are displayed(rendered) in browser without TextArea![/snip]

Not enough information to complete yourrequest? 



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



Re: [PHP] How is this possible? [Solved]

2009-10-28 Thread Jim Lucas
tedd wrote:
> At 2:48 PM -0400 10/28/09, Robert Cummings wrote:
>> Bob McConnell wrote:
>>> From: tedd
>>>
 I found the problem, which basically was that I had declared a
 variable in a preceding script with the same name, namely $user_id.

 When I changed my script to $u_id, everything worked as before.
 Clearly, Globals are evil.

 It's a bitch to have to work with code you can't change unless you
 are willing to edit over 1500 files.
>>>
>>> Just keep in mind that register_globals is deprecated and will be going
>>> away in a future release of PHP. You might want to start thinking about
>>> a strategy to update those files before that happens.
>>>
>>> Bob McConnell
>>
>> I don't think his problem was register_globals, I think it was the
>> other problem of globals... namely variable naming collision causing
>> value clobber.
>>
>> Cheers,
>> Rob.
> 
> 
> Rob:
> 
> You were exactly right -- it was a collision.
> 
> Now, if I can only find out why header("location:.."); stopped working.
> 
> Sometimes old code presents a lot of problems to solve.
> 
> Thanks,
> 
> tedd
> 

I would use headers_sent() to find out if the headers have been sent before
calling header()


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



[PHP] RE: Help with my first recursion menu

2009-10-28 Thread MEM
> -Original Message-
> From: MEM [mailto:tal...@gmail.com]
> Sent: quarta-feira, 28 de Outubro de 2009 15:55
> To: 'php-general@lists.php.net'
> Subject: Help with my first recursion menu
> 
> Hello all,
> 
> Please have a look here:
> http://www.nuvemk.com/c_categoria/seccao/1
> 
> 
> When we click on "Fitofármacos", I can display the correspondent
> children! This is great! And I'm really happy!
> :)
> 
> When we click on Fitofármacos children - "Herbicidas", I was expecting
> to have returned Herbicidas childs, without losing the Fitofármacos
> menu item.
> 
> The reason I'm losing him, I suppose, it's due the fact that the URI is
> not properly generated by the function responsible to parse a menu.
> 
> Notice that, on the link posted above:
> If you click on fitofármacos and then click on herbicidas, the expected
> URL should be:
> http://www.nuvemk.com/c_categoria/seccao/1/6/9/
> 
> but I'm getting this instead:
> http://www.nuvemk.com/c_categoria/seccao/6/9/
> 
> If we try to navigate deeply, and inside Herbicidas we click on
> "Herbicidas A", we are expecting an URL like so:
> http://www.nuvemk.com/c_categoria/seccao/1/6/9/27/
> 
> But we are getting this instead:
> http://www.nuvemk.com/c_categoria/seccao/9/27/
> 
> 
> Here is the actual code:
> http://pastebin.com/m8ffe9db
> 
> I've not yet completely understand the recursion, can I have your help
> in order to understand how can I recursively build the URI segments?
> 
> 
> 
> Thanks a lot in advance,
> Márcio




I've been told that stack is the way to go, so I'm trying to understand the
following code:
http://pastebin.com/m5616c88f
I've commented every line so that any of you could see if I'm interpreting
something wrong:


I have two questions about this code, that hopefully someone on the list
could explain:

1)
Why do we need to remove the last array item? (on line 32):
array_pop($urlStack);

2) 
Why we print the closed tag of the li element, after the recursive call? (on
line 29)
echo "\n";


Thanks a lot in advance,
Márcio


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



Re: [PHP] Are there free prebuild websites?

2009-10-28 Thread Ashley Sheridan
On Wed, 2009-10-28 at 16:54 -0400, Haig Dedeyan wrote:

> Hi Peng,
> 
> here's a site that has free css templates for you to use:
> 
> http://www.templatemo.com/page/1
> 
> 
> Peng Yu wrote:
> > I want to build a website using PHP. But to make a website from
> > scratch will take a long time. I observed many websites look similar.
> > Therefore, I think that there are a lot of commonalities between them.
> >
> > I'm wondering if there are some depository of free prebuild websites
> > (based on PHP or some other language) so that I can download and
> > modify it for my needs.
> >
> >   
> 

That's as may be, but it's not really anything to do with the question.

I'd recommend using a pre-built CMS. Something like Joomla, Drupal,
PHPNuke, etc. Built in PHP and plenty of scope for adjustments.

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




[PHP] UrlRewrite htaccess confusion

2009-10-28 Thread Rob Gould
I feel like I'm really close to a solution for the clean-url method in  
htaccess.  I've successfully got it now so that:


http://benchwarmersports.com/packages/basketball/2010/nba-all-star-game

maps to:

http://benchwarmersports.com/packages.php?category=basketball&year=2010&title=nba-all-star-game

However, I'm finding that when I click on subsequent links from:

http://benchwarmersports.com/packages/basketball/2010/nba-all-star-game

that I land in a strange url-structure where it replicates the  
packages part of the url.


Can someone tell me what I might need to change about my rewrite logic  
to fix this issue?  I'm getting lost in the world of base urls and  
recursive rewrites...



Present htaccess code:

Options +FollowSymlinks
RewriteEngine On
RewriteOptions MaxRedirects=10
RewriteBase /

RewriteRule ^packages/([^/]+)/([^/]+)/([^/]+)$ /packages.php?category= 
$1&year=$2&title=$3 [NC]


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



Re: [PHP] Are there free prebuild websites?

2009-10-28 Thread Haig Dedeyan

Hi Peng,

here's a site that has free css templates for you to use:

http://www.templatemo.com/page/1


Peng Yu wrote:

I want to build a website using PHP. But to make a website from
scratch will take a long time. I observed many websites look similar.
Therefore, I think that there are a lot of commonalities between them.

I'm wondering if there are some depository of free prebuild websites
(based on PHP or some other language) so that I can download and
modify it for my needs.

  


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



[PHP] Are there free prebuild websites?

2009-10-28 Thread Peng Yu
I want to build a website using PHP. But to make a website from
scratch will take a long time. I observed many websites look similar.
Therefore, I think that there are a lot of commonalities between them.

I'm wondering if there are some depository of free prebuild websites
(based on PHP or some other language) so that I can download and
modify it for my needs.

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



Re: [PHP] Re: Create a screenshot of a website

2009-10-28 Thread Shawn McKenzie
Manuel Lemos wrote:
>>> http://www.phpclasses.org/gtkmozembed-shot
>> It hurts my eyes to go on the phpclasses website. It's like someone
>> vomited tabs and links :|
> 
> I have no clue why you felt the need to be so aggressive.
> 
> Anyway, if you are that sensitive to design issues, why don't you
> participate in the contest to propose a better design instead of just
> complaining against the work that others do to help the PHP community?
> 
> You can earn prizes and start helping instead of just putting down what
> others do.
> 
> http://www.phpclasses.org/blog/post/104-Submit-your-site-redesign-proposal-for-the-contest.html
> 

Yeah Rob, put up or shut up!  ;-)

-- 
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] Re: Create a screenshot of a website

2009-10-28 Thread Paul M Foster
On Wed, Oct 28, 2009 at 05:49:43PM -0200, Manuel Lemos wrote:

> Hello,
> 
> on 10/28/2009 05:24 PM Robert Cummings said the following:
> >>> I want to be able to get a screenshot of a given website on the fly.
> >>> Can you give me any suggestions.
> >>
> >> If you are still looking at solutions for this problem, here you can
> >> find a solution that works on Windows:
> >>
> >> http://www.phpclasses.org/win-screenshot
> >>
> >> Here is another that works on Linux and any platform that supports
> >> PHP-Gtk:
> >>
> >> http://www.phpclasses.org/gtkmozembed-shot
> >
> > It hurts my eyes to go on the phpclasses website. It's like someone
> > vomited tabs and links :|
> 
> I have no clue why you felt the need to be so aggressive.
> 
> Anyway, if you are that sensitive to design issues, why don't you
> participate in the contest to propose a better design instead of just
> complaining against the work that others do to help the PHP community?
> 
> You can earn prizes and start helping instead of just putting down what
> others do.
> 
> http://www.phpclasses.org/blog/post/104-Submit-your-site-redesign-proposal-for-the-contest.html

Here's a free suggestion. You don't even have to give me a prize. You
know those random words which are underlined on that page, and when you
mouse over them, you get the random advertisement on a completely
unrelated subject, which also emits a *sound* on my computer? Get rid of
them completely. They are beyond annoying. I get that you need to make
money with this site, but those obnoxious ads are the exact opposite
wrong way to do it.

Also, while I wouldn't have expressed it quite as crassly as Robert, I
have to agree on his evaluation of the site's look. I have a logon on
your site and have been to it many times. I just figured you liked it
like that. But in truth, it needs a serious and complete makeover. But
like Robert, I have no end of things to take care of, quite outside of
redisigning phpclasses.net. I'd suggest you scrap the contest and go
find a good free CSS template. But that's just me.

And just for the record, I'm really not ragging on you. PHPClasses.net
is the only site of its kind I know of. There is an endless variety of
code for almost anything you could want to do in PHP. That's why I
maintain a login there.

Paul

-- 
Paul M. Foster

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



Re: [PHP] A better php document?

2009-10-28 Thread Jan Marques
http://en.wikibooks.org/wiki/PHP_Programming might help you :)

On Wed, Oct 28, 2009 at 2:12 AM, Peng Yu  wrote:

> I am reading the following PHP document. But I feel very inconvenient
> as the materials are spread on many short webpages. I would prefer
> long webpages. I'm wondering if some body can point me some better PHP
> document?
>
> http://www.php.net/manual/en/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
met vriendelijke groet,
kind regards,
Jan Marques

---Disclaimer---

Deze e-mail, met eventuele bijlagen, is alleen bestemd voor de persoon of
organisatie aan wie hij gericht is en, in voorkomend geval, alleen voor het
daarin opgegeven doel of gebruik. Hij kan vertrouwelijke informatie
bevatten en/of persoonlijke standpunten die niet noodzakelijk met die van
Jan Marques stroken. Elk gebruik van deze informatie (zoals bewerken,
doorsturen, geheel of gedeeltelijk reproduceren of verspreiden in welke vorm
ook) door anderen dan de geadresseerde, is verboden. Hebt U deze e-mail per
vergissing ontvangen, meld dat dan a.u.b. aan Jan Marques en wis de e-mail.


[PHP] A better php document?

2009-10-28 Thread Peng Yu
I am reading the following PHP document. But I feel very inconvenient
as the materials are spread on many short webpages. I would prefer
long webpages. I'm wondering if some body can point me some better PHP
document?

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

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



Re: [PHP] Re: Create a screenshot of a website

2009-10-28 Thread Robert Cummings

Manuel Lemos wrote:

Hello,

on 10/28/2009 05:24 PM Robert Cummings said the following:

I want to be able to get a screenshot of a given website on the fly.
Can you give me any suggestions.

If you are still looking at solutions for this problem, here you can
find a solution that works on Windows:

http://www.phpclasses.org/win-screenshot

Here is another that works on Linux and any platform that supports
PHP-Gtk:

http://www.phpclasses.org/gtkmozembed-shot

It hurts my eyes to go on the phpclasses website. It's like someone
vomited tabs and links :|


I have no clue why you felt the need to be so aggressive.


If I had called you names or made threats you could call me aggressive. 
However, I merely stated my opinion.



Anyway, if you are that sensitive to design issues, why don't you
participate in the contest to propose a better design instead of just
complaining against the work that others do to help the PHP community?

You can earn prizes and start helping instead of just putting down what
others do.


As much as would like to do so... I'm currently up to my eyeballs 
steeped in work and 3 young children.



http://www.phpclasses.org/blog/post/104-Submit-your-site-redesign-proposal-for-the-contest.html


Well there we go... if I had known such a thing existed I would have 
kept mum on the issue... but here we are... and there you are... and... 
LOOK A SQUIRREL *points over there*... *runs the other way*.


Anyways, aggression not intended, personal opinion merely provided in a 
colourful manner.


Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

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



Re: [PHP] [php] INSERT and immediately UPDATE

2009-10-28 Thread Allen McCabe
You all are great! Thank you so much.



On Wed, Oct 28, 2009 at 12:27 PM, Martin Scotta wrote:

>
>
> On Wed, Oct 28, 2009 at 4:21 PM, Allen McCabe wrote:
>
>> Hey everyone, I have an issue.
>>
>> I need my (employee) users to be able to insert shows into the our MySQL
>> database and simultaneously upload an image file (and store the path in
>> the
>> table).
>>
>> I have accomplished this with a product-based system (adding products and
>> uploading images of the product), and accomplished what I needed because
>> the
>> product name was unique; I used the following statements:
>>
>> $prodName = $_POST['prodName'];
>> $prodDesc = $_POST['prodDesc'];
>> $prodPrice = $_POST['prodPrice'];
>>
>> $query2  = "INSERT INTO product (pID, pName) VALUES (NULL, '$prodName');";
>> $result2 = mysql_query($query2) or die(mysql_error());
>>
>> $query  = "SELECT pID FROM product WHERE pName = '$prodName';";
>> $result = mysql_query($query) or die(mysql_error());
>> $row = mysql_fetch_array($result) or die (mysql_error());
>>
>> $prodID = $row['pID'];
>>
>>
>> I had to select the new product to get the product id to use in the new
>> unique image name.
>>
>> The problem I am facing now, is that with the shows that my users add will
>> have multitple show times; this means non-unique titles. In fact, the only
>> unique identifier is the show id. How can I insert something (leaving the
>> show_id field NULL so that it is auto-assigned the next ID number), and
>> then
>> immediately select it?
>>
>> PHP doesn't seem to be able to immediately select something it has just
>> inserted, perhaps it needs time to process the database update.
>>
>> Here is the code I have now (which does not work):
>>
>> $query2  = "INSERT INTO afy_show (show_id, show_title, show_day_w,
>> show_month, show_day_m, show_year, show_time, show_price,
>> show_description,
>> show_comments_1, show_seats_reqd) VALUES (NULL, '{$show_title}',
>> '{$show_day_w}', '{$show_month}', '{$show_day_m}', '{$show_year}',
>> '{$show_time}', '{$show_price}', '{$show_description}',
>> '{$show_comments_1}', '{$show_seats_reqd}');";
>>  $result2 = mysql_query($query2) or die(mysql_error());
>>
>>  $query3 = "SELECT * FROM afy_show WHERE *show_id = '$id'*;";
>>  $result3 = mysql_query($query3) or die('Record cannot be located!' .
>> mysql_error());
>>  $row3 = mysql_fetch_array($result3);
>>  $show_id = $row3['show_id'];
>>
>> How do I select the item I just inserted to obtain the ID number??
>>
>
> mysql_insert_id 
> mysqli->insert_id 
>
>
> --
> Martin Scotta
>


Re: [PHP] Re: Create a screenshot of a website

2009-10-28 Thread Manuel Lemos
Hello,

on 10/28/2009 05:24 PM Robert Cummings said the following:
>>> I want to be able to get a screenshot of a given website on the fly.
>>> Can you give me any suggestions.
>>
>> If you are still looking at solutions for this problem, here you can
>> find a solution that works on Windows:
>>
>> http://www.phpclasses.org/win-screenshot
>>
>> Here is another that works on Linux and any platform that supports
>> PHP-Gtk:
>>
>> http://www.phpclasses.org/gtkmozembed-shot
> 
> It hurts my eyes to go on the phpclasses website. It's like someone
> vomited tabs and links :|

I have no clue why you felt the need to be so aggressive.

Anyway, if you are that sensitive to design issues, why don't you
participate in the contest to propose a better design instead of just
complaining against the work that others do to help the PHP community?

You can earn prizes and start helping instead of just putting down what
others do.

http://www.phpclasses.org/blog/post/104-Submit-your-site-redesign-proposal-for-the-contest.html

-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



Re: [PHP] Re: Create a screenshot of a website

2009-10-28 Thread Ashley Sheridan
On Wed, 2009-10-28 at 15:24 -0400, Robert Cummings wrote:

> Manuel Lemos wrote:
> > Hello,
> > 
> > on 10/22/2009 11:28 AM resea soul said the following:
> >> Hi,
> >>
> >> I want to be able to get a screenshot of a given website on the fly.
> >> Can you give me any suggestions.
> > 
> > If you are still looking at solutions for this problem, here you can
> > find a solution that works on Windows:
> > 
> > http://www.phpclasses.org/win-screenshot
> > 
> > Here is another that works on Linux and any platform that supports PHP-Gtk:
> > 
> > http://www.phpclasses.org/gtkmozembed-shot
> 
> It hurts my eyes to go on the phpclasses website. It's like someone 
> vomited tabs and links :|
> 
> Cheers,
> Rob.
> -- 
> http://www.interjinn.com
> Application and Templating Framework for PHP
> 


Oh dear, it does look like that doesn't it!

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




Re: [PHP] [php] INSERT and immediately UPDATE

2009-10-28 Thread Martin Scotta
On Wed, Oct 28, 2009 at 4:21 PM, Allen McCabe  wrote:

> Hey everyone, I have an issue.
>
> I need my (employee) users to be able to insert shows into the our MySQL
> database and simultaneously upload an image file (and store the path in the
> table).
>
> I have accomplished this with a product-based system (adding products and
> uploading images of the product), and accomplished what I needed because
> the
> product name was unique; I used the following statements:
>
> $prodName = $_POST['prodName'];
> $prodDesc = $_POST['prodDesc'];
> $prodPrice = $_POST['prodPrice'];
>
> $query2  = "INSERT INTO product (pID, pName) VALUES (NULL, '$prodName');";
> $result2 = mysql_query($query2) or die(mysql_error());
>
> $query  = "SELECT pID FROM product WHERE pName = '$prodName';";
> $result = mysql_query($query) or die(mysql_error());
> $row = mysql_fetch_array($result) or die (mysql_error());
>
> $prodID = $row['pID'];
>
>
> I had to select the new product to get the product id to use in the new
> unique image name.
>
> The problem I am facing now, is that with the shows that my users add will
> have multitple show times; this means non-unique titles. In fact, the only
> unique identifier is the show id. How can I insert something (leaving the
> show_id field NULL so that it is auto-assigned the next ID number), and
> then
> immediately select it?
>
> PHP doesn't seem to be able to immediately select something it has just
> inserted, perhaps it needs time to process the database update.
>
> Here is the code I have now (which does not work):
>
> $query2  = "INSERT INTO afy_show (show_id, show_title, show_day_w,
> show_month, show_day_m, show_year, show_time, show_price, show_description,
> show_comments_1, show_seats_reqd) VALUES (NULL, '{$show_title}',
> '{$show_day_w}', '{$show_month}', '{$show_day_m}', '{$show_year}',
> '{$show_time}', '{$show_price}', '{$show_description}',
> '{$show_comments_1}', '{$show_seats_reqd}');";
>  $result2 = mysql_query($query2) or die(mysql_error());
>
>  $query3 = "SELECT * FROM afy_show WHERE *show_id = '$id'*;";
>  $result3 = mysql_query($query3) or die('Record cannot be located!' .
> mysql_error());
>  $row3 = mysql_fetch_array($result3);
>  $show_id = $row3['show_id'];
>
> How do I select the item I just inserted to obtain the ID number??
>

mysql_insert_id 
mysqli->insert_id 


-- 
Martin Scotta


Re: [PHP] [php] INSERT and immediately UPDATE

2009-10-28 Thread Floyd Resler

Allen,
	Use mysql_insert_id().  This will return the id of the last record  
inserted.


Take care,
Floyd

On Oct 28, 2009, at 3:21 PM, Allen McCabe wrote:


Hey everyone, I have an issue.

I need my (employee) users to be able to insert shows into the our  
MySQL
database and simultaneously upload an image file (and store the path  
in the

table).

I have accomplished this with a product-based system (adding  
products and
uploading images of the product), and accomplished what I needed  
because the

product name was unique; I used the following statements:

$prodName = $_POST['prodName'];
$prodDesc = $_POST['prodDesc'];
$prodPrice = $_POST['prodPrice'];

$query2  = "INSERT INTO product (pID, pName) VALUES (NULL,  
'$prodName');";

$result2 = mysql_query($query2) or die(mysql_error());

$query  = "SELECT pID FROM product WHERE pName = '$prodName';";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result) or die (mysql_error());

$prodID = $row['pID'];


I had to select the new product to get the product id to use in the  
new

unique image name.

The problem I am facing now, is that with the shows that my users  
add will
have multitple show times; this means non-unique titles. In fact,  
the only
unique identifier is the show id. How can I insert something  
(leaving the
show_id field NULL so that it is auto-assigned the next ID number),  
and then

immediately select it?

PHP doesn't seem to be able to immediately select something it has  
just

inserted, perhaps it needs time to process the database update.

Here is the code I have now (which does not work):

$query2  = "INSERT INTO afy_show (show_id, show_title, show_day_w,
show_month, show_day_m, show_year, show_time, show_price,  
show_description,

show_comments_1, show_seats_reqd) VALUES (NULL, '{$show_title}',
'{$show_day_w}', '{$show_month}', '{$show_day_m}', '{$show_year}',
'{$show_time}', '{$show_price}', '{$show_description}',
'{$show_comments_1}', '{$show_seats_reqd}');";
$result2 = mysql_query($query2) or die(mysql_error());

$query3 = "SELECT * FROM afy_show WHERE *show_id = '$id'*;";
$result3 = mysql_query($query3) or die('Record cannot be located!' .
mysql_error());
$row3 = mysql_fetch_array($result3);
$show_id = $row3['show_id'];

How do I select the item I just inserted to obtain the ID number??



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



Re: [PHP] [php] INSERT and immediately UPDATE

2009-10-28 Thread Ashley Sheridan
On Wed, 2009-10-28 at 12:21 -0700, Allen McCabe wrote:

> Hey everyone, I have an issue.
> 
> I need my (employee) users to be able to insert shows into the our MySQL
> database and simultaneously upload an image file (and store the path in the
> table).
> 
> I have accomplished this with a product-based system (adding products and
> uploading images of the product), and accomplished what I needed because the
> product name was unique; I used the following statements:
> 
> $prodName = $_POST['prodName'];
> $prodDesc = $_POST['prodDesc'];
> $prodPrice = $_POST['prodPrice'];
> 
> $query2  = "INSERT INTO product (pID, pName) VALUES (NULL, '$prodName');";
> $result2 = mysql_query($query2) or die(mysql_error());
> 
> $query  = "SELECT pID FROM product WHERE pName = '$prodName';";
> $result = mysql_query($query) or die(mysql_error());
> $row = mysql_fetch_array($result) or die (mysql_error());
> 
> $prodID = $row['pID'];
> 
> 
> I had to select the new product to get the product id to use in the new
> unique image name.
> 
> The problem I am facing now, is that with the shows that my users add will
> have multitple show times; this means non-unique titles. In fact, the only
> unique identifier is the show id. How can I insert something (leaving the
> show_id field NULL so that it is auto-assigned the next ID number), and then
> immediately select it?
> 
> PHP doesn't seem to be able to immediately select something it has just
> inserted, perhaps it needs time to process the database update.
> 
> Here is the code I have now (which does not work):
> 
> $query2  = "INSERT INTO afy_show (show_id, show_title, show_day_w,
> show_month, show_day_m, show_year, show_time, show_price, show_description,
> show_comments_1, show_seats_reqd) VALUES (NULL, '{$show_title}',
> '{$show_day_w}', '{$show_month}', '{$show_day_m}', '{$show_year}',
> '{$show_time}', '{$show_price}', '{$show_description}',
> '{$show_comments_1}', '{$show_seats_reqd}');";
>  $result2 = mysql_query($query2) or die(mysql_error());
> 
>  $query3 = "SELECT * FROM afy_show WHERE *show_id = '$id'*;";
>  $result3 = mysql_query($query3) or die('Record cannot be located!' .
> mysql_error());
>  $row3 = mysql_fetch_array($result3);
>  $show_id = $row3['show_id'];
> 
> How do I select the item I just inserted to obtain the ID number??


Have a look at mysql_insert_id() which returns the auto insert id value
of the last row to be inserted by the current script. If you use if
right after the insert query (without any other queries in between) then
you have the id for that row. Whatever you do, don't look for the
MAX(id) value! I've seen people do this before, and then wonder why the
database gets all corrupted when more than one person uses the system at
the same time!

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




Re: [PHP] [php] INSERT and immediately UPDATE

2009-10-28 Thread Mari Masuda
Maybe you could use http://us.php.net/manual/en/function.mysql-insert-id.php 
 to get the inserted id.


On Oct 28, 2009, at 12:21 PM, Allen McCabe wrote:


Hey everyone, I have an issue.

I need my (employee) users to be able to insert shows into the our  
MySQL
database and simultaneously upload an image file (and store the path  
in the

table).

I have accomplished this with a product-based system (adding  
products and
uploading images of the product), and accomplished what I needed  
because the

product name was unique; I used the following statements:

$prodName = $_POST['prodName'];
$prodDesc = $_POST['prodDesc'];
$prodPrice = $_POST['prodPrice'];

$query2  = "INSERT INTO product (pID, pName) VALUES (NULL,  
'$prodName');";

$result2 = mysql_query($query2) or die(mysql_error());

$query  = "SELECT pID FROM product WHERE pName = '$prodName';";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result) or die (mysql_error());

$prodID = $row['pID'];


I had to select the new product to get the product id to use in the  
new

unique image name.

The problem I am facing now, is that with the shows that my users  
add will
have multitple show times; this means non-unique titles. In fact,  
the only
unique identifier is the show id. How can I insert something  
(leaving the
show_id field NULL so that it is auto-assigned the next ID number),  
and then

immediately select it?

PHP doesn't seem to be able to immediately select something it has  
just

inserted, perhaps it needs time to process the database update.

Here is the code I have now (which does not work):

$query2  = "INSERT INTO afy_show (show_id, show_title, show_day_w,
show_month, show_day_m, show_year, show_time, show_price,  
show_description,

show_comments_1, show_seats_reqd) VALUES (NULL, '{$show_title}',
'{$show_day_w}', '{$show_month}', '{$show_day_m}', '{$show_year}',
'{$show_time}', '{$show_price}', '{$show_description}',
'{$show_comments_1}', '{$show_seats_reqd}');";
$result2 = mysql_query($query2) or die(mysql_error());

$query3 = "SELECT * FROM afy_show WHERE *show_id = '$id'*;";
$result3 = mysql_query($query3) or die('Record cannot be located!' .
mysql_error());
$row3 = mysql_fetch_array($result3);
$show_id = $row3['show_id'];

How do I select the item I just inserted to obtain the ID number??



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



[PHP] Re: [php] INSERT and immediately UPDATE

2009-10-28 Thread Jo�o C�ndido de Souza Neto
Use mysql_insert_id() instead of the select you´re using now.

"Allen McCabe"  escreveu na mensagem 
news:657acef20910281221y5ab6ab7t4882f4f00da2c...@mail.gmail.com...
> Hey everyone, I have an issue.
>
> I need my (employee) users to be able to insert shows into the our MySQL
> database and simultaneously upload an image file (and store the path in 
> the
> table).
>
> I have accomplished this with a product-based system (adding products and
> uploading images of the product), and accomplished what I needed because 
> the
> product name was unique; I used the following statements:
>
> $prodName = $_POST['prodName'];
> $prodDesc = $_POST['prodDesc'];
> $prodPrice = $_POST['prodPrice'];
>
> $query2  = "INSERT INTO product (pID, pName) VALUES (NULL, '$prodName');";
> $result2 = mysql_query($query2) or die(mysql_error());
>
> $query  = "SELECT pID FROM product WHERE pName = '$prodName';";
> $result = mysql_query($query) or die(mysql_error());
> $row = mysql_fetch_array($result) or die (mysql_error());
>
> $prodID = $row['pID'];
>
>
> I had to select the new product to get the product id to use in the new
> unique image name.
>
> The problem I am facing now, is that with the shows that my users add will
> have multitple show times; this means non-unique titles. In fact, the only
> unique identifier is the show id. How can I insert something (leaving the
> show_id field NULL so that it is auto-assigned the next ID number), and 
> then
> immediately select it?
>
> PHP doesn't seem to be able to immediately select something it has just
> inserted, perhaps it needs time to process the database update.
>
> Here is the code I have now (which does not work):
>
> $query2  = "INSERT INTO afy_show (show_id, show_title, show_day_w,
> show_month, show_day_m, show_year, show_time, show_price, 
> show_description,
> show_comments_1, show_seats_reqd) VALUES (NULL, '{$show_title}',
> '{$show_day_w}', '{$show_month}', '{$show_day_m}', '{$show_year}',
> '{$show_time}', '{$show_price}', '{$show_description}',
> '{$show_comments_1}', '{$show_seats_reqd}');";
> $result2 = mysql_query($query2) or die(mysql_error());
>
> $query3 = "SELECT * FROM afy_show WHERE *show_id = '$id'*;";
> $result3 = mysql_query($query3) or die('Record cannot be located!' .
> mysql_error());
> $row3 = mysql_fetch_array($result3);
> $show_id = $row3['show_id'];
>
> How do I select the item I just inserted to obtain the ID number??
> 



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



Re: [PHP] Re: Create a screenshot of a website

2009-10-28 Thread Robert Cummings

Manuel Lemos wrote:

Hello,

on 10/22/2009 11:28 AM resea soul said the following:

Hi,

I want to be able to get a screenshot of a given website on the fly.
Can you give me any suggestions.


If you are still looking at solutions for this problem, here you can
find a solution that works on Windows:

http://www.phpclasses.org/win-screenshot

Here is another that works on Linux and any platform that supports PHP-Gtk:

http://www.phpclasses.org/gtkmozembed-shot


It hurts my eyes to go on the phpclasses website. It's like someone 
vomited tabs and links :|


Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

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



[PHP] [php] INSERT and immediately UPDATE

2009-10-28 Thread Allen McCabe
Hey everyone, I have an issue.

I need my (employee) users to be able to insert shows into the our MySQL
database and simultaneously upload an image file (and store the path in the
table).

I have accomplished this with a product-based system (adding products and
uploading images of the product), and accomplished what I needed because the
product name was unique; I used the following statements:

$prodName = $_POST['prodName'];
$prodDesc = $_POST['prodDesc'];
$prodPrice = $_POST['prodPrice'];

$query2  = "INSERT INTO product (pID, pName) VALUES (NULL, '$prodName');";
$result2 = mysql_query($query2) or die(mysql_error());

$query  = "SELECT pID FROM product WHERE pName = '$prodName';";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result) or die (mysql_error());

$prodID = $row['pID'];


I had to select the new product to get the product id to use in the new
unique image name.

The problem I am facing now, is that with the shows that my users add will
have multitple show times; this means non-unique titles. In fact, the only
unique identifier is the show id. How can I insert something (leaving the
show_id field NULL so that it is auto-assigned the next ID number), and then
immediately select it?

PHP doesn't seem to be able to immediately select something it has just
inserted, perhaps it needs time to process the database update.

Here is the code I have now (which does not work):

$query2  = "INSERT INTO afy_show (show_id, show_title, show_day_w,
show_month, show_day_m, show_year, show_time, show_price, show_description,
show_comments_1, show_seats_reqd) VALUES (NULL, '{$show_title}',
'{$show_day_w}', '{$show_month}', '{$show_day_m}', '{$show_year}',
'{$show_time}', '{$show_price}', '{$show_description}',
'{$show_comments_1}', '{$show_seats_reqd}');";
 $result2 = mysql_query($query2) or die(mysql_error());

 $query3 = "SELECT * FROM afy_show WHERE *show_id = '$id'*;";
 $result3 = mysql_query($query3) or die('Record cannot be located!' .
mysql_error());
 $row3 = mysql_fetch_array($result3);
 $show_id = $row3['show_id'];

How do I select the item I just inserted to obtain the ID number??


[PHP] Re: Create a screenshot of a website

2009-10-28 Thread Manuel Lemos
Hello,

on 10/22/2009 11:28 AM resea soul said the following:
> Hi,
> 
> I want to be able to get a screenshot of a given website on the fly.
> Can you give me any suggestions.

If you are still looking at solutions for this problem, here you can
find a solution that works on Windows:

http://www.phpclasses.org/win-screenshot

Here is another that works on Linux and any platform that supports PHP-Gtk:

http://www.phpclasses.org/gtkmozembed-shot

-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



Re: [PHP] How is this possible? [Solved]

2009-10-28 Thread tedd

At 2:48 PM -0400 10/28/09, Robert Cummings wrote:

Bob McConnell wrote:

From: tedd

I found the problem, which basically was that I had declared a 
variable in a preceding script with the same name, namely $user_id.


When I changed my script to $u_id, everything worked as before. 
Clearly, Globals are evil.


It's a bitch to have to work with code you can't change unless you 
are willing to edit over 1500 files.


Just keep in mind that register_globals is deprecated and will be going
away in a future release of PHP. You might want to start thinking about
a strategy to update those files before that happens.

Bob McConnell


I don't think his problem was register_globals, I think it was the 
other problem of globals... namely variable naming collision causing 
value clobber.


Cheers,
Rob.



Rob:

You were exactly right -- it was a collision.

Now, if I can only find out why header("location:.."); stopped working.

Sometimes old code presents a lot of problems to solve.

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



Re: [PHP] Textarea to road a text file

2009-10-28 Thread Andrew Ballard
On Wed, Oct 28, 2009 at 10:39 AM, Jean Lee  wrote:
> I want to use Textarea as the text-file viewer and editor of my homepage.
> But Textarea doesn't work exactly as i intended.
> In sometimes, TextArea doesn't show up
> and moreover the some parts of the file are displayed(rendered) in browser
> without TextArea!
>
>
>
>

It sounds like you are not escaping the value that appears inside the
textarea tags.



Andrew

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



RE: [PHP] Textarea to road a text file

2009-10-28 Thread Jay Blanchard
[snip]I want to use Textarea as the text-file viewer and editor of my
homepage. But Textarea doesn't work exactly as i intended.
In sometimes, TextArea doesn't show up and moreover the some parts of
the file are displayed(rendered) in browser without TextArea![/snip]

Not enough information to complete yourrequest? 

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



Re: [PHP] How is this possible? [Solved]

2009-10-28 Thread Robert Cummings

Bob McConnell wrote:

From: tedd

I found the problem, which basically was that I had declared a 
variable in a preceding script with the same name, namely $user_id.


When I changed my script to $u_id, everything worked as before. 
Clearly, Globals are evil.


It's a bitch to have to work with code you can't change unless you 
are willing to edit over 1500 files.


Just keep in mind that register_globals is deprecated and will be going
away in a future release of PHP. You might want to start thinking about
a strategy to update those files before that happens.

Bob McConnell


I don't think his problem was register_globals, I think it was the other 
problem of globals... namely variable naming collision causing value 
clobber.


Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

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



[PHP] Textarea to road a text file

2009-10-28 Thread Jean Lee
I want to use Textarea as the text-file viewer and editor of my homepage.
But Textarea doesn't work exactly as i intended.
In sometimes, TextArea doesn't show up
and moreover the some parts of the file are displayed(rendered) in browser
without TextArea!




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



RE: [PHP] How is this possible? [Solved]

2009-10-28 Thread Bob McConnell
From: tedd

> I found the problem, which basically was that I had declared a 
> variable in a preceding script with the same name, namely $user_id.
> 
> When I changed my script to $u_id, everything worked as before. 
> Clearly, Globals are evil.
> 
> It's a bitch to have to work with code you can't change unless you 
> are willing to edit over 1500 files.

Just keep in mind that register_globals is deprecated and will be going
away in a future release of PHP. You might want to start thinking about
a strategy to update those files before that happens.

Bob McConnell

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



Re: [PHP] How is this possible? [Solved]

2009-10-28 Thread tedd

To all:


I found the problem, which basically was that I had declared a 
variable in a preceding script with the same name, namely $user_id.


When I changed my script to $u_id, everything worked as before. 
Clearly, Globals are evil.


It's a bitch to have to work with code you can't change unless you 
are willing to edit over 1500 files.


Many thanks for all input and suggestions.

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] PHP String convention

2009-10-28 Thread Robert Cummings

Kim Madsen wrote:

Hi Nick

Nick Cooper wrote on 2009-10-28 17:29:


Thank you for the quick replies. I thought method 2 must be faster
because it doesn't have to search for variables in the string.

So what is the advantages then of method 1 over 3, do the curly braces
mean anything?

1) $string = "foo{$bar}";

2) $string = 'foo'.$bar;

3) $string = "foo$bar";

I must admit reading method 1 is easier, but writing method 2 is
quicker, is that the only purpose the curly braces serve?


Yes, you're right about that. 10 years ago I went to a seminar were 
Rasmus Lerforf was speaking and asked him exactly that question. The 
single qoutes are preferred and are way faster because it doesn´t have 
to parse the string, only the glued variables.


Also we discussed that if you´re doing a bunch of HTML code it's 
considerably faster to do:



   


Than
print "
\n\t
   \n\t\t$data
\n\t";

or
print '

   '.$data.'
';

I remember benchmark testing it afterwards back then and there was 
clearly a difference.


10 years is a long time... there have been benchmarks posted to this 
list in the past year or so indicating that in the PHP5 release there is 
no real difference in speed between the use of single or double quotes. 
If I recall correctly double quotes may even be eking out a small 
advantage over single quotes nowadays.


Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

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



Re: [PHP] How is this possible?

2009-10-28 Thread Ashley Sheridan
On Wed, 2009-10-28 at 13:47 -0400, Andrew Ballard wrote:

> On Wed, Oct 28, 2009 at 1:27 PM, tedd  wrote:
> > Hi gang:
> >
> > I am reviewing some old code (circa 2003) where the programmer had one
> > script call another and placed variable values in the URL, like so:
> >
> >
> >
> > That seems innocent enough. However, in the called script (i.e.,
> > "user_edit.php") there are no:
> >
> >$user_id = $_GET['user_id'];
> >$action = $_GET['action'];
> >
> > statements to populate the variables, yet the variables get populated with
> > the values sent!?!
> >
> > How did he do that?
> >
> > Incidentally, he did have in the .htaccess file the statement:
> >
> >   php_flag register_globals 1
> >
> > So I figure that Globals have something to do with it, but I never use
> > Globals. And if I print_r $GLOBALS, I find that user_id and action are
> > listed (many times), but I don't see how that works.
> >
> > Furthermore, something got changed and the entire script no longer works. So
> > I'm in a quandary to figure this out -- any ideas, suggestions, references?
> >
> > Thanks,
> >
> > tedd
> >
> 
> That's exactly what register_globals does. It's analogous to
> prepending your scripts with this:
> 
>  
> extract($_GET);
> extract($_POST);
> extract($_COOKIE);
> extract($_SESSION);
> 
> ?>
> 
> (The order would be determined by the ini directive variables_order)
> 
> Andrew
> 


Register globals is evil; somewhere between M$ and the chocolate that
are always left over in the Xmas tin that nobody likes. Best bet is to
try and steer the system away from it's dependency on this old
directive.

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




Re: [PHP] How is this possible?

2009-10-28 Thread Andrew Ballard
On Wed, Oct 28, 2009 at 1:27 PM, tedd  wrote:
> Hi gang:
>
> I am reviewing some old code (circa 2003) where the programmer had one
> script call another and placed variable values in the URL, like so:
>
>    
>
> That seems innocent enough. However, in the called script (i.e.,
> "user_edit.php") there are no:
>
>    $user_id = $_GET['user_id'];
>    $action = $_GET['action'];
>
> statements to populate the variables, yet the variables get populated with
> the values sent!?!
>
> How did he do that?
>
> Incidentally, he did have in the .htaccess file the statement:
>
>   php_flag register_globals 1
>
> So I figure that Globals have something to do with it, but I never use
> Globals. And if I print_r $GLOBALS, I find that user_id and action are
> listed (many times), but I don't see how that works.
>
> Furthermore, something got changed and the entire script no longer works. So
> I'm in a quandary to figure this out -- any ideas, suggestions, references?
>
> Thanks,
>
> tedd
>

That's exactly what register_globals does. It's analogous to
prepending your scripts with this:



(The order would be determined by the ini directive variables_order)

Andrew

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



Re: [PHP] How is this possible?

2009-10-28 Thread Adam Randall
I don't do this personally, but you can probably get your script
working by doing something like this:

foreach( $_GET as $k => $v ) $$k = $v;

You would put that at the top of your page, but be aware that it
allows other people to set variables on your page (just like register
globals does).

If you want to do basic sanitization to your incoming values, such as
trimming them, you can do something like this too:

foreach( $_GET as $k => $v ) $$k = trim( $v );

None of this is best practices, FYI.

Adam.

On Wed, Oct 28, 2009 at 10:29 AM, David Otton
 wrote:
> 2009/10/28 tedd :
>>
>> Hi gang:
>>
>
> http://php.net/manual/en/security.globals.php
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
Adam Randall
http://www.xaren.net
AIM: blitz574

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



Re: [PHP] PHP String convention

2009-10-28 Thread Ashley Sheridan
On Wed, 2009-10-28 at 18:18 +0100, Kim Madsen wrote:
> Hi Nick
> 
> Nick Cooper wrote on 2009-10-28 17:29:
> 
> > Thank you for the quick replies. I thought method 2 must be faster
> > because it doesn't have to search for variables in the string.
> > 
> > So what is the advantages then of method 1 over 3, do the curly braces
> > mean anything?
> > 
> > 1) $string = "foo{$bar}";
> > 
> > 2) $string = 'foo'.$bar;
> > 
> > 3) $string = "foo$bar";
> > 
> > I must admit reading method 1 is easier, but writing method 2 is
> > quicker, is that the only purpose the curly braces serve?
> 
> Yes, you're right about that. 10 years ago I went to a seminar were 
> Rasmus Lerforf was speaking and asked him exactly that question. The 
> single qoutes are preferred and are way faster because it doesn´t have 
> to parse the string, only the glued variables.
> 
> Also we discussed that if you´re doing a bunch of HTML code it's 
> considerably faster to do:
> 
> 
>
> 
> 
> Than
> print "
> \n\t
>\n\t\t$data
> \n\t";
> 
> or
> print '
> 
>'.$data.'
> ';
> 
> I remember benchmark testing it afterwards back then and there was 
> clearly a difference.
> 
> -- 
> Kind regards
> Kim Emax - masterminds.dk
> 

Or, far easier still to do:

print << 
$data

 
$data

EOC;

than:

 


 



Also, the use of short tags in the second example will almost certainly cause 
problems later on if you want to do anything with XML output from PHP.

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] Re: Converting tables into forms

2009-10-28 Thread ben...@gmail.com
Jay,

What function do you have?  Thanks to everyone for their feedback.

Best,

Ben

On Wed, Oct 28, 2009 at 9:17 AM, Jay Blanchard wrote:

> [snip]If your solution requires you to create hundreds of forms, which
> could
> take months to code, you need to take another look at the problem. I
> don't believe you have thought it through very well.[/snip]
>
> Actually you could use the function I provided to do this on the fly or
> have the function write out a file for each table involved.
>


RE: [PHP] PHP String convention

2009-10-28 Thread Warren Vail
The curly braces look like something from the smarty template engine.

Warren Vail
-Original Message-
From: Kim Madsen [mailto:php@emax.dk] 
Sent: Wednesday, October 28, 2009 10:18 AM
To: Nick Cooper
Cc: Jim Lucas; php-general@lists.php.net
Subject: Re: [PHP] PHP String convention

Hi Nick

Nick Cooper wrote on 2009-10-28 17:29:

> Thank you for the quick replies. I thought method 2 must be faster
> because it doesn't have to search for variables in the string.
> 
> So what is the advantages then of method 1 over 3, do the curly braces
> mean anything?
> 
> 1) $string = "foo{$bar}";
> 
> 2) $string = 'foo'.$bar;
> 
> 3) $string = "foo$bar";
> 
> I must admit reading method 1 is easier, but writing method 2 is
> quicker, is that the only purpose the curly braces serve?

Yes, you're right about that. 10 years ago I went to a seminar were 
Rasmus Lerforf was speaking and asked him exactly that question. The 
single qoutes are preferred and are way faster because it doesn´t have 
to parse the string, only the glued variables.

Also we discussed that if you´re doing a bunch of HTML code it's 
considerably faster to do:


   


Than
print "
\n\t
   \n\t\t$data
\n\t";

or
print '

   '.$data.'
';

I remember benchmark testing it afterwards back then and there was 
clearly a difference.

-- 
Kind regards
Kim Emax - masterminds.dk

-- 
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] Netbeans IDE 6.5

2009-10-28 Thread Skip Evans

Greg Maruszeczka wrote:

Download NB 6.7.1 (or even better, 6.8 Beta which looks pretty good to
me), run the install script and you're done. It's built-in updater will
handle the rest. Then if you're still feeling antsy about the choice of
syntax colors you can choose any of five different theme profiles under
Tools->Options->Fonts&Colors or customize any one of them to your
heart's content.



I took Greg's advice and downloaded 6.7.1, installed no 
problem, and now there is an import button, but when I try to 
import the new style from the NetBeans Forum it doesn't have 
any affect.


So, taking Greg's advice again I'll restyle it myself.

Now, if I can just get rid of that red line at the 80 column 
mark. I haven't bothered with 80 columns since I wrote 
assembly on a terminal connected to a PDP-11 in college.


Skip

Thanks,
Skip
--

Skip Evans
PenguinSites.com, LLC
503 S Baldwin St, #1
Madison WI 53703
608.250.2720
http://penguinsites.com

Those of you who believe in
telekinesis, raise my hand.
 -- Kurt Vonnegut

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



Re: [PHP] How is this possible?

2009-10-28 Thread David Otton
2009/10/28 tedd :
>
> Hi gang:
>

http://php.net/manual/en/security.globals.php

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



[PHP] How is this possible?

2009-10-28 Thread tedd

Hi gang:

I am reviewing some old code (circa 2003) where the programmer had 
one script call another and placed variable values in the URL, like 
so:




That seems innocent enough. However, in the called script (i.e., 
"user_edit.php") there are no:


$user_id = $_GET['user_id'];
$action = $_GET['action'];

statements to populate the variables, yet the variables get populated 
with the values sent!?!


How did he do that?

Incidentally, he did have in the .htaccess file the statement:

   php_flag register_globals 1

So I figure that Globals have something to do with it, but I never 
use Globals. And if I print_r $GLOBALS, I find that user_id and 
action are listed (many times), but I don't see how that works.


Furthermore, something got changed and the entire script no longer 
works. So I'm in a quandary to figure this out -- any ideas, 
suggestions, references?


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



Re: [PHP] PHP String convention

2009-10-28 Thread Kim Madsen

Hi Nick

Nick Cooper wrote on 2009-10-28 17:29:


Thank you for the quick replies. I thought method 2 must be faster
because it doesn't have to search for variables in the string.

So what is the advantages then of method 1 over 3, do the curly braces
mean anything?

1) $string = "foo{$bar}";

2) $string = 'foo'.$bar;

3) $string = "foo$bar";

I must admit reading method 1 is easier, but writing method 2 is
quicker, is that the only purpose the curly braces serve?


Yes, you're right about that. 10 years ago I went to a seminar were 
Rasmus Lerforf was speaking and asked him exactly that question. The 
single qoutes are preferred and are way faster because it doesn´t have 
to parse the string, only the glued variables.


Also we discussed that if you´re doing a bunch of HTML code it's 
considerably faster to do:



  


Than
print "
\n\t
  \n\t\t$data
\n\t";

or
print '

  '.$data.'
';

I remember benchmark testing it afterwards back then and there was 
clearly a difference.


--
Kind regards
Kim Emax - masterminds.dk

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



Re: [PHP] Netbeans IDE 6.5

2009-10-28 Thread Greg Maruszeczka
On Wed, 28 Oct 2009 11:29:49 -0500
Skip Evans  wrote:

> Bob McConnell wrote:
> > 
> > Three questions.
> > 
> > 1. Why did you install an obsolete version? 6.7.1 is current and
> > 6.8 is now in beta.
> 
> Because that what Ubuntu installs with apt-get install 
> netbeans and I like to stick with Ubuntu tested stuff.
> 

After being down this road with java apps like NB, Eclipse and
Tomcat IMHO you get very little benefit from installing the distro's
version, which always seem to be just far enough behind the latest to be
an annoyance for development purposes.

Download NB 6.7.1 (or even better, 6.8 Beta which looks pretty good to
me), run the install script and you're done. It's built-in updater will
handle the rest. Then if you're still feeling antsy about the choice of
syntax colors you can choose any of five different theme profiles under
Tools->Options->Fonts&Colors or customize any one of them to your
heart's content.

HTH,

GM


-- 
   
Greg Maruszeczka

GnuPG-ID: 0x4309323E, http://pgp.mit.edu


signature.asc
Description: PGP signature


Re: [PHP] Netbeans IDE 6.5

2009-10-28 Thread Brady Mitchell
On Tue, Oct 27, 2009 at 5:50 PM, Skip Evans  wrote:
> Any Netbeaners out there know how to install syntax highlighting stuff?

1 - Exit NetBeans
2 - Unzip the file in your ~/.netbeans/ folder.
3 - Start NetBeans
4 - Select the new color profile from Tools -> Options -> Fonts and
Colors -> Profile dropdown

I would suggest upgrading to the latest NetBeans as well, it's worth it.

Brady

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



Re: [PHP] PHP String convention

2009-10-28 Thread Jim Lucas
Nick Cooper wrote:
> 2009/10/28 Jim Lucas:
>> Nick Cooper wrote:
>>> Hi,
>>>
>>> I was just wondering what the difference/advantage of these two
>>> methods of writing a string are:
>>>
>>> 1) $string = "foo{$bar}";
>>>
>>> 2) $string = 'foo'.$bar;
>>>
>>> I always use method 2 but have been noticing method 1 more and more in
>>> source code. Is this just user preference?
>>>
>>> I would use a generic search engine but not sure what the first method
>>> is called so don't know where to begin my search.
>>>
>>> Thanks for any help.
>>>
>>> Nick
>>>
>> I think it is a matter of personal preference.  I prefer method 1 myself.
>>
>>
>>
> 
> Thank you for the quick replies. I thought method 2 must be faster
> because it doesn't have to search for variables in the string.
> 
> So what is the advantages then of method 1 over 3, do the curly braces
> mean anything?
> 
> 1) $string = "foo{$bar}";
> 
> 2) $string = 'foo'.$bar;
> 
> 3) $string = "foo$bar";
> 
> I must admit reading method 1 is easier, but writing method 2 is
> quicker, is that the only purpose the curly braces serve?
> 

They tell PHP to view the text between the curly braces as a variable that needs
interpreting.

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



Re: [PHP] PHP String convention

2009-10-28 Thread Ashley Sheridan
On Wed, 2009-10-28 at 16:29 +, Nick Cooper wrote:

> 2009/10/28 Jim Lucas:
> > Nick Cooper wrote:
> >> Hi,
> >>
> >> I was just wondering what the difference/advantage of these two
> >> methods of writing a string are:
> >>
> >> 1) $string = "foo{$bar}";
> >>
> >> 2) $string = 'foo'.$bar;
> >>
> >> I always use method 2 but have been noticing method 1 more and more in
> >> source code. Is this just user preference?
> >>
> >> I would use a generic search engine but not sure what the first method
> >> is called so don't know where to begin my search.
> >>
> >> Thanks for any help.
> >>
> >> Nick
> >>
> >
> > I think it is a matter of personal preference.  I prefer method 1 myself.
> >
> >
> >
> 
> Thank you for the quick replies. I thought method 2 must be faster
> because it doesn't have to search for variables in the string.
> 
> So what is the advantages then of method 1 over 3, do the curly braces
> mean anything?
> 
> 1) $string = "foo{$bar}";
> 
> 2) $string = 'foo'.$bar;
> 
> 3) $string = "foo$bar";
> 
> I must admit reading method 1 is easier, but writing method 2 is
> quicker, is that the only purpose the curly braces serve?
> 


This was on the list a few days back. Basically, the braces are there to
force PHP to recognise the full variable name, so that you could type:

$string = "{$foo}bar";

$string = "foo{$bar[0][1]}";

$string = "{$foo->bar}";


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




Re: [PHP] Netbeans IDE 6.5

2009-10-28 Thread Skip Evans

Bob McConnell wrote:


Three questions.

1. Why did you install an obsolete version? 6.7.1 is current and 6.8 is
now in beta.


Because that what Ubuntu installs with apt-get install 
netbeans and I like to stick with Ubuntu tested stuff.




2. You just asked this question on the NetBeans mailing list, which is
more likely to result in a useable answer. Can't you wait for them?


No.



3. Did you try reading the help section on "Configuring IDE Settings"?


Yes.



Once again you forgot to include that you installed this on Ubuntu.



You mean people still use Windows? Talk about obsolete!

--

Skip Evans
PenguinSites.com, LLC
503 S Baldwin St, #1
Madison WI 53703
608.250.2720
http://penguinsites.com

Those of you who believe in
telekinesis, raise my hand.
 -- Kurt Vonnegut

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



Re: [PHP] PHP String convention

2009-10-28 Thread Nick Cooper
2009/10/28 Jim Lucas:
> Nick Cooper wrote:
>> Hi,
>>
>> I was just wondering what the difference/advantage of these two
>> methods of writing a string are:
>>
>> 1) $string = "foo{$bar}";
>>
>> 2) $string = 'foo'.$bar;
>>
>> I always use method 2 but have been noticing method 1 more and more in
>> source code. Is this just user preference?
>>
>> I would use a generic search engine but not sure what the first method
>> is called so don't know where to begin my search.
>>
>> Thanks for any help.
>>
>> Nick
>>
>
> I think it is a matter of personal preference.  I prefer method 1 myself.
>
>
>

Thank you for the quick replies. I thought method 2 must be faster
because it doesn't have to search for variables in the string.

So what is the advantages then of method 1 over 3, do the curly braces
mean anything?

1) $string = "foo{$bar}";

2) $string = 'foo'.$bar;

3) $string = "foo$bar";

I must admit reading method 1 is easier, but writing method 2 is
quicker, is that the only purpose the curly braces serve?

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



[PHP] Apache file order

2009-10-28 Thread Skip Evans

Hey all,

I modified an Apache config file to list the HTML file first, 
after the PHP file, it still pulls up the PHP file first.


Is there another setting in Apache I should be looking for?

I need it to check for the HTML file first.

Thanks,
Skip


DirectoryIndex index.html index.php



--

Skip Evans
PenguinSites.com, LLC
503 S Baldwin St, #1
Madison WI 53703
608.250.2720
http://penguinsites.com

Those of you who believe in
telekinesis, raise my hand.
 -- Kurt Vonnegut

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



[PHP] Re: Netbeans IDE 6.5

2009-10-28 Thread Skip Evans

Hey,

No import button in NetBeans 6.5 on Ubuntu.

Skip

Tom Calpin wrote:

If you go Tools>Options> Keymap tab, you can click the 'Import' button at
the bottom. It just imports the zip file.
I'm new to Netbeans myself and decided to install this colour scheme,
however I can't get it to display correctly.


I'm also missing word wrap and a more simple one-click FTP upload interface,
so I'm still in half a mind as to whether I abandon NuSphere (which we sort
of grew up with) just yet.
Unless anyone out there knows any plugins that add the functionality to
Netbeans?



-Original Message-
From: Skip Evans [mailto:s...@bigskypenguin.com] 
Sent: 28 October 2009 00:50

To: php-general@lists.php.net
Subject: Netbeans IDE 6.5

Hey all,

I just downloaded the Netbeans 6.5 IDE to use as a code 
editor, installed the PHP plugin for syntax highlighting and 
it didn't look so good, so I find on the forum a guy who has 
made a collection of files, starting in a directory called 
config, that will apparently change the highlighting more in 
line to what I'm used to.


But he gave no instructions how this is to be installed and I 
can't find anywhere in the documentation how to install this 
stuff.


Any Netbeaners out there know how to install syntax 
highlighting stuff?


I found it here.

http://forums.netbeans.org/post-46850.html

Downloaded and unzipped the archive and then I stopped like 
the robot on Lost in Space when they pulled out his power pack.


Any help would be great!

Thanks,
Skip


--

Skip Evans
PenguinSites.com, LLC
503 S Baldwin St, #1
Madison WI 53703
608.250.2720
http://penguinsites.com

Those of you who believe in
telekinesis, raise my hand.
 -- Kurt Vonnegut

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



Re: [PHP] PHP String convention

2009-10-28 Thread Jim Lucas
Nick Cooper wrote:
> Hi,
> 
> I was just wondering what the difference/advantage of these two
> methods of writing a string are:
> 
> 1) $string = "foo{$bar}";
> 
> 2) $string = 'foo'.$bar;
> 
> I always use method 2 but have been noticing method 1 more and more in
> source code. Is this just user preference?
> 
> I would use a generic search engine but not sure what the first method
> is called so don't know where to begin my search.
> 
> Thanks for any help.
> 
> Nick
> 

I think it is a matter of personal preference.  I prefer method 1 myself.



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



RE: [PHP] PHP String convention

2009-10-28 Thread Jay Blanchard
[snip]I was just wondering what the difference/advantage of these two
methods of writing a string are:[/snip]

Method 2 is faster, YMMV.

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



RE: [PHP] Re: Converting tables into forms

2009-10-28 Thread Jay Blanchard
[snip]If your solution requires you to create hundreds of forms, which
could
take months to code, you need to take another look at the problem. I
don't believe you have thought it through very well.[/snip]

Actually you could use the function I provided to do this on the fly or
have the function write out a file for each table involved. 

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



[PHP] PHP String convention

2009-10-28 Thread Nick Cooper
Hi,

I was just wondering what the difference/advantage of these two
methods of writing a string are:

1) $string = "foo{$bar}";

2) $string = 'foo'.$bar;

I always use method 2 but have been noticing method 1 more and more in
source code. Is this just user preference?

I would use a generic search engine but not sure what the first method
is called so don't know where to begin my search.

Thanks for any help.

Nick

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



[PHP] RE: Netbeans IDE 6.5

2009-10-28 Thread Tom Calpin
If you go Tools>Options> Keymap tab, you can click the 'Import' button at
the bottom. It just imports the zip file.
I'm new to Netbeans myself and decided to install this colour scheme,
however I can't get it to display correctly.


I'm also missing word wrap and a more simple one-click FTP upload interface,
so I'm still in half a mind as to whether I abandon NuSphere (which we sort
of grew up with) just yet.
Unless anyone out there knows any plugins that add the functionality to
Netbeans?



-Original Message-
From: Skip Evans [mailto:s...@bigskypenguin.com] 
Sent: 28 October 2009 00:50
To: php-general@lists.php.net
Subject: Netbeans IDE 6.5

Hey all,

I just downloaded the Netbeans 6.5 IDE to use as a code 
editor, installed the PHP plugin for syntax highlighting and 
it didn't look so good, so I find on the forum a guy who has 
made a collection of files, starting in a directory called 
config, that will apparently change the highlighting more in 
line to what I'm used to.

But he gave no instructions how this is to be installed and I 
can't find anywhere in the documentation how to install this 
stuff.

Any Netbeaners out there know how to install syntax 
highlighting stuff?

I found it here.

http://forums.netbeans.org/post-46850.html

Downloaded and unzipped the archive and then I stopped like 
the robot on Lost in Space when they pulled out his power pack.

Any help would be great!

Thanks,
Skip
-- 

Skip Evans
PenguinSites.com, LLC
503 S Baldwin St, #1
Madison WI 53703
608.250.2720
http://penguinsites.com

Those of you who believe in
telekinesis, raise my hand.
  -- Kurt Vonnegut


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



[PHP] Help with my first recursion menu

2009-10-28 Thread MEM
Hello all, 

Please have a look here:
http://www.nuvemk.com/c_categoria/seccao/1


When we click on "Fitofármacos", I can display the correspondent children!
This is great! And I'm really happy! 
:)

When we click on Fitofármacos children - "Herbicidas", I was expecting to
have returned Herbicidas childs, without losing the Fitofármacos menu item.

The reason I'm losing him, I suppose, it's due the fact that the URI is not
properly generated by the function responsible to parse a menu.

Notice that, on the link posted above:
If you click on fitofármacos and then click on herbicidas, the expected URL
should be:
http://www.nuvemk.com/c_categoria/seccao/1/6/9/

but I'm getting this instead:
http://www.nuvemk.com/c_categoria/seccao/6/9/

If we try to navigate deeply, and inside Herbicidas we click on "Herbicidas
A", we are expecting an URL like so:
http://www.nuvemk.com/c_categoria/seccao/1/6/9/27/

But we are getting this instead:
http://www.nuvemk.com/c_categoria/seccao/9/27/


Here is the actual code:
http://pastebin.com/m8ffe9db

I've not yet completely understand the recursion, can I have your help in
order to understand how can I recursively build the URI segments?



Thanks a lot in advance,
Márcio


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



Re: [PHP] Re: Converting tables into forms

2009-10-28 Thread Bastien Koert
On Wed, Oct 28, 2009 at 8:53 AM, Bob McConnell  wrote:
> From: Ashley Sheridan
>
>> On Tue, 2009-10-27 at 21:07 -0700, ben...@gmail.com wrote:
>>
>>> I am trying to take MySQL tables and use the table structure to
> create
>>> HTML/PHP forms in as few steps as possible for further development. I
>>> have a project that has hundreds of tables and requires hundreds of
>>> forms to be created and don't want to do so field by field by hand.
>>>
>>> On Tuesday, October 27, 2009, Allen McCabe 
> wrote:
>>> > Please explain with much greater detail.
>>> >
>>> > On Tue, Oct 27, 2009 at 6:12 PM, ben...@gmail.com
>  wrote:
>>> > Does anyone have a quick way of converting tables into forms?
>>> >
>>
>> There is still the issue of exactly what db fields will translate
> into.
>> Where is a good time to use radio buttons instead of select lists, or
>> checkboxes instead of select-multiple lists? What about text fields in
>> the db? Should they be textareas or text inputs? Do all the db fields
>> need to be translated as visible fields? Should you hide ID fields?
>>
>> There are so many questions, that you might be better off rolling your
>> own, as a one-size-fits-all will not always work for everyone.
>
> I have a feeling in the pit of my stomach that your project is going to
> create a support nightmare. Either you will have to hand code forms for
> each table, or find a framework that dynamically creates the forms from
> schema and create suitable maps for each form. In either case, it will
> take weeks or months to complete and be nearly impossible to maintain
> when tables are changed or added.
>
> If your solution requires you to create hundreds of forms, which could
> take months to code, you need to take another look at the problem. I
> don't believe you have thought it through very well.
>
> Bob McConnell
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

symfony might be another option, but it will take you some time to
sort out the yaml config.


-- 

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] Re: Converting tables into forms

2009-10-28 Thread Bob McConnell
From: Ashley Sheridan

> On Tue, 2009-10-27 at 21:07 -0700, ben...@gmail.com wrote:
> 
>> I am trying to take MySQL tables and use the table structure to
create
>> HTML/PHP forms in as few steps as possible for further development. I
>> have a project that has hundreds of tables and requires hundreds of
>> forms to be created and don't want to do so field by field by hand.
>> 
>> On Tuesday, October 27, 2009, Allen McCabe 
wrote:
>> > Please explain with much greater detail.
>> >
>> > On Tue, Oct 27, 2009 at 6:12 PM, ben...@gmail.com
 wrote:
>> > Does anyone have a quick way of converting tables into forms?
>> >
> 
> There is still the issue of exactly what db fields will translate
into.
> Where is a good time to use radio buttons instead of select lists, or
> checkboxes instead of select-multiple lists? What about text fields in
> the db? Should they be textareas or text inputs? Do all the db fields
> need to be translated as visible fields? Should you hide ID fields?
> 
> There are so many questions, that you might be better off rolling your
> own, as a one-size-fits-all will not always work for everyone.

I have a feeling in the pit of my stomach that your project is going to
create a support nightmare. Either you will have to hand code forms for
each table, or find a framework that dynamically creates the forms from
schema and create suitable maps for each form. In either case, it will
take weeks or months to complete and be nearly impossible to maintain
when tables are changed or added.

If your solution requires you to create hundreds of forms, which could
take months to code, you need to take another look at the problem. I
don't believe you have thought it through very well.

Bob McConnell

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



RE: [PHP] Converting MySQL into Form

2009-10-28 Thread Jay Blanchard
[snip]
Anyone know of a way to can take Mysql tables/fields from phpMyAdmin or
.sql file and quickly make into HTML forms?
[/snip]

Here is that function...(there are many mods that can be made to this,
but it works)

/*
 * SQL Extactor
 * Author: jblanchard
 *
 * Business Rule:   
 *
 * REVISION:Jun 19, 2006 
 * USAGE:   used to create form based on sql database info.
 *  dis be da ugly version, needs to be funkionized
 * 
 */


/* database connection */ 
if(!$dc = mysql_connect('yourdatabase', 'username', 'password')){
echo mysql_error();
exit();
}


function formCreate($database, $table, $action, $excludeCols,
$recordID){
/* 
 * This function is used to create forms on the fly based on
tables within 
 * the database. The minimal arguments are database name and
table name.
 * Additional arguements may be supplied to indicate columns to
be excluded
 * from form and an action (CRUD) to be performed once the form
 * is filled out. If wanting to do an update, read or delete you
can specify
 * a record to retrieve to populate the form. Default values
will be provided 
 * for arguements not included.
 */
 /* database connection in global variable */
 global $dc;
 /* number of arguements sent to function */
 $numArgs = func_num_args();
 /* test to make sure that you have the minial two arguements */
 if(2 > $numArgs){
/* not enough arguments */
$errMsg = "not enough arguements supplied, please supply
database and table name";
return($errMsg);
 } else {
/* 
 * Supply default values for optional arguements if they
are not set.
 * An interesting note here: the action can be anything
that the user
 * specifies, it is not strictly limited to CRUD and it
will be output
 * in a hidden form field; 
 *  
 * That way when the user clicks 'Submit' the programmer
can have a 
 * switch action in his or her processing script to
handle this form. 
 */
 if(!isset($action))  { $action = 'read'; }
 if(!isset($recordID)){ $recordID = ''; }
 if(!isset($excludeCols)){
$excludeCols = '';
 } else {
/* create an array of excluded columns */
$arrExcludeCols = explode(",", $excludeCols);
 }

/* describe the table */
$sqlDesc = "DESCRIBE `".$database."`.`".$table."` ";
if(!($dbInfo = mysql_query($sqlDesc, $dc))){
return mysql_error();
} else {
while($tableInfo = mysql_fetch_array($dbInfo)){
/* 
 * regular expression - we need the data
that exists between the
 * parentheses in the Type column of the
database being described
 * so that we can use for length values
of form fields
 */
 if(!(in_array($tableInfo['Field'],
$arrExcludeCols))){
if(preg_match (
"/\((\d{1,}.*?)\)/", $tableInfo[1], $regs )){
/* handle numerical
values in parentheses to create form element lengths */
echo
"".$tableInfo['Field']."";
echo "\n";
} elseif("text" ==
$tableInfo[1]) {
/* handle text columns
*/
echo
"".$tableInfo['Field']."";
echo "\n";
} elseif("enum" ==
substr($tableInfo[1], 0, 4)){
/* handle enumerated
columns and creat drop downs */
echo
"".$tableInfo['Field']." ";
/*
 * regular expression -
we need the data that
 * exists between the
single quotes in the Type column of the
 * database being
described so that we can use for option 
 * values in a drop-down
on the form
 */
preg_match_all(
"/'(.*)'/U", $tableInfo[1], $matches);
echo "\n";
   

[PHP] Re: Converting tables into forms

2009-10-28 Thread Shawn McKenzie
ben...@gmail.com wrote:
> I am trying to take MySQL tables and use the table structure to create
> HTML/PHP forms in as few steps as possible for further development. I
> have a project that has hundreds of tables and requires hundreds of
> forms to be created and don't want to do so field by field by hand.
> 
> Thanks,
> 
> Ben
> 
> On Tuesday, October 27, 2009, Allen McCabe  wrote:
>> Please explain with much greater detail.
>>
>> On Tue, Oct 27, 2009 at 6:12 PM, ben...@gmail.com  wrote:
>> Does anyone have a quick way of converting tables into forms?

Use the CakePHP framework.  Run a script, type in your database info and
it will scan all your tables and generate the forms and the list,
update, delete code for each table.  It should be fully functional then
and you can tweak to your needs to add table relations etc.


-- 
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] Converting MySQL into Form

2009-10-28 Thread Jay Blanchard
[snip]
Anyone know of a way to can take Mysql tables/fields from phpMyAdmin or
.sql
file and quickly make into HTML forms?
[/snip]

Search the archive of this list. I posted a function that does this a
long while back.

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



RE: [PHP] Netbeans IDE 6.5

2009-10-28 Thread Bob McConnell
From: Skip Evans

> I just downloaded the Netbeans 6.5 IDE to use as a code 
> editor, installed the PHP plugin for syntax highlighting and 
> it didn't look so good, so I find on the forum a guy who has 
> made a collection of files, starting in a directory called 
> config, that will apparently change the highlighting more in 
> line to what I'm used to.
> 
> But he gave no instructions how this is to be installed and I 
> can't find anywhere in the documentation how to install this 
> stuff.

Three questions.

1. Why did you install an obsolete version? 6.7.1 is current and 6.8 is
now in beta.

2. You just asked this question on the NetBeans mailing list, which is
more likely to result in a useable answer. Can't you wait for them?

3. Did you try reading the help section on "Configuring IDE Settings"?

Once again you forgot to include that you installed this on Ubuntu.

Bob McConnell

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



Re: [PHP] Re: Converting tables into forms

2009-10-28 Thread Ashley Sheridan
On Tue, 2009-10-27 at 21:07 -0700, ben...@gmail.com wrote:

> I am trying to take MySQL tables and use the table structure to create
> HTML/PHP forms in as few steps as possible for further development. I
> have a project that has hundreds of tables and requires hundreds of
> forms to be created and don't want to do so field by field by hand.
> 
> Thanks,
> 
> Ben
> 
> On Tuesday, October 27, 2009, Allen McCabe  wrote:
> > Please explain with much greater detail.
> >
> > On Tue, Oct 27, 2009 at 6:12 PM, ben...@gmail.com  wrote:
> > Does anyone have a quick way of converting tables into forms?
> >
> > --
> > **
> > The content of this e-mail message and any attachments are
> > confidential and may be legally privileged, intended solely for the
> > addressee. If you are not the intended recipient, be advised that any
> > use, dissemination, distribution, or copying of this e-mail is
> > strictly prohibited. If you receive this message in error, please
> > notify the sender immediately by reply email and destroy the message
> > and its attachments.
> > *
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
> 
> -- 
> **
> The content of this e-mail message and any attachments are
> confidential and may be legally privileged, intended solely for the
> addressee. If you are not the intended recipient, be advised that any
> use, dissemination, distribution, or copying of this e-mail is
> strictly prohibited. If you receive this message in error, please
> notify the sender immediately by reply email and destroy the message
> and its attachments.
> *
> 


There is still the issue of exactly what db fields will translate into.
Where is a good time to use radio buttons instead of select lists, or
checkboxes instead of select-multiple lists? What about text fields in
the db? Should they be textareas or text inputs? Do all the db fields
need to be translated as visible fields? Should you hide ID fields?

There are so many questions, that you might be better off rolling your
own, as a one-size-fits-all will not always work for everyone.

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




Re: [PHP] Converting tables into forms

2009-10-28 Thread Tony Marston
Try the Radicore framework at http://www.radicore.org This will allow you to 
import your table definitions into its Data Dictionary, export those 
definitions to produce table classes, then you can generate the basic 
maintenance tasks using transaction patterns. This takes 5 minutes per 
table, and you don't have to write any code - no PHP, no HTML, no SQL. You 
even get an RBAC system so that you can run the transactions of a menu, and 
decide which users have access to which tasks. There is also an inbuilt 
Audit Logging system (which does not use database triggers) and a Workflow 
engine.

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org

"chetan rane"  wrote in message 
news:248b70ae0910271901o6ffd569dl203c9a08bfe8a...@mail.gmail.com...
> Hi Ben
>
> The quickest way to this is by using a framework.
> and the best way i could find was using the yiiframework
> www.yiiframework.com
>
> i could create a basic form with validations in less then 15 minutes.
>
> On Wed, Oct 28, 2009 at 6:42 AM, ben...@gmail.com  
> wrote:
>
>> Does anyone have a quick way of converting tables into forms?
>>
>> --
>> **
>> The content of this e-mail message and any attachments are
>> confidential and may be legally privileged, intended solely for the
>> addressee. If you are not the intended recipient, be advised that any
>> use, dissemination, distribution, or copying of this e-mail is
>> strictly prohibited. If you receive this message in error, please
>> notify the sender immediately by reply email and destroy the message
>> and its attachments.
>> *
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
> -- 
> with regards,
>
> Chetan Dattaram Rane
> Mob :  +91 9766646714
> Phone: 0831-2462055
> 



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



Re: [PHP] How to Get the Sub Classes of a Parent Class

2009-10-28 Thread David Otton
2009/10/28 David Otton :
> 2009/10/28 Raymond Irving :
>
>>  I'm try to do something like what Martin Scotta did but I'm looking for a
>> solution that did not require me to loop through get_declared classes() to
>> find a sub class.
>
> Place all your child classes in the same namespace, and use
> ReflectionNamespace::getClasses().

Hah. Turns out that's on the @todo list... wait for PHP 5.4 maybe.

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



Re: [PHP] How to Get the Sub Classes of a Parent Class

2009-10-28 Thread David Otton
2009/10/28 Raymond Irving :

>  I'm try to do something like what Martin Scotta did but I'm looking for a
> solution that did not require me to loop through get_declared classes() to
> find a sub class.

Place all your child classes in the same namespace, and use
ReflectionNamespace::getClasses().

But I stress, again, that I think there's a design issue that needs to
be fixed here. There's going to be a better way to do what you're
trying to do.

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



[PHP] Re: What would stop header("Location...) from working?

2009-10-28 Thread Mark Cilissen

tedd schreef:

Hi gang:

I just had a script stop following this statement:

   header("Location:users.php");

It *was* working, but now instead of running "users.php", it defaults to 
the parent script.


When I place exit() after it, such as:

   header("Location:users.php");
   exit();

The script simply exits. It does not continue to users.php -- BUT -- it 
did.


What would stop this statement from working?

Thanks,

tedd



If ANYTHING is output before header(), it stops working. Did you turn 
off error reporting? You might want to double-check, because it returns 
an error if anything is output.


--
Kind regards,
Mark Cilissen / Pixlism

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