Instances of PDO clarification

I thought I understood how to create a new instance of a PDO class but I aint seeing the expected result.

basically I have a few instances initiated to pull out data from the database to populate a few select/option tags. I also have an instance created to check users. I have another one(which started this whole discovery of problem that is supposed to insert data from a form to my database.

Funny observation that I just noticed by looking at the page source. I have notices all over the place saying:

example of one of them:

<b>Notice</b>:  Undefined property: stdClass::$device in <b>C:\xampp\htdocs\database\firesafety.php</b> on line <b>151</b><br />  <option value="1" >Smoke Alarm</option>

But All my select tags gets populated as they should. I didn’t even know something was wrong since I used the same scripts with another page and all is fine.

I did a few var_dump test here and there with various variables that are holding each instance of a new PDO and for some reason every variable echo out the same way, returning the same data no matter the name of the variable(which none are pulling the same kind of data from my database, but somehow all the select tags are getting populated properly??? I can’t see the content of a instance since no matter which variable I try to check in my page I always get the same data returned to me???

my question is: how is this data making its way to the proper select tag if the wrong data is being held in a variable with the worng data in it?

so after digging I found an answer to my question. How it happen is all data pulled out of a database is pulled through a PDO. This PDO is like a big pipe. inside that big pipe there are other pipes or instances of this PDO. when you do a var_dump on any of the variables that are holding the PDO instance you will see everything that travels inside the PDO instances in one big list. What I haven’t figured out yet though is why some of the PDO data is not showing for some instances but gladly does show for others.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.