Solved

PHP - progressing through recordset on one field but not another

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Wordpress French and English Site 6 78
How to obtain the string from a PHP StdObject ? 6 33
PHP Echo with auto submit 8 30
Use Select Query to Return Results as a Form 9 24
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
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.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

830 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