[PHP] Newibie: fetch Obj question - data not showing.

2009-04-05 Thread MEM
Hello, 1) Ok, with mysqli, to fetch data from a database to a select drop down list, we would do something like this right? : ?php $result = $mysqli-query(SELECT id_cliente, nome_cliente FROM cliente); echo select id='listacliente' name='listacliente'; while($row =

RE: [PHP] Newibie: fetch Obj question - data not showing.

2009-04-05 Thread MEM
why did you forget to use the debugging functions : print_r() and var_dump() for the results? So, you'll get some idea beforehand of posting the problem here. I am looking at the code in a hurry so I cant help you much right away. Lenin http://www.twitter.com/nine_L www.twitter.com/nine_L

RE: [PHP] Newibie: fetch Obj question - data not showing.

2009-04-05 Thread MEM
On Behalf Of 9el On Sun, Apr 5, 2009 at 10:08 PM, MEM mailto:tal...@gmail.com tal...@gmail.com wrote: Hello, 1) Ok, with mysqli, to fetch data from a database to a select drop down list, we would do something like this right? : ?php $result = $mysqli-query(SELECT id_cliente, nome_cliente

[PHP] Newbie: handling instance values on a attribute of the same class.

2009-04-09 Thread MEM
Hi all, Ok. Here is a code that I'm studying: class Connection extends PDO { private $dsn = 'mysql:dbname=testes;host=127.0.0.1'; private $user = 'root'; private $password = ''; public $handle = null; function __construct( ) { try { if (

[PHP] PDO fetch_obj - question

2009-04-14 Thread MEM
Hi there, I’ve made a fetch_obj and, as stated on some sites, it returns a anonymous object where the properties will have the name of our columns database. However, when I do this, I notice that instead of giving me the column names as they are typed on the DB I get them uppercase. So, when

[PHP] RE: PDO fetch_obj - question

2009-04-14 Thread MEM
Hi there, I’ve made a fetch_obj and, as stated on some sites, it returns a anonymous object where the properties will have the name of our columns database. However, when I do this, I notice that instead of giving me the column names as they are typed on the DB I get them uppercase. So,

RE: [PHP] PDO fetch_obj - question

2009-04-16 Thread MEM
Thanks. I will see. The script for my database was been generated so, I will doublecheck this uppercase issue... Regards, Márcio 2009/4/15 Thodoris t...@kinetix.gr Hi there, I’ve made a fetch_obj and, as stated on some sites, it returns a anonymous object where the properties will have the

[PHP] niewbie - call methods from another class

2009-04-19 Thread MEM
Hello, I have something like this: $stmt = $this-_dbh-prepare(INSERT INTO DOG (name_dog, race_dog, id_vet) VALUES (?, ?, ?)); $stmt-bindParam(1, $this-getNameDog() ); $stmt-bindParam(2, $this-getRaceDog()); $stmt-bindParam(3,

[PHP] Self-Process php forms or not?

2009-04-24 Thread MEM
I’m trying to understand the advantages behind opting by using a Self-Process PHP Form, instead of having a form and then point the action of the form to another .php page. Can anyone point me some resources about this. Why using one instead of another. What are the main advantages?

RE: [PHP] Self-Process php forms or not?

2009-04-24 Thread MEM
So, on your opinion, we can call that method, on some circumstances, a good practice? What about the moto: let's separate business from presentation? Thanks once again, Márcio -Original Message- From: Sándor Tamás (HostWare Kft.) [mailto:sandorta...@hostware.hu] Sent: sexta-feira,

RE: [PHP] Self-Process php forms or not?

2009-04-24 Thread MEM
script to use separate components for the presentation, business and data access layers. -- Tony Marston http://www.tonymarston.net http://www.radicore.org MEM tal...@gmail.com wrote in message news:002b01c9c4dd$08569bc0$1903d3...@com... So, on your opinion, we can call that method

[PHP] Doubts concerning a general Insert method

2009-07-13 Thread MEM
Hello, I'm trying to understand a general CRUD class that I've seen here: http://www.phpro.org/classes/PDO-CRUD.html I'm learning PHP and I have some doubts on this method to generally insert data into DB. The class name is crud and here is the method: public function dbInsert($table, $values)

RE: [PHP] Doubts concerning a general Insert method

2009-07-13 Thread MEM
$values[0] will give you the first element of $values, namely array('animal_name'='bruce', 'animal_type'='dingo'). array_keys will return an array containing the keys from the passed array, so in this case you'll get array('animal_name', 'animal_type'). So... since $value is an

RE: [PHP] Doubts concerning a general Insert method

2009-07-13 Thread MEM
Nice. :-) Thanks a lot Stuart for your time and explanations. Now that I have understand, I will try to move on, and understand how can we introduce bindParams on it: For a recall, here is the original class: public function dbInsert($table, $values) { $this-conn();

RE: [PHP] Doubts concerning a general Insert method

2009-07-14 Thread MEM
Ok... according to the above posts, I've started to create my generic CRUD class however, I'm wondering: Any of you have already used a DAO design pattern in conjunction with a CRUD generic class? Know that I'm trying to create a generic CRUD class on a DAO Design pattern, it seems that it

[PHP] Newbie: Composition by Association - Pagination Class general question.

2009-07-19 Thread MEM
Hello, I have a Animals DAO class that I'd like to apply a pagination class to it. Between this two classes, there will be a composition relation (more precisely, an association one). My question is: Is a Pagination that has a Animal. OR Is a Animal that has a pagination? Should we create on

RE: [PHP] Newbie: Composition by Association - Pagination Class general question.

2009-07-19 Thread MEM
Pagination is the generically applicable class - it should know nothing about what specifically it's paginating. Ok... but I need to grab values of my DAO classes, I mean, even if we paginate images on a directory or records on a database table, the pagination should have a $limit, and a

RE: [PHP] Newbie: Composition by Association - Pagination Class general question.

2009-07-19 Thread MEM
I don't know how your other classes are arranged, myPDO.class.php - Singleton. Makes the connection to the database possible. generalDAO.class.php - Abstract DAO Class, grabs the myPDO instance and could have other methods on the future that are shared for all the DAO classes.

RE: [PHP] Newbie: Composition by Association - Pagination Class general question.

2009-07-19 Thread MEM
I would say your pagination logic belongs in myPDO.class.php. Where I have this functionality it's as simple as two arguments to the method that gets data, $page and $perpage. Setting both to false would retrieve all rows. Interesting but, still no clue, on this side, about how to

RE: [PHP] Re: Newbie: Composition by Association - Pagination Class general question.

2009-07-19 Thread MEM
As for (1) even in my pre-OO days I was used to using a single generic DAO for all database access. The only time that more than one DAO existed was for a different DBMS engine. This is why I have one DAO class for MySQL, one for PostgreSQL and another for Oracle. If you are incapable of

RE: [PHP] Re: Newbie: Composition by Association - Pagination Class general question.

2009-07-19 Thread MEM
As for (1) even in my pre-OO days I was used to using a single generic DAO for all database access. The only time that more than one DAO existed was for a different DBMS engine. This is why I have one DAO class for MySQL, one for PostgreSQL and another for Oracle. If you are

RE: [PHP] Re: Newbie: Composition by Association - Pagination Class general question.

2009-07-19 Thread MEM
Why not? Why can't you replace a call to a mysqli function with a call to a PDO function? It's not just a simple replacement - I need to add bindparam, prepare, execute, placeholders and fetchObject. But I will give it a try... Also, I also intend to use fetchObject method instead of

RE: [PHP] Re: Newbie: Composition by Association - Pagination Class general question.

2009-07-22 Thread MEM
As for (1) even in my pre-OO days I was used to using a single generic DAO for all database access. The only time that more than one DAO existed was for a different DBMS engine. This is why I have one DAO class for MySQL, one for PostgreSQL and another for Oracle. If you are

RE: [PHP] Re: Newbie: Composition by Association - Pagination Class general question.

2009-07-22 Thread MEM
Thanks a lot Tony. Unfortunately for me, I'm seeing myself in no conditions for properly learning a framework. I want to learn PHP and a framework bring so many concepts at once, that I found extremely complex and time consuming do dig in, at once, right now. Since I have no more than a few months

[PHP] stdClass - A newbie question

2009-07-30 Thread MEM
Hello everybody, In this class sketch: ?php class Pagination { ... public static function Pagination ($total_records, $limit, $page) { $total_pages = ceil($total_records / $limit); $page = max($page, 1); $page = min($page,

RE: [PHP] stdClass - A newbie question

2009-07-30 Thread MEM
By the way, there are many reasons for creating objects inside of other objects. This should not be considered an exception. I don't know where this code belongs to, so I can't clear out if it is good or bad OOP style. I do not intend to public judge the author, but the original article is

[PHP] Newbie: can't access a return value.

2009-08-01 Thread MEM
Hi all, When I do this: $associacao_dao-listar($limit, $offset); I can var_dump the correct $limit. I can var_dump the correct $offset. I CAN'T access the object that I was hoping to get, called $records. After this, I was hoping to do var_dump($records); and see the stdClass object. Here

[PHP] RE: Newbie: can't access a return value.

2009-08-01 Thread MEM
Solved. Forget to assigning the return value of the method to anything. :S Sorry. Márcio -Original Message- From: MEM [mailto:tal...@gmail.com] Sent: sábado, 1 de Agosto de 2009 17:13 To: 'php-general@lists.php.net' Subject: Newbie: can't access a return value. Hi all, When I

RE: [PHP] Self-Process php forms or not?

2009-10-01 Thread MEM
- Original Message - From: MEM tal...@gmail.com To: 'PHP-General List' php-general@lists.php.net Sent: Friday, April 24, 2009 2:34 PM Subject: [PHP] Self-Process php forms or not? I'm trying to understand the advantages behind opting by using a Self-Process PHP Form, instead of having

RE: [PHP] Self-Process php forms or not?

2009-10-01 Thread MEM
-Process php forms or not? On 10/1/09 10:13 AM, tedd tedd.sperl...@gmail.com wrote: At 1:00 PM +0100 10/1/09, MEM wrote: One last question about this: I've done a self submit form, after hearing all the advantages expressed here. But how could we relate, without using javascript

RE: [PHP] Self-Process php forms or not?

2009-10-02 Thread MEM
field isn't necessary. It's this correct assumptions? Please advice, Regards, Márcio -Original Message- From: kranthi [mailto:kranthi...@gmail.com] Sent: sexta-feira, 2 de Outubro de 2009 11:12 To: a...@ashleysheridan.co.uk Cc: Manuel Lemos; php-general@lists.php.net; MEM; Bob

RE: [PHP] Self-Process php forms or not?

2009-10-02 Thread MEM
You can set it up any number of ways. There is no absolute need for a redirect. Everything can be done in one form, or not -- your choice. Cheers, tedd Yes. But since I don't want to display a success information + form fields, but only the success information, I believe the only way we

RE: [PHP] Self-Process php forms or not?

2009-10-04 Thread MEM
Thanks a lot. To all. For the moment, I'm with the redirect solution that others have pointed. But after seen tedd example and watch Manuel videos, I'm starting to understand how the hidden field solution work as well. Well... I'm *starting* to understand I've not fully understand it yet,

RE: [PHP] Self-Process php forms or not?

2009-10-04 Thread MEM
i don't think so. if the user requests the page a_form.php then the server will normally execute the a_form.php script regardless whether the form was submitted or not. to display a blank form, the user probably requests a_form.php with the GET method and probably without any GET

RE: [PHP] Self-Process php forms or not?

2009-10-04 Thread MEM
i agree that it does seem a bit as though Márcio is in such a hurry to make something work that the tasks of learning and understanding the fundamentals are being left aside. while that's maybe understandable, it's a bit frustrating when we're trying to explain the fundamentals. Thanks a

[PHP] ternary operator sintax help

2009-10-06 Thread MEM
Hello all, I'm trying to display a div, only when some php value is set. Since this will be near html, I'd like to keep it on one line. So, I'd love to use shortcuts and a ternary operator for the effect. I'm having something like this right now, but the div still appears even if the error is

RE: [PHP] ternary operator sintax help

2009-10-06 Thread MEM
'] : ''; ?/div I mean, it will show the message only when the form gets submitted. At the beginning it will have ‘’. :s Regards, Marcio From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Sent: terça-feira, 6 de Outubro de 2009 19:49 To: MEM Cc: php-general@lists.php.net Subject: Re

RE: [PHP] Re: ternary operator sintax help

2009-10-06 Thread MEM
class=mensagemErro'.$erros['anexo'].'/div' :''); ? MEM tal...@gmail.com escreveu na mensagem news:002401ca46b4$ed6ad6a0$c84083...@com... Hello all, I'm trying to display a div, only when some php value is set. Since this will be near html, I'd like to keep it on one line. So, I'd love

RE: [PHP] Re: ternary operator sintax help

2009-10-06 Thread MEM
Absolutely. ;) I was reporting to ashley teachings. :-) Philip, thanks for the tip. :-) Thank you all, Márcio -Original Message- From: Tom Worster [mailto:f...@thefsb.org] Sent: terça-feira, 6 de Outubro de 2009 21:10 To: MEM; php-general@lists.php.net Subject: Re: [PHP] Re

[PHP] FILTER_VALIDATE_INT - newbie question

2009-10-07 Thread MEM
Hello all, I'm having this strange behavior, and I do not understanding why... When I use FILTER_VALIDATE_INT I'm unable to get, on my input box, values starting with 0(zero), or values that are greater (in length) then 10 digits. I was expecting to be able to input the all range of integers.

RE: [PHP] FILTER_VALIDATE_INT - newbie question

2009-10-07 Thread MEM
[sic] Before your e-mail, I've considering the use of this: if (!is_numeric($telefone)) { $erros['numberofsomething'] = 'Error - only numbers please.'; } I meant this of course: if (!is_numeric($numberofsomething)) { $erros['numberofsomething'] = 'Error - only numbers please.'; }

RE: [PHP] FILTER_VALIDATE_INT - newbie question

2009-10-07 Thread MEM
Well, it was only a guess, but if you look at the integer limit on 32-bit systems, you'll see that the upper limit for numbers is 2147483647 (or 2^31-1) which would explain maybe your upper limit problem. Also, I think you're getting confused over the zero with exactly what you are

RE: [PHP] FILTER_VALIDATE_INT - newbie question

2009-10-07 Thread MEM
Well, at a guess, if a number is 0, PHP see's that as equivalent to a false. In this case, shouldn't php ignore the 0 as false? Also, numbers over 10 digits may be going over the limit for your PHP install, assuming PHP actually attempts to convert the string to a real integer for the

RE: [PHP] FILTER_VALIDATE_INT - newbie question

2009-10-07 Thread MEM
Thank you all for your replies. The issue was solved for a better fitting solution on this case, that was by using a regex expression. I've not tested the difference between using == or ===. I was using ! But, the main question that is not clear on my newbie head is, why how why couldn't this

[PHP] Newbie: Array of objects iteration

2009-10-08 Thread MEM
Hello all, I'm grabbing all records from a table using: $records = $stmt-fetchAll(PDO::FETCH_OBJ); return $records; In order to display the values we can do: foreach ($records as $record) { echo $record-id; echo $record-name; }

RE: [PHP] Newbie: Array of objects iteration

2009-10-09 Thread MEM
@LinuxManMikeC and all @All Thanks. I was more or less aware of that possibility, however, please let me share the big picture will you guys: The main point is to access the properties name as well as values, of that object, and put them on a xls file. Instead of using mysql_num_rows, and

RE: [PHP] Newbie: Array of objects iteration

2009-10-09 Thread MEM
Correct about my example, although I'm not sure if you get each record as an array or as an object. Anyway, you can iterate both. And if you want to get the column names, I suppose you could use array_keys() on the first record if you receive an array, or maybe get_object_vars() if it's an

RE: [PHP] Newbie: Array of objects iteration

2009-10-09 Thread MEM
Right now, I have something like this: foreach ($objRecord as $record) { //we will have a new line. $xls_file .=\n; foreach ($record as $column=$value) { $xls_file .= $value.\t; } } The only thing I need now, is to put on top, the

RE: [PHP] Newbie: Array of objects iteration

2009-10-09 Thread MEM
Dear all, it's done. Can I call your help for the remain issues please, I'm sure they are easy to explain, and at some extend, common: http://pastebin.com/m691d3e66 Instead of saving to the database, if I do a print_r or a var_dump, I get the charsets quite ok. However, they do not appear

RE: [PHP] Newbie: Array of objects iteration

2009-10-09 Thread MEM
Done. print utf8_decode($xls_file); Regards, Márcio -Original Message- From: MEM [mailto:tal...@gmail.com] Sent: sexta-feira, 9 de Outubro de 2009 18:19 To: 'MEM'; 'Fernando Castillo Aparicio'; 'Lester Caine'; 'php- gene...@lists.php.net' Subject: RE: [PHP] Newbie: Array

RE: [PHP] Newbie: Array of objects iteration

2009-10-10 Thread MEM
MEM, http://www.php.net/language.oop5.reflection Regards, Tommy And brand new world opens in from of my eyes... O.O. I will search more info on this on the net... just for the records, as properties names is concern, I couldn't find any better I suppose: http://pt.php.net

[PHP] dynamic menu with show hide capabilities - understanding possible workflow

2009-10-26 Thread MEM
Hello all, I'm on my way to build my first dynamic menu using php. However, each time I say this, people start jumping at me crying out loud: Jquery . I don't need js for this. Really. (At least, this is what I believe). So I was wondering if It's possible to accomplish it, by using css and php

RE: [PHP] dynamic menu with show hide capabilities - understanding possible workflow

2009-10-26 Thread MEM
-feira, 26 de Outubro de 2009 14:38 To: MEM Cc: php-general@lists.php.net Subject: Re: [PHP] dynamic menu with show hide capabilities - understanding possible workflow On Mon, 2009-10-26 at 13:28 +, MEM wrote: Hello all, I'm on my way to build my first dynamic menu using php. However

RE: [PHP] dynamic menu with show hide capabilities - understanding possible workflow

2009-10-26 Thread MEM
Thanks a lot for your replies. Let's see if I understand, if not, please, let me know, I'm not that proficient in English. Second try, in order to accomplish this, I have to: 1) Generate the multidimensional array from query. 2) Generate the ul / li menu (echo + foreach) displaying all

RE: [PHP] dynamic menu with show hide capabilities - understanding possible workflow

2009-10-27 Thread MEM
That sounds about right yeah. You could also get a little bit clever and only retrieve the rows from your db that will go to make the array elements you'll need. It doesn't make sense to retrieve a full product list each time someone visits the page, Ok. so you only need to retrieve those

RE: [PHP] dynamic menu with show hide capabilities - understanding possible workflow

2009-10-27 Thread MEM
Think of it a bit like an online shop selling operating systems: 1) All the main OS's you sell are on the front page - Linux, MacOS Windows 2) User clicks on Linux, and is taken to the url /products/linux and they are shown all the Linux OS's on offer (Fedora, SuSe, Ubuntu, Knoppix, etc) 3)

[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

[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

RE: [PHP] dynamic menu with show hide capabilities - understanding possible workflow

2009-10-30 Thread MEM
-Original Message- From: MEM [mailto:tal...@gmail.com] Sent: terça-feira, 27 de Outubro de 2009 12:05 To: 'a...@ashleysheridan.co.uk' Cc: 'Jim Lucas'; 'php-general@lists.php.net' Subject: RE: [PHP] dynamic menu with show hide capabilities - understanding possible workflow Think

[PHP] headers help

2010-03-12 Thread MEM
Hello all, I must confess I know the very basics on this language and have even less knowledge about http headers. I wish you could help me out on this: I have a form that sends html e-mails and an optional file as attachment. The issue is that, if the file is NOT send, the e-mail receives two

[PHP] RE: headers help

2010-03-12 Thread MEM
I've had a quick look and this: http://pastebin.com/RswEBPLd may work; if not though you want to view the source of an email from anywhere which displays correctly; and the source of one from your application - then compare to get the fix :) Regards! Thanks Nathan, I will give it a try.

[PHP] Migration Scheme - from one mysql DB to another mysql DB

2010-03-13 Thread MEM
Hello all, If possible, I would like to ask and have your help about the methods and procedures that should exist to accomplish the following task: I need to grab some data from one mySQL database with some specific table and field names, to another mySQL database with specific table and field

RE: [PHP] Migration Scheme - from one mysql DB to another mysql DB

2010-03-13 Thread MEM
I'd like to know - what type of hosting and OS the 2 databases are running. - if they're (staying) on the same machine, and if not: whats the available bandwith (updown, lowpeak) between the machines? any cost to that bandwith? - if you have admin rights on both databases. - how often

[PHP] simpleXML - can't add children - why? - stuck

2010-08-04 Thread MEM
Hello all, I'm struggling here, but no joy so far. Having this XML file that I'm loading using simplexml_load_file(): http://pastebin.com/JiW3LxWM I need to add some domain:create children nodes after line 8. What do I need to add? This: http://pastebin.com/mT27g3ZN In order to do so, I have