Solved

PHP - progressing through recordset on one field but not another

Posted on 2007-03-22
3
172 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

932 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

10 Experts available now in Live!

Get 1:1 Help Now