[PHP] Tutorial zend framework p2

2012-02-11 Thread Yuri Yarlei

Hello,

The second part of Zend Framework is now on my blog, this time is about layouts
http://yuriyarlei.net/en/zend-framework-how-to-develop-layouts

Yuri Yarlei.
http://www.yuriyarlei.net.net (under construction)
Programmer PHP, JAVA, CSS, PostregreSQL;
Today PHP, tomorrow Java, after the world.
Kyou wa PHP, ashita wa Java, sono ato sekai desu.
  

[PHP] Zend Framework Tutorial

2012-01-30 Thread Yuri Yarlei
Hi people,

I wanna share the tutorial about Zend Framework there I'm doing
http://www.yuriyarlei.net/en/zend-framework-how-to-develop-introduction

Att,
Yuri Yarlei.
Java - OCJP 6
ZCE - Zend Certified Engineer for php 5.3
www.yuriyarlei.net/en
PHP, JAVA, CSS, ORACLE 10g, PostgreSQL;


[PHP] ZCE

2011-08-23 Thread Yuri Yarlei
Hi,

I like to share with the list, that I passed in the ZCE and now I'm a Zend
Certified Engineer.

I did a post when I started studying in my blog:
http://www.yuriyarlei.net/en/zend-php-certification

Att,
Yuri Yarlei.
OCJP 6, ZCE - Zend Certified Engineer for php 5.3
www.yuriyarlei.net/en


[PHP] Integrating zend-facebook error

2010-10-31 Thread Yuri Yarlei
Hi,

I'm trying to integrate facebook to show the wall in a site.

ok, i generate the auth_token here:

https://login.facebook.com/code_gen.php?api_key=API_KEY&v=1.0

And put the rest connection configuration here:

$facebookArr = array(
"appapikey" => $appapikey,
"appidkey" => $appidkey,
"appsecret" => $appsecret,
"appcallbackurl" => $appcallbackurl,
'cookie' => true,
'token' => $token

);
$fb = new FacebookRestClient($facebookArr['appapikey'],
$facebookArr['appsecret']);

$result = $fb->call_method('facebook.auth.getSession',
array('auth_token' =>$facebookArr['token'],
'generate_session_secret' => true));

Its work, but only the first time, if i refresh i get this exception:

exception 'FacebookRestClientException' with message 'Invalid parameter'

If i generate the token again, its work for the first time again.

Please someone have any recent tutorial to integrate facebook to some php
site?



Atenciosamente,
Yuri Yarlei.
www.yuriyarlei.net (under construction)
Programmer PHP, JAVA, CSS, ORACLE 10g, PostgreSQL;
Next step is the SCJP.
"Se você ainda não esta com dor de cabeça, é por que ainda cabe um pouco
mais de conhecimento."


[PHP] [OFF] Looking a developer team

2010-06-17 Thread Yuri Yarlei
Greetings,

I look for a developer team to participate theirs projects, and accept a
remote developer. To share knowledge, money, fun, time, beer, etc..

I' ve large experience(8 yr) with PHP OO, PHP structured, Zend Framework,
Drupal, Jquery, css, MySql, SQLServer, PostgreSQL, Oracle, PL/ PGSQL, PLSQL,
JAVA...

ATT,
Yuri Yarlei.
Programmer PHP, JAVA, CSS, ORACLE 10g, PostgreSQL;


RE: [PHP] PHP+Apache suddenly not working

2009-10-27 Thread Yuri Yarlei

Ash,

I think the apache is working, because he recieve the error "[27-Oct-2009 
13:05:00] PHP Fatal error:  Call to undefined function", if apache are not 
started he will receive some error about apache starting or someting like that.

Yuri Yarlei.
http://www.yuriyarlei.net.net (under construction)
Programmer PHP, JAVA, CSS, PostregreSQL;
Today PHP, tomorrow Java, after the world.
Kyou wa PHP, ashita wa Java, sono ato sekai desu.



 
> From: a...@ashleysheridan.co.uk
> To: gargari...@hotmail.com
> CC: li...@cmsws.com; phps...@gmail.com; jason-lists@lixfeld.ca; 
> php-general@lists.php.net
> Date: Tue, 27 Oct 2009 16:20:45 +
> Subject: RE: [PHP] PHP+Apache suddenly not working
> 
> On Tue, 2009-10-27 at 19:16 +0300, Yuri Yarlei wrote:
> 
> > Hi all,
> > 
> > 
> > 
> > If the basic functions of php not work, maybe the extension for php5 or 4 
> > are disabled, or the library is missing, sometimes apache does not show the 
> > erros for missing library, or yet, the library for php4 or 5 are both on, 
> > or they crash
> > 
> > Yuri Yarlei.
> > www.yuriyarlei.net (under construction)
> > Programmer PHP, JAVA, CSS, PostregreSQL;
> > Today PHP, tomorrow Java, after the world.
> > Kyou wa PHP, ashita wa Java, sono ato sekai desu.
> > 
> > 
> > 
> > 
> > > Date: Tue, 27 Oct 2009 07:59:16 -0700
> > > From: li...@cmsws.com
> > > To: a...@ashleysheridan.co.uk
> > > CC: phps...@gmail.com; jason-lists@lixfeld.ca; 
> > > php-general@lists.php.net
> > > Subject: Re: [PHP] PHP+Apache suddenly not working
> > > 
> > > Ashley Sheridan wrote:
> > > > On Tue, 2009-10-27 at 09:24 -0400, Bastien Koert wrote:
> > > > 
> > > >> On Tue, Oct 27, 2009 at 9:18 AM, Jason Lixfeld
> > > >>  wrote:
> > > >>> I have no doubt that this is due to an update that was done on my 
> > > >>> system at
> > > >>> some point, but unfortunately I can't pinpoint where. The upshot is 
> > > >>> that
> > > >>> PHP is completely unresponsive for me when run from Apache and I'm 
> > > >>> not sure
> > > >>> where to look. I recognize that this isn't an apache support list. 
> > > >>> This
> > > >>> message is being cc'd there too.
> > > >>>
> > > >>> The system is FreeBSD 6.1-RELEASE-p15. PHP 5.2.11 from ports.
> > > >>>
> > > >>> The only error I get in my php log is this:
> > > >>>
> > > >>> [27-Oct-2009 13:05:00] PHP Fatal error: Call to undefined function
> > > >>> preg_match() in
> > > >>> /usr/home/foo/public_html/cerb4/libs/devblocks/libs/zend_framework/Zend/Cache/Backend/File.php
> > > >>> on line 125
> > > >>>
> > > >>> Now I've checked and double checked that pcre support is built into 
> > > >>> php.
> > > >>> I'm not sure if there's a command that I can run in php to show all 
> > > >>> the
> > > >>> extensions that are installed or something, but I'm a bazillion 
> > > >>> percent sure
> > > >>> that it's there, so I don't believe that's the cause of the error. I'm
> > > >>> reasonably sure of this because the preg_match error thrown every 
> > > >>> minute
> > > >>> when a cron job runs, I have a .php that calls phpinfo() that shows a 
> > > >>> blank
> > > >>> screen when hit from a browser.
> > > >>>
> > > >>> My problem is that I don't know how to troubleshoot this.
> > > >>>
> > > >>> I can seem to run PHP from the CLI just fine, so does this look more 
> > > >>> like an
> > > >>> apache issue or perhaps some php module or extension that talks to 
> > > >>> apache?
> > > >>>
> > > >>> [r...@ricky /]# php
> > > >>>  > > >>> phpinfo();
> > > >>> ?>
> > > >>> phpinfo()
> > > >>> PHP Version => 5.2.11
> > > >>>
> > > >>> System => FreeBSD ricky.arionetworks.ca 6.1-RELEASE-p15 FreeBSD
> > > >>> 6.1-RELEASE-p15 #0: Sat Mar 31 11:43:34 EDT 2007
> > > >>> jlixf...@ricky.arionetworks.ca:/usr/src/sys/amd64/compile/GENERIC 
> &

RE: [PHP] PHP+Apache suddenly not working

2009-10-27 Thread Yuri Yarlei

Hi all,

 

If the basic functions of php not work, maybe the extension for php5 or 4 are 
disabled, or the library is missing, sometimes apache does not show the erros 
for missing library, or yet, the library for php4 or 5 are both on, or they 
crash

Yuri Yarlei.
www.yuriyarlei.net (under construction)
Programmer PHP, JAVA, CSS, PostregreSQL;
Today PHP, tomorrow Java, after the world.
Kyou wa PHP, ashita wa Java, sono ato sekai desu.



 
> Date: Tue, 27 Oct 2009 07:59:16 -0700
> From: li...@cmsws.com
> To: a...@ashleysheridan.co.uk
> CC: phps...@gmail.com; jason-lists@lixfeld.ca; php-general@lists.php.net
> Subject: Re: [PHP] PHP+Apache suddenly not working
> 
> Ashley Sheridan wrote:
> > On Tue, 2009-10-27 at 09:24 -0400, Bastien Koert wrote:
> > 
> >> On Tue, Oct 27, 2009 at 9:18 AM, Jason Lixfeld
> >>  wrote:
> >>> I have no doubt that this is due to an update that was done on my system 
> >>> at
> >>> some point, but unfortunately I can't pinpoint where. The upshot is that
> >>> PHP is completely unresponsive for me when run from Apache and I'm not 
> >>> sure
> >>> where to look. I recognize that this isn't an apache support list. This
> >>> message is being cc'd there too.
> >>>
> >>> The system is FreeBSD 6.1-RELEASE-p15. PHP 5.2.11 from ports.
> >>>
> >>> The only error I get in my php log is this:
> >>>
> >>> [27-Oct-2009 13:05:00] PHP Fatal error: Call to undefined function
> >>> preg_match() in
> >>> /usr/home/foo/public_html/cerb4/libs/devblocks/libs/zend_framework/Zend/Cache/Backend/File.php
> >>> on line 125
> >>>
> >>> Now I've checked and double checked that pcre support is built into php.
> >>> I'm not sure if there's a command that I can run in php to show all the
> >>> extensions that are installed or something, but I'm a bazillion percent 
> >>> sure
> >>> that it's there, so I don't believe that's the cause of the error. I'm
> >>> reasonably sure of this because the preg_match error thrown every minute
> >>> when a cron job runs, I have a .php that calls phpinfo() that shows a 
> >>> blank
> >>> screen when hit from a browser.
> >>>
> >>> My problem is that I don't know how to troubleshoot this.
> >>>
> >>> I can seem to run PHP from the CLI just fine, so does this look more like 
> >>> an
> >>> apache issue or perhaps some php module or extension that talks to apache?
> >>>
> >>> [r...@ricky /]# php
> >>>  >>> phpinfo();
> >>> ?>
> >>> phpinfo()
> >>> PHP Version => 5.2.11
> >>>
> >>> System => FreeBSD ricky.arionetworks.ca 6.1-RELEASE-p15 FreeBSD
> >>> 6.1-RELEASE-p15 #0: Sat Mar 31 11:43:34 EDT 2007
> >>> jlixf...@ricky.arionetworks.ca:/usr/src/sys/amd64/compile/GENERIC amd64
> >>> Build Date => Oct 26 2009 15:38:06
> >>> Configure Command => './configure' '--with-layout=GNU'
> >>> '--with-config-file-scan-dir=/usr/local/etc/php' '--disable-all'
> >>> '--enable-libxml' '--with-libxml-dir=/usr/local' '--enable-reflection'
> >>> '--program-prefix=' '--enable-fastcgi' '--with-apxs2=/usr/local/sbin/apxs'
> >>> '--with-regex=php' '--with-zend-vm=CALL' '--disable-ipv6'
> >>> '--prefix=/usr/local' '--mandir=/usr/local/man' 
> >>> '--infodir=/usr/local/info/'
> >>> '--build=amd64-portbld-freebsd6.1'
> >>> Server API => Command Line Interface
> >>> Virtual Directory Support => disabled
> >>> Configuration File (php.ini) Path => /usr/local/etc
> >>> Loaded Configuration File => /usr/local/etc/php.ini
> >>> Scan this dir for additional .ini files => /usr/local/etc/php
> >>> additional .ini files parsed => /usr/local/etc/php/extensions.ini
> >>> ...
> >>> ...
> >>> ...
> >>> etc
> >>> ...
> >>>
> >>> [r...@ricky /]# pkg_info | grep php5
> >>> php5-5.2.11_1 PHP Scripting Language
> >>> php5-ctype-5.2.11_1 The ctype shared extension for php
> >>> php5-dom-5.2.11_1 The dom shared extension for php
> >>> php5-extensions-1.3 A "meta-port" to install P

RE: [PHP] PHP+Apache suddenly not working

2009-10-27 Thread Yuri Yarlei

Hi all,

 

If the basic functions of php not work, maybe the extension for php5 or 4 are 
disabled, or the library is missing, sometimes apache does not show the erros 
for missing library, or yet, the library for php4 or 5 are both on, or they 
crash

Yuri Yarlei.
www.yuriyarlei.net (under construction)
Programmer PHP, JAVA, CSS, PostregreSQL;
Today PHP, tomorrow Java, after the world.
Kyou wa PHP, ashita wa Java, sono ato sekai desu.



 
> Date: Tue, 27 Oct 2009 07:59:16 -0700
> From: li...@cmsws.com
> To: a...@ashleysheridan.co.uk
> CC: phps...@gmail.com; jason-lists@lixfeld.ca; php-general@lists.php.net
> Subject: Re: [PHP] PHP+Apache suddenly not working
> 
> Ashley Sheridan wrote:
> > On Tue, 2009-10-27 at 09:24 -0400, Bastien Koert wrote:
> > 
> >> On Tue, Oct 27, 2009 at 9:18 AM, Jason Lixfeld
> >>  wrote:
> >>> I have no doubt that this is due to an update that was done on my system 
> >>> at
> >>> some point, but unfortunately I can't pinpoint where. The upshot is that
> >>> PHP is completely unresponsive for me when run from Apache and I'm not 
> >>> sure
> >>> where to look. I recognize that this isn't an apache support list. This
> >>> message is being cc'd there too.
> >>>
> >>> The system is FreeBSD 6.1-RELEASE-p15. PHP 5.2.11 from ports.
> >>>
> >>> The only error I get in my php log is this:
> >>>
> >>> [27-Oct-2009 13:05:00] PHP Fatal error: Call to undefined function
> >>> preg_match() in
> >>> /usr/home/foo/public_html/cerb4/libs/devblocks/libs/zend_framework/Zend/Cache/Backend/File.php
> >>> on line 125
> >>>
> >>> Now I've checked and double checked that pcre support is built into php.
> >>> I'm not sure if there's a command that I can run in php to show all the
> >>> extensions that are installed or something, but I'm a bazillion percent 
> >>> sure
> >>> that it's there, so I don't believe that's the cause of the error. I'm
> >>> reasonably sure of this because the preg_match error thrown every minute
> >>> when a cron job runs, I have a .php that calls phpinfo() that shows a 
> >>> blank
> >>> screen when hit from a browser.
> >>>
> >>> My problem is that I don't know how to troubleshoot this.
> >>>
> >>> I can seem to run PHP from the CLI just fine, so does this look more like 
> >>> an
> >>> apache issue or perhaps some php module or extension that talks to apache?
> >>>
> >>> [r...@ricky /]# php
> >>>  >>> phpinfo();
> >>> ?>
> >>> phpinfo()
> >>> PHP Version => 5.2.11
> >>>
> >>> System => FreeBSD ricky.arionetworks.ca 6.1-RELEASE-p15 FreeBSD
> >>> 6.1-RELEASE-p15 #0: Sat Mar 31 11:43:34 EDT 2007
> >>> jlixf...@ricky.arionetworks.ca:/usr/src/sys/amd64/compile/GENERIC amd64
> >>> Build Date => Oct 26 2009 15:38:06
> >>> Configure Command => './configure' '--with-layout=GNU'
> >>> '--with-config-file-scan-dir=/usr/local/etc/php' '--disable-all'
> >>> '--enable-libxml' '--with-libxml-dir=/usr/local' '--enable-reflection'
> >>> '--program-prefix=' '--enable-fastcgi' '--with-apxs2=/usr/local/sbin/apxs'
> >>> '--with-regex=php' '--with-zend-vm=CALL' '--disable-ipv6'
> >>> '--prefix=/usr/local' '--mandir=/usr/local/man' 
> >>> '--infodir=/usr/local/info/'
> >>> '--build=amd64-portbld-freebsd6.1'
> >>> Server API => Command Line Interface
> >>> Virtual Directory Support => disabled
> >>> Configuration File (php.ini) Path => /usr/local/etc
> >>> Loaded Configuration File => /usr/local/etc/php.ini
> >>> Scan this dir for additional .ini files => /usr/local/etc/php
> >>> additional .ini files parsed => /usr/local/etc/php/extensions.ini
> >>> ...
> >>> ...
> >>> ...
> >>> etc
> >>> ...
> >>>
> >>> [r...@ricky /]# pkg_info | grep php5
> >>> php5-5.2.11_1 PHP Scripting Language
> >>> php5-ctype-5.2.11_1 The ctype shared extension for php
> >>> php5-dom-5.2.11_1 The dom shared extension for php
> >>> php5-extensions-1.3 A "meta-port" to install P

RE: [PHP] Spam opinions please

2009-10-20 Thread Yuri Yarlei

I agree, o good captcha will be better, but the idea to redirect can be better, 
you can save in db the ip, and send then to fbi in a periodic time.


Yuri Yarlei.
www.yuriyarlei.net (under construction)
Programmer PHP, CSS, Java, PostregreSQL;
Today PHP, tomorrow Java, after the world.
Kyou wa PHP, ashita wa Java, sono ato sekai desu.



 
> Date: Tue, 20 Oct 2009 15:36:04 -0300
> From: tapi...@gmail.com
> To: gwp...@ptd.net
> CC: php-general@lists.php.net
> Subject: Re: [PHP] Spam opinions please
> 
> That will work just for one IP, but they could spam you from another
> IP. I suggest you add a good captcha to the form and that way you can
> avoid spam forever.
> 
> Regards,
> 
> Jonathan
> 
> On Tue, Oct 20, 2009 at 3:31 PM, Gary  wrote:
> > I have several sites that are getting hit with form spam.  I have the script
> > set up to capture the IP address so I know from where they come.  I found a
> > short script that is supposed to stop these IP addresses from accessing the
> > form page, it redirects the spammer to another page (I was going to redirect
> > to a page that has lots of pop-ups, scantily clad men and offers of joy
> > beyond imagination), but someone suggested I redirect to the Federal Trade
> > Commission or perhpas the FBI.
> >
> > Any thoughts on the script and its effectivness?
> >
> >  > $deny = array("111.111.111", "222.222.222", "333.333.333");
> > if (in_array ($_SERVER['REMOTE_ADDR'], $deny)) {
> >   header("location: http://www.google.com/";);
> >   exit();
> > } ?>Gary
> >
> >
> >
> > __ Information from ESET Smart Security, version of virus signature 
> > database 4526 (20091020) __
> >
> > The message was checked by ESET Smart Security.
> >
> > http://www.eset.com
> >
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
  
_
Acesse o Portal MSN do seu celular e se mantenha sempre atualizado. Clique aqui.
http://www.windowslive.com.br/celular/home.asp?utm_source=MSN_Hotmail&utm_medium=Tagline&utm_campaign=MobileServices200908

RE: [PHP] What makes _SERVER stop working

2009-08-03 Thread Yuri Yarlei

Maybe the $_SERVER variable has been disable in the server, if is it, you will 
just need enable the $_SERVER again


Yuri Yarlei.
Programmer PHP, CSS, Java, PostregreSQL;
Today PHP, tomorrow Java, after the world.
Kyou wa PHP, ashita wa Java, sono ato sekai desu.


 
> From: tmil...@springfi.gannett.com
> To: php-general@lists.php.net
> Date: Mon, 3 Aug 2009 10:26:35 -0700
> Subject: [PHP] What makes _SERVER stop working
> 
> All of a sudden this stopped working and keeps defaulting to A again
> 
> if ($_SERVER['SCRIPT_FILENAME'] = "browse.php" ) {
> 
> $default = "A";
> 
> }
> 
> 
> else {
> 
> $default = ""; 
> 
> }
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

_
Descubra todas as novidades do novo Internet Explorer 8
http://brasil.microsoft.com.br/IE8/mergulhe/?utm_source=MSN%3BHotmail&utm_medium=Tagline&utm_campaign=IE8

RE: [PHP] isset not functioning

2009-08-03 Thread Yuri Yarlei

Io, try do like this:

 

You should use $_POST for the security, using $_REQUEST some users can pass a 
inject or someting to crash the aplication, and addslashes is for more security

 

$firstName = addslashes($_POST['firstname']);

 

if(isset($firstName) && !empty($firstName)) {
$name = $firstName;
} else {
$name = 'Sir or Madam';
}


Yuri Yarlei.
Programmer PHP, CSS, Java, PostregreSQL;
Today PHP, tomorrow Java, after the world.
Kyou wa PHP, ashita wa Java, sono ato sekai desu.


 
> Date: Mon, 3 Aug 2009 10:08:08 -0700
> From: allenmcc...@gmail.com
> To: parha...@gmail.com
> CC: php-general@lists.php.net
> Subject: [PHP] isset not functioning
> 
> I created a simple survey for my work website, most of the PHP is on my
> process.php document, which is referenced by a form on a seperate page
> containing the form with the method of "post".
> 
> On my process.php page, the script obtains the field data using the
> $_REQUEST[] function.
> 
> I have a small if statement to check to see if they filled out the
> 'firstname' field, and if they did not, to replace $name with "Sir or
> Madam". Unfortunately, $name always equals "Sir or Madam", wether a value
> for "firstname" was entered or not.
> 
> All the of the other instances of using $_REQUEST[] functions just fine, but
> don't make use of if or isset. Here is the code snippet:
> 
> if(isset($_REQUEST['firstname']) && !empty($RESULT['firstname'])) {
> $name = $_REQUEST['firstname'];
> } else {
> $name = 'Sir or Madam';
> }
> 
> I also tried adding an underscore to $RESULT (I got the code for this from a
> php.net comment on the manual), to make it $_RESULT, but this doesn't seem
> to be a pre-set function, and it still does not make it work. I am guessing
> the user neglected to define $RESULT in his snippet, or I overlooked it.
> 
> Can anyone see any problems with the code?

_
Novo Internet Explorer 8. Baixe agora, é grátis!
http://brasil.microsoft.com.br/IE8/mergulhe/?utm_source=MSN%3BHotmail&utm_medium=Tagline&utm_campaign=IE8

RE: [PHP] Single Quotes in Form Inputs

2009-07-27 Thread Yuri Yarlei

I think mysql_real_escape_string()  is work well, but if you are use mysql db, 
if you are using another db, the best function is addslashes but for another 
special charactes you will need treat them with another ways

Yuri Yarlei.
Programmer PHP, CSS, Java, PostregreSQL;
Today PHP, tomorrow Java, after the world.
Kyou wa PHP, ashita wa Java, sono ato sekai desu.


 
> Date: Mon, 27 Jul 2009 11:10:08 -0700
> From: li...@cmsws.com
> To: mpet...@mac.com
> CC: phps...@gmail.com; mbmas...@stanford.edu; biprel...@gmail.com; 
> php-general@lists.php.net
> Subject: Re: [PHP] Single Quotes in Form Inputs
> 
> Michael A. Peters wrote:
> > Bastien Koert wrote:
> >> On Mon, Jul 27, 2009 at 12:41 PM, Mari Masuda
> >> wrote:
> >>> You need to sanitize and escape the input before inserting it into
> >>> the db.
> >>> You can use http://us.php.net/mysql_real_escape_string to escape the
> >>> input.
> >>>
> >>> On Jul 27, 2009, at 09:35, Ben Miller wrote:
> >>>
> >>>> Hi,
> >>>>
> >>>>
> >>>>
> >>>> I have a form in which my sales reps can add new clients into the
> >>>> database,
> >>>> but I'm running into a problem if the client's name includes a single
> >>>> quote,
> >>>> such as O'Henry, when it comes time to input the form data into the
> >>>> database
> >>>> table. I'm guessing I need to use ereg_replace, or something
> >>>> similar, to
> >>>> change the single quote, but I still can't seem to get the syntax
> >>>> right.
> >>>> Any help would be appreciated. For what it's worth, here is a
> >>>> shortened
> >>>> version of what I have:
> >>>>
> >>>>
> >>>>
> >>>> $ firstName = "$_POST[form_firstName]";
> >>>>
> >>>> $ lastname = "$_POST[form_lastName]";
> >>>>
> >>>>
> >>>>
> >>>> $query = mysql_query("INSERT INTO customers (`cust_first`,`cust_last`)
> >>>> VALUES ('$firstName','$lastName')");
> >>>>
> >>>>
> >>>>
> >>>> Ben Miller
> >>>>
> >>>>
> >>>>
> >>>
> >>> -- 
> >>> PHP General Mailing List (http://www.php.net/)
> >>> To unsubscribe, visit: http://www.php.net/unsub.php
> >>>
> >>>
> >>
> >> I like to use http://ca3.php.net/manual/en/function.htmlentities.php
> >>
> > 
> > htmlentities should not be used on the data before it goes into the
> > database. If used it should be used on data coming out of the database.
> > 
> 
> To summarize:
> 
> You should prep your data for insertion into the data by using a tool
> that formats it strictly for the database. In the ops case
> mysql_real_escape_string() is the correct tool for the job.
> 
> htmlentities() is a presentation sanitizing/cleaning tool. But, it
> should only be used for output to the browser, etc... Same thing with
> htmlspecialchars() and all other related function.
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

_
Descubra todas as novidades do novo Internet Explorer 8
http://brasil.microsoft.com.br/IE8/mergulhe/?utm_source=MSN%3BHotmail&utm_medium=Tagline&utm_campaign=IE8

RE: [PHP] Renaming all variables in a repository

2009-07-23 Thread Yuri Yarlei

In a project with this large number of files, is better if you let the way it 
is, doing this now you can crash the project and lost much much time.

Yuri Yarlei.
Programmer PHP, CSS, Java, PostregreSQL;
Today PHP, tomorrow Java, after the world.
Kyou wa PHP, ashita wa Java, sono ato sekai desu.



> Date: Thu, 23 Jul 2009 12:56:51 -0400
> From: oorza...@gmail.com
> To: php-general@lists.php.net
> Subject: [PHP] Renaming all variables in a repository
> 
> Hey all,
> we've got a repository here at work, with something like 55,000 files
> in it. For the last few years, we've been naming $variables_like_this
> and functions_the_same($way_too).  And now we've decided to switch to
> camelCasing everything and I've been tasked with somehow determining
> if it's possible to automate this process.  Usually, I'd just use the
> IDE refactoring functionality, but doing it on a
> per-method/per-function and a per-variable basis would take weeks, if
> not longer, not to mention driving everyone insane.
> 
> I've tried with regular expressions, but I can't make them smart
> enough to distinguish between builtins and userland code.  I've looked
> at the tokenizer and it seems to be the right way forward, but that's
> also a huge project to get that to work.
> 
> I was wondering if anyone had had any experience doing this and could
> either point me in the right direction or just down and out tell me
> how to do it.
> 
> Thanks so much
> --Eddie
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

_
Novo Internet Explorer 8. Baixe agora, é grátis!
http://brasil.microsoft.com.br/IE8/mergulhe/?utm_source=MSN%3BHotmail&utm_medium=Tagline&utm_campaign=IE8

RE: [PHP] putenv usage

2009-07-22 Thread Yuri Yarlei

You can use the date_default_timezone_set(), it will set the default timezone 
to your timezone choose, some server denied the access to the environment 
variable

Yuri Yarlei.
Programmer PHP, CSS, Java, PostregreSQL;
Today PHP, tomorrow Java, after the world.
Kyou wa PHP, ashita wa Java, sono ato sekai desu.



> Date: Wed, 22 Jul 2009 15:16:25 +0100
> From: phpm...@jawbone.freeserve.co.uk
> To: manojsingh2...@gmail.com
> CC: php-general@lists.php.net
> Subject: Re: [PHP] putenv usage
> 
> 2009/7/22 Manoj Singh :
> 
> > Now my question is whether it is fine to use putenv in the production
> > environment? Whether the putenv changes the timezone value globally for all
> > request or for the current request only?
> 
> "The environment variable will only exist for the duration of the
> current request." - www.php.net/putenv
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

_
Compartilhe os momentos mais importantes da sua vida.
http://www.microsoft.com/brasil/windows/windowslive/products/photos-share.aspx?tab=1

RE: [PHP] Session Confusion.

2009-07-22 Thread Yuri Yarlei

Hello

For the authentication you can do a form, it will pass the login
informations to some class who do the sql validation and put in session
the informations of user, but not the password, i prefer put in session
because when he close the browser the session will down



for 2 , 

On the first point, session variables are not something people can get 
to from the client side unless you send them to them.  What you see on 
the client side is a session identifier that allows the server to 
retrieve the actual session values.


for 3

You dont need encode all the session for the security, if you want more 
security for some variables, encode just these



for 4

One of the intentions of the session is store informations for the easy 
aplication access



for 5

I think its not a good idea, the ip can change in the middle of the aplication

Yuri Yarlei.
Programmer PHP, CSS, Java, PostregreSQL;
Today PHP, tomorrow Java, after the world.
Kyou wa PHP, ashita wa Java, sono ato sekai desu.



> Date: Wed, 22 Jul 2009 10:19:44 -0700
> From: darrenwi...@yahoo.com
> To: php-general@lists.php.net
> Subject: [PHP] Session Confusion.
> 
> Dear Forums,
> 
> Kindly advice me professionally because, am getting more confused on what to 
> do about my application that needed to be online very soon.
> 
> The fear is about Session and Authentication.
> 
> Here are my questions.
> 1.   Must a Page Authentication be done by Session or Cookie. If not what are 
> the other options.
> 2.   How secured is Session without encoding.
> 3.   Must you encode Sessions at all time and if not what type of Session.
> 4.   Is it dangerous to pass one Session on several Page.
> 5.   What about locking a Session to an IP ..(tips needed)
> 5.   Session Security tips please.
> 
> Thank You All.
> 
> Williams.
> 
> 
> 
>   

_
Descubra todas as novidades do novo Internet Explorer 8
http://brasil.microsoft.com.br/IE8/mergulhe/?utm_source=MSN%3BHotmail&utm_medium=Tagline&utm_campaign=IE8

RE: [PHP] guide me please

2009-06-29 Thread Yuri Yarlei

Hi,

My suggestion is you install a better version of PHP or use other type of php 
server, you will use oracle db?  If is not necessary, you should use mysql or 
postgresql for learn php.
But this error maybe happen because you are using '' for php tags, 
if you use ''  maybe this error will go away

Yuri Yarlei.
Programmer PHP, CSS, Java, PostregreSQL;
Today PHP, tomorrow Java, after the world.
Kyou wa PHP, ashita wa Java, sono ato sekai desu.



> Date: Mon, 29 Jun 2009 15:10:22 +0530
> From: sures...@zensar.com
> To: php-general@lists.php.net
> Subject: [PHP] guide me please
> 
> Hi List,
>  
> I am newb to this PHP. I am using "AIX Version 5.3" OS and "PHP version 
> 4.3.9" by default version and "Oracle Application Server 10g Release 2". 
> Configured properly and I am getting the phpinfo.php on browser properly. But 
> when I write my own code for php, it is just displaying the code but it is 
> not running the php code.
>  
> Is there any mistake in configuring the apache or else where? pls guide me. 
>  
> With thanks and Regards, 
> Suresh.G
>  
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

_
Descubra todas as novidades do novo Internet Explorer 8
http://brasil.microsoft.com.br/IE8/mergulhe/?utm_source=MSN%3BHotmail&utm_medium=Tagline&utm_campaign=IE8

RE: [PHP] PHP MySQL 500 Internal Error

2009-06-19 Thread Yuri Yarlei

Check the mysql user permissions, then check the root directory permissions, if 
you use some .htacess file, check this to.
This error occurs when you have, permissions errors, server is not working 
well, .htacess errors and other things, try acess your script to with 
http://127.0.0.1

Yuri Yarlei.
Programmer PHP, CSS, Java, PostregreSQL;
Today PHP, tomorrow Java, after the world.
Kyou wa PHP, ashita wa Java, sono ato sekai desu.



> To: php-general@lists.php.net
> From: elcid...@gmail.com
> Date: Thu, 18 Jun 2009 22:10:44 -0400
> Subject: [PHP] PHP MySQL 500 Internal Error
> 
> Greetings Gurus!
> 
> 
> I am attempting to use PHP+MYSQL+APACHE and I have downloaded all the latest 
> verions and installed them on a fresh windows XP install.  Got the Apache 
> server up and running, got MySQL up and running and installed PHP.  Tested 
> PHP with a script containing phpinfo().  Everything works great.
> 
> Wrote a small script to connect to the MySql database.  Tried to run the 
> script (http://localhost/dbscript.php) and I get a 500 Internal Server 
> error.  I have been up and down the web for two days looking for a solution 
> and I am completely frustrated.  I HAVE to be missing something.  PLEASE 
> PLEASE PLEASE help.  Thanks.
> 
> MySql is enabled in php.ini.  Paths are set to the php folder.  I have NOT 
> moved or copied any files whatsoever.  Apache version is 2.2.
> 
> Thanks. 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

_
Deixe suas conversas mais divertidas. Baixe agora mesmo novos emoticons. É 
grátis!
http://specials.br.msn.com/ilovemessenger/pacotes.aspx

RE: [PHP] isset question

2009-06-18 Thread Yuri Yarlei

The isset or empty, it's return a boolean (true 1, false 0), the isset will 
return true if the variable will have been initiated, the empty will return 
true if the variable is empty, but for that the variable need to be initiated. 
You can do it in a many ways, like:


$msg.= (isset($_POST['mort']) && !empty($_POST['mort']) ? "The mortgage amount 
is  $mort\n" : " ");

or

$msg.= ($_POST['mort'] == '' ? "The mortgage amount is  $mort\n" : " ");

or

$msg.= (strlen($_POST['mort']) > 0 ? "The mortgage amount is  $mort\n" : " ");



Yuri Yarlei.
Programmer PHP, CSS, Java, PostregreSQL;
Today PHP, tomorrow Java, after the world.
Kyou wa PHP, ashita wa Java, sono ato sekai desu.



> Date: Thu, 18 Jun 2009 20:07:09 +0100
> From: stut...@gmail.com
> To: gwp...@ptd.net
> CC: php-general@lists.php.net
> Subject: Re: [PHP] isset question
> 
> 2009/6/18 Gary :
> > I have a form that gives the submitter a choice or either one set of
> > questions, or another. I am still getting the message even if the input was
> > left blank.  So on the line below,
> >
> > $msg.=  isset($_POST['mort']) ? "The mortgage amount is  $mort\n" : " ";
> >
> > I get
> >
> > The mortgage amount is
> >
> > What am I missing here?
> 
> A variable "isset" even if it's empty. Either compare it to an empty
> string or test the result from strlen against 0.
> 
> -Stuart
> 
> -- 
> http://stut.net/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

_
Conheça os novos produtos Windows Live! Clique aqui.
http://www.windowslive.com.br

RE: [PHP] how to extract fields from associative array into different variables

2009-06-18 Thread Yuri Yarlei

You can try use the foreach function.

ex:
if ($res = mysql_query ($sql, $db)) {
 /* I personally prefer "res" for "resource", not "results" */
 while ($r = mysql_fetch_assoc ($res)) {
 $rows[] = $r;
}
}


foreach ($rows as $row){
  echo $row['first_name'];
  echo "";
}

the foreach function transform the array $rows[] (the fisrt level of 
associative array) in a variable $row.

Yuri Yarlei.
Programmer PHP, CSS, Java, PostregreSQL;
Today PHP, tomorrow Java, after the world.
Kyou wa PHP, ashita wa Java, sono ato sekai desu.



> To: php-general@lists.php.net
> From: news.nospam.0ixbt...@luden.se
> Date: Thu, 18 Jun 2009 14:17:59 +0200
> Subject: Re: [PHP] how to extract fields from associative array into  
> different variables
> 
> On Tue, 16 Jun 2009 08:50:45 -0400, PJ wrote:
> 
> > Ashley Sheridan wrote:
> >> On Mon, 2009-06-15 at 17:38 -0400, PJ wrote:
> >>   
> >>> Then I have to add some loopy thing to assign the values to the
> >>> $variables... a real pita since my variable do not lend themselves too
> >>> well to linear alterations ($varIn, $var2IN, $var3IN... etc... so $i=0
> >>> and $i++ arren't going to be too cooperative here... I guess I'd have to
> >>> change that to $var1IN... and then figure out how to do $var.$i.IN ... I
> >>> already tried, but don't seem to have it right
> >>> 
> >> Why do you need them in separate variables? Can't you use them using
> >> array syntax elsewhere in your code?
> 
> > Basically, I don't know how else to handle inserting and updating random
> > ...
> 
> What he's talking about is doing this:
> 
>   if ($res = mysql_query ($sql, $db)) {
> /* I personally prefer "res" for "resource", not "results" */
> while ($r = mysql_fetch_assoc ($res)) {
>   $rows[] = $r;
> }
>   }
> 
> And then you access the individual rows/columns as
>   $rows[0]['first_name']
>   $rows[0]['last_name']
>   $rows[1]['first_name']
>   $rows[1]['last_name']
> and so on, in some kind of loop probably.
> 
> (I thought this had been spelled out already, but I
>  was unable to find it so perhaps not.)
> 
> 
> /Nisse
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

_
Deixe suas conversas mais divertidas. Baixe agora mesmo novos emoticons. É 
grátis!
http://specials.br.msn.com/ilovemessenger/pacotes.aspx

RE: [PHP] Object of class could not be converted to string

2009-06-18 Thread Yuri Yarlei

But what you trying to pass to the variable?
 
I already see this error, but I see when I write $$ in the variable,
you can see if you have some $$ in variables or try casting type with
the function settype();
 
ex:
settype($foo, "array");
settype($foo, "integer");
settype($foo, "string");
 
Or maybe in your class you did not declare the variable
 
ex:
private $var1 = NULL;
private $var2 = NULL;

Yuri Yarlei


> From: ang...@elemental.co.za
> To: php-general@lists.php.net
> Date: Thu, 18 Jun 2009 13:20:59 +0200
> Subject: [PHP] Object of class could not be converted to string
> 
> Dear all, 
> 
> We are experiencing this error: 
> 
> "Object of class xxxClass could not be converted to string"
> 
> I have searched google a lot mostly the results are for Drupal or badly
> coded sites.
> 
> I have further found out that the issue is with PHP 5.2 version.
> 
> There isn't a problem with the script as it works on other servers with
> prior versions, so I am wondering if any one has any tips or ways to go
> about this error. Unfortunately we are in a position whereby we cant
> downgrade PHP as it's a shared hosted server.
> 
> Any help will be appreciated.
> 
> Thanks, 
> 
> 
> Web: http://www.elemental.co.za 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

_
Conheça os novos produtos Windows Live! Clique aqui.
http://www.windowslive.com.br

RE: [PHP] Object of class could not be converted to string

2009-06-18 Thread Yuri Yarlei

But what you trying to pass to the variable?

I already see this error, but I see when I write $$ in the variable,
you can see if you have some $$ in variables or try casting type with
the function settype();

ex:
settype($foo, "array");
settype($foo, "integer");
settype($foo, "string");

Or maybe in your class you did not declare the variable

ex:
private $var1 = NULL;
private $var2 = NULL;





> From: ang...@elemental.co.za
> To: php-general@lists.php.net
> Date: Thu, 18 Jun 2009 13:20:59 +0200
> Subject: [PHP] Object of class could not be converted to string
> 
> Dear all, 
> 
> We are experiencing this error: 
> 
> "Object of class xxxClass could not be converted to string"
> 
> I have searched google a lot mostly the results are for Drupal or badly
> coded sites.
> 
> I have further found out that the issue is with PHP 5.2 version.
> 
> There isn't a problem with the script as it works on other servers with
> prior versions, so I am wondering if any one has any tips or ways to go
> about this error. Unfortunately we are in a position whereby we cant
> downgrade PHP as it's a shared hosted server.
> 
> Any help will be appreciated.
> 
> Thanks, 
> 
> 
> Web: http://www.elemental.co.za 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

_
Deixe suas conversas mais divertidas. Baixe agora mesmo novos emoticons. É 
grátis!
http://specials.br.msn.com/ilovemessenger/pacotes.aspx

RE: [PHP] sloppiness & stupidity

2009-06-17 Thread Yuri Yarlei

I agree, this list is to learn and improve skills in php laguage. not to 
discriminate the others when they try to help someone or trying to learn 
somethings

> Date: Tue, 16 Jun 2009 20:50:57 -0400
> From: asny...@noloh.com
> To: af.gour...@videotron.ca; php-general@lists.php.net
> Subject: RE: [PHP] sloppiness & stupidity
> 
> While ranting might be good for the psyche there are trained psychiatric 
> professionals that will readily listen to your rants. The PHP mailing list is 
> not the place to vent. In every large community there will be those with less 
> experience than others, and yes, many inexperienced programmers that will do 
> whatever it takes to get things working, even if that means copying and 
> pasting code they don't understand. Instead of ranting, a more useful 
> approach would be to create a post that properly informs a user on how to 
> populate a multiple option select box and eventually rank higher than any 
> incorrect postings.
> 
> -Original Message-
> From: PJ [mailto:af.gour...@videotron.ca] 
> Sent: Tuesday, June 16, 2009 8:44 PM
> To: php-general@lists.php.net
> Subject: [PHP] sloppiness & stupidity
> 
> I'm sorry, guys, but I am really getting po'd.
> The irresponsible sloppiness and stupidity is just getting to me.
> In my quest for a way to populate a multiple option select box I have
> run across so many errors that it's beyond belief... such nonsense as
> "select for select or select="select" ( think this is right, but then
> who knows?) & other variations; then theres in_array() that has
> explanations about as clear as a cesspool - the way it's explained is
> not at all clear, -- and somebody did an in_array($tring, "text") -
> which is reversed... don't these idiots read what they are putting up on
> the internet?
> And some of you wonder why I ask stupid questions? Rare, indeed, is the
> clear explanation or demonstration. I get the impression that there are
> a lot of asholeys out there who learn the less than basic programming
> and then forget that even a ignoramus as I can be looking for rather
> complicated guidance. The Internet was a great promise, but god is is
> overbloated with floating intellectual excrement.
> Sorry, but ranting sometimes is good for the psyche. >:o
> 
> -- 
> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
> -
> Phil Jourdan --- p...@ptahhotep.com
>http://www.ptahhotep.com
>http://www.chiccantine.com/andypantry.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
> 

_
Deixe suas conversas mais divertidas. Baixe agora mesmo novos emoticons. É 
grátis!
http://specials.br.msn.com/ilovemessenger/pacotes.aspx

RE: [PHP] populate form input option dropdown box from existing data

2009-06-17 Thread Yuri Yarlei

sorry, maybe I have been lazy in that comment, I admit, whem wrote that 
solution i was in a such hurry and without time. I dont really read what i 
wrote, but now i think this solution is good



".$row['name']."";
  }
}
?>


> Date: Tue, 16 Jun 2009 20:46:29 -0400
> From: af.gour...@videotron.ca
> To: a...@ashleysheridan.co.uk
> CC: gargari...@hotmail.com; m...@dajve.co.uk; php-general@lists.php.net; 
> tedd.sperl...@gmail.com; nos...@mckenzies.net
> Subject: Re: [PHP] populate form input option dropdown box from   
> existingdata
> 
> Ashley Sheridan wrote:
> > On Tue, 2009-06-16 at 18:19 -0400, PJ wrote:
> >   
> >> Ashley Sheridan wrote:
> >> 
> >>> On Tue, 2009-06-16 at 15:48 -0400, PJ wrote:
> >>>   
> >>>   
> >>>> jenai tomaka wrote:
> >>>> 
> >>>>     
> >>>>> You can try like this,
> >>>>>
> >>>>> $row = stored data;
> >>>>>  
> >>>>> and write the options like this
> >>>>> 
> >>>>>
> >>>>>
> >>>>> Yuri Yarlei.
> >>>>>
> >>>>> <http://brasil.microsoft.com.br/IE8/mergulhe/?utm_source=MSN%3BHotmail&utm_medium=Tagline&utm_campaign=IE8>
> >>>>>   
> >>>>>   
> >>>> Yuri, I'm still "wet behind the ears" on this so I don't quite
> >>>> understand what you mean by "stored data" ;  and what does the "id"
> >>>> (id==$row?"selected":"") mean?
> >>>> I get the idea that this might be translated into something in the code
> >>>> I have dreamed up - further down.
> >>>>
> >>>> echo "", $row['category'], " >>>> />";
> >>>> I suppose that I must add an if clause to insert the selected option for
> >>>> the categories that are relevant...
> >>>>
> >>>>
> >>>> Gentlemen,
> >>>> I have been diligently studying all this and have just returned my
> >>>> attention to the list, so I've read the replies/inputs and now comment:
> >>>>
> >>>> BTW, I had some problems with the multiple statement - it does not take
> >>>> any parameters; it must simply be stated multiple without quotes.
> >>>>
> >>>> Now, I was happy to learn that it is simpler to populate the insert new
> >>>> books page dynamically from the db. Much shorter & neater.
> >>>> It looks to me like the best solution for the edit page is close to what
> >>>> Yuri suggests.
> >>>> Since the edit page is very similar to the insert new books page, I
> >>>> merely need to populate the Select options box slightly differently.
> >>>> This is the code to populate the insert page:
> >>>> 
> >>>>  >>>> $sql = "SELECT * FROM categories"; 
> >>>>   if ( ( $results = mysql_query($sql, $db) ) !== false ) {
> >>>> while ( $row = mysql_fetch_assoc($results) ) {
> >>>> echo "", $row['category'],
> >>>> "";
> >>>> }
> >>>> }
> >>>> ?>
> >>>> 
> >>>>
> >>>> The problem nowis to find a way to add a conditional clause above that
> >>>> will insert the option="selected" in the output.
> >>>> The input for this comes from:
> >>>> // do categories
> >>>> $sql = "SELECT id, category FROM categories, book_categories
> >>>> WHERE book_categories.bookID = $idIN &&
> >>>> book_categories.categories_id = categories.id";;
> >>>> if ( ( $results = mysql_query($sql, $db) ) !== false ) {
> >>>> while ( $row = mysql_fetch_assoc($results) ) {
> >>>> echo$row['id'], "";
> >>>> }
> >>>> }
> >>>>
> >>>> This may return any number of category ids so the problem is to figure
> >>>> out a way to pass the ids from the above code to the right ids in the
> >>>> first code above.
> >>>> How & what do I 

RE: [PHP] populate form input option dropdown box from existing data

2009-06-17 Thread Yuri Yarlei

sorry, maybe I have been lazy in that comment, I admit, whem wrote that 
solution I was in a such hurry and without time. I dont really read what I 
wrote, but now I think this solution is good.



".$row['name']."";
  }
}
?>











> Date: Wed, 17 Jun 2009 10:16:15 +0100
> From: m.f...@leedsmet.ac.uk
> To: php-general@lists.php.net
> Subject: RE: [PHP] populate form input option dropdown box from existing data
> 
> On 16 June 2009 20:48, PJ advised:
> 
> > Now, I was happy to learn that it is simpler to populate the
> > insert new
> > books page dynamically from the db. Much shorter & neater.
> > It looks to me like the best solution for the edit page is
> > close to what
> > Yuri suggests.
> > Since the edit page is very similar to the insert new books page, I
> > merely need to populate the Select options box slightly differently.
> > This is the code to populate the insert page:
> > 
> >  > $sql = "SELECT * FROM categories";
> >   if ( ( $results = mysql_query($sql, $db) ) !== false ) {
> > while ( $row = mysql_fetch_assoc($results) ) {
> > echo "", $row['category'],
> > ""; }
> > }
> >> 
> > 
> > 
> > The problem nowis to find a way to add a conditional clause above that
> > will insert the option="selected" in the output.
> > The input for this comes from:
> > // do categories
> > $sql = "SELECT id, category FROM categories, book_categories
> > WHERE book_categories.bookID = $idIN &&
> > book_categories.categories_id = categories.id";;
> > if ( ( $results = mysql_query($sql, $db) ) !== false ) {
> > while ( $row = mysql_fetch_assoc($results) ) {
> > echo$row['id'], "";
> > }
> > }
> > 
> > This may return any number of category ids so the problem is to figure
> > out a way to pass the ids from the above code to the right ids in the
> > first code above. How & what do I search to match the two ids?
> 
> Well, if I'm understanding your queries correctly, you need to compare
> the two sets of $row['id'] from the two queries above -- so your first
> query should be the second one above ("SELECT id, category FROM ..."),
> and you need to save the ids it returns for use in the loop which emits
> the s. This can be done by replacing the "echo $row['id']" with
> "$selected_ids[] = $row['id']". Now you have an array of the selected
> ids which you can use in your in_array(). So your finished code is going
> to look something like this:
> 
>   
>  // do categories
>   $selected_ids = array();
>   $sql = "SELECT id, category FROM categories, book_categories
>   WHERE book_categories.bookID = $idIN &&
> book_categories.categories_id = categories.id";
>   if ( ( $results = mysql_query($sql, $db) ) !== false ) {
>   while ( $row = mysql_fetch_assoc($results) ) {
>   $selected_ids[] = $row['id'];
>   }
>   }
>   $sql = "SELECT * FROM categories";
>   if ( ( $results = mysql_query($sql, $db) ) !== false ) {
>   while ( $row = mysql_fetch_assoc($results) ) {
>   echo "">", $row['category'],
>"\n";
>   }
>   }
>   ?> 
>   
> 
> Hope this helps.
> 
> Cheers!
> 
> Mike
> 
>  --
> Mike Ford,  Electronic Information Developer,
> C507, Leeds Metropolitan University, Civic Quarter Campus, 
> Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom
> Email: m.f...@leedsmet.ac.uk
> Tel: +44 113 812 4730
> 
> 
> To view the terms under which this email is distributed, please go to 
> http://disclaimer.leedsmet.ac.uk/email.htm
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

_
Emoticons e Winks super diferentes para o Messenger. Baixe agora, é grátis!
http://specials.br.msn.com/ilovemessenger/pacotes.aspx