Solved

PHP - progressing through recordset on one field but not another

Posted on 2007-03-22
3
171 Views
Last Modified: 2008-03-06
I have a PHP iteration that is failing:

$propType = $row["property_type"];
$typeQuery = "select type_id, property_type from property_type_ids order by type_id asc";
$typeRS = connect_to_database($typeQuery);
      while ($typerow = mysql_fetch_array($typeRS))
                        {
                        $propTypeB = $typerow["property_type"];
                        $typeID = $typerow["type_id"];
                        if($typeID=$propType){
                                    echo $typeID.'='.$propType.' '.$propTypeB.'<br/>';

                              } else {
                                    echo $typeID.'<>'.$propType.'<br/>';                                          
                              }
                        
                        }


The $propType variable is pulling a value from the database (the property id selected) then going through the table with the ID (type_id) and the name of that property (property_type).

Without the "if" statement, it iterates through the records fine. But with the If, it continues to progress through the names - propTypeB, but stops progressing the type_id.

I am totally at a loss as to why this is happening.
0
Comment
Question by:bsowards
3 Comments
 
LVL 20

Accepted Solution

by:
steelseth12 earned 500 total points
ID: 18773505
it should be  if($typeID==$propType){
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now