Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Konrad Pilch
Konrad Pilch
2,435 Points

PHP -> ?

HI,

What does means query($query) and as well as the arrow -> and i know that the LINE means that its happening in the current page, so if we have include, the file or whatever , will happend in the current page not in include files .

$results = $mysqli->query($query) or die($mysqli->error.__LINE__);

Basicaly the -> and as well why its query there ?

1 Answer

Here $mysqli is a object. A object is collection of variables and function in object variables are called properties and functions are called methods.

This $mysqli object also have some properties and method and query() is its method. To access the method or properties of object we have to use -> sign.

$mysqli->query() // its calls the query() method of $mysqli object. where object name comes before -> and method query() after -> sign.

Konrad Pilch
Konrad Pilch
2,435 Points

Okay, i got it better so what is in the $mysqli ? what collections are there? i do understand now the -> and the query() . And what is a query? i mean if i write query this is built in right? if if write query($dog), im passing a method called dog that stores it object as its weight, bread, height, name right?

I recommend you to first take OOP courses then it will be much clear to you.

Konrad Pilch
Konrad Pilch
2,435 Points

What are OOP courses? : p should i take the PHP and MySQL here on treehouse ? one that Randy is making the aplication even bigger? like the thrid step of it?

Yes you can go for mysql course there he will explain about abject.

Konrad Pilch
Konrad Pilch
2,435 Points

Okay, thank you for all the help. I really appreciate it . Too bad that the udemy guy doesnt talk about them in deep :( But hey! Treehouse is here! ^^ <3