dflow Posted April 9, 2010 Share Posted April 9, 2010 i would like to create an if else conditional what is the correct way to echo such code? <?php $CityID=$_GET['CityID']; if ($CityID<>"") { $colname_RsCityProductLoop = "-1"; if (isset($_GET['CityID'])) { $colname_RsCityProductLoop = $_GET['CityID']; } mysql_select_db($database_international, $international); $query_RsCityProductLoop = sprintf("SELECT products_NEW.ProductID, city_list.CityName_heb, products_NEW.Sleeps, products_NEW.Num_Bed_Rooms, products_NEW.Num_bathroom, products_NEW.kitchen_details, products_NEW.Parking_Space, products_NEW.Elevator, products_NEW.Floor, products_NEW.ProductImage_1, products_NEW.ShortProductDescription_heb,products_NEW.UnitPrice FROM products_NEW, city_list WHERE city_list.CityID =%s AND products_NEW.CityID =%s AND products_NEW.LangHEB =1 ORDER BY RAND( )", GetSQLValueString($colname_RsCityProductLoop, "int"),GetSQLValueString($colname_RsCityProductLoop, "int")); $query_limit_RsCityProductLoop = sprintf("%s LIMIT %d, %d", $query_RsCityProductLoop, $startRow_RsCityProductLoop, $maxRows_RsCityProductLoop); $RsCityProductLoop = mysql_query($query_limit_RsCityProductLoop, $international) or die(mysql_error()); $row_RsCityProductLoop = mysql_fetch_assoc($RsCityProductLoop); } else $CityName=$_GET['CityName']; { $colname_RsCityProductLoop = "-1"; if (isset($_GET['CityName'])) { $colname_RsCityProductLoop = $_GET['CityName']; } mysql_select_db($database_international, $international); $query_RsCityProductLoop = sprintf("SELECT products_NEW.ProductID, city_list.CityName_heb, products_NEW.Sleeps, products_NEW.Num_Bed_Rooms, products_NEW.Num_bathroom, products_NEW.kitchen_details, products_NEW.Parking_Space, products_NEW.Elevator, products_NEW.Floor, products_NEW.ProductImage_1, products_NEW.ShortProductDescription_heb,products_NEW.UnitPrice FROM products_NEW, city_list WHERE city_list.CityName=%s AND city_list.CityID=products_NEW.CityID AND products_NEW.LangHEB =1 ORDER BY RAND( )", GetSQLValueString($colname_RsCityProductLoop, "int"),GetSQLValueString($colname_RsCityProductLoop, "text")); $query_limit_RsCityProductLoop = sprintf("%s LIMIT %d, %d", $query_RsCityProductLoop, $startRow_RsCityProductLoop, $maxRows_RsCityProductLoop); $RsCityProductLoop = mysql_query($query_limit_RsCityProductLoop, $international) or die(mysql_error()); $row_RsCityProductLoop = mysql_fetch_assoc($RsCityProductLoop); } ?> Link to comment https://forums.phpfreaks.com/topic/198113-syntax-help/ Share on other sites More sharing options...
trq Posted April 9, 2010 Share Posted April 9, 2010 if ($expression) { // do something } else { // do something else } Link to comment https://forums.phpfreaks.com/topic/198113-syntax-help/#findComment-1039482 Share on other sites More sharing options...
dflow Posted April 9, 2010 Author Share Posted April 9, 2010 thanks it cleared things up Link to comment https://forums.phpfreaks.com/topic/198113-syntax-help/#findComment-1039716 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.