I'm having a little bit of trouble with my PHP function. In the database I get 2 results back from my query. But my function is doing something else. It changes when I edit '=' to '=='
MySQL Query:
SELECT ContentPages.ContentPagesID, ContentType.ContentTypeName
FROM `ContentPages` INNER JOIN ContentType ON ContentPages.ContentTypeID = ContentType.ContentTypeID INNER JOIN ContentInformation ON ContentPages.ContentInformationID = ContentInformation.ContentInformationID
Result:
ContentPagesID ContentTypeName
01425d4a-2abd-11e4-b991-525400 products01
014269dd-2abd-11e4-b991-525400 information01
PHP Function:
function GetAllPages() {
$GetAllPagesSql = "SELECT ContentPages.ContentPagesID, ContentType.ContentTypeName FROM `ContentPages` INNER JOIN ContentType ON ContentPages.ContentTypeID = ContentType.ContentTypeID INNER JOIN ContentInformation ON ContentPages.ContentInformationID = ContentInformation.ContentInformationID";
$GetAllPagesQuery = mysql_query($GetAllPagesSql);
while (($GetAllPagesRow = \mysql_fetch_array($GetAllPagesQuery)) != false) {
if($GetAllPagesRow[ContentTypeName] === 'product01') {
DisplayProducts01DesignFunction();
}
else if ($GetAllPagesRow[ContentTypeName] === 'information01') {
DisplayInformation01DesignFunction();
}
}
}
When I change:
if($GetAllPagesRow[ContentTypeName] = 'product01') {
DisplayProducts01DesignFunction();
}
else if ($GetAllPagesRow[ContentTypeName] = 'information01') {
DisplayInformation01DesignFunction();
}
To this:
if($GetAllPagesRow[ContentTypeName] === 'product01') {
DisplayProducts01DesignFunction();
}
else if ($GetAllPagesRow[ContentTypeName] === 'information01') {
DisplayInformation01DesignFunction();
}
It goes from showing function DisplayProducts01DesignFunction()
twice to DisplayInformation01DesignFunction()
once.
Any ideas on how to fix this?