Solved

PHP - progressing through recordset on one field but not another

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

Technology Partners: 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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to implement server side field validation and display customized error messages to the client.
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 count occurrences of each item in an array.

631 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