Jump to content

Archived

This topic is now archived and is closed to further replies.

hc

PHP syntax

Recommended Posts

I am in a bit of a bind, and am hoping someone would take a few minutes to explain this syntax. Basically, I responded to an ad and got hired. They said they needed an MS Access, ASP Programmer, and this is what I got handed to work on. So, I just want to know what this syntax is, particluarly the bolded parts. Any help would be appreciated. I understand that it returns an array of values, but what do the <<< and -> mean?? Thanks...I know this is simple stuff

function GetEmployers()
{
$retval = false;
$sqlstr = [b]<<<[/b] SQL
SELECT
emp.id,
emp.employer,
sport.id AS job_type_id,
sport.name AS jobtype
FROM
businesses.employers AS emp
LEFT JOIN
master.sports AS sport ON
sport.id = emp.sport_id
WHERE
emp.status_id = 1
ORDER BY
emp.employer
SQL;
if([b]$this->Load[/b]($sqlstr))
{
while($row = $this->db->fetch())
{
$retval[] = $row;
}
}
return $retval;
} // GetEmployers()

Share this post


Link to post
Share on other sites
The -> is php equivelent of asp's . If youve worked with objects in asp then its exactly the same. Instead of...

[code]
if rs.eof then
[/code]

php would be...

[code]
if ($rs->eof) {
[/code]

Share this post


Link to post
Share on other sites
thank you. Thats all I needed. I have been using ASP and .NET for years, and just got this thrown on me. I just needed a quick crash course. I appreciate the help. Thanks

Share this post


Link to post
Share on other sites
[code]

<?php

function db(){  
   
$query = " SELECT emp.id,emp.employer,sport.id AS job_type_id,sport.name AS jobtype FROM businesses.employers AS emp LEFT JOIN
master.sports AS sport ON sport.id = emp.sport_id WHERE emp.status_id = 1 ORDER BY emp.employer";

$result=mysql_query($query);

while($row = mysql_fetch($result) ) {
           $retval[] = $row;
        }
     }
     return $db;
  ?> 
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.