Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

shiv sandhu
seal-mask
.a{fill-rule:evenodd;}techdegree
shiv sandhu
Full Stack JavaScript Techdegree Student 9,105 Points

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?

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?

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