Solved

PHP - progressing through recordset on one field but not another

Posted on 2007-03-22
3
177 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 20

Accepted Solution

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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
This article discusses how to implement server side field validation and display customized error messages to the client.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

752 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