Jump to content

php data filtering from DB


girtskazus

Recommended Posts

Hi, I have an issue, I cant filter my data from DB. Whats wrong in my code?

<?php
/* Include Files *********************/
//include("banners/database.php");
mysql_connect("host", "user", "pwd") or die("Connection Failed");
mysql_select_db("DB")or die("Connection Failed");
?>
<?php
$memberIndustries =['memberIndustries'];
if (isset($_POST["memberIndustries"])) {
$memberIndustries = mysql_real_escape_string ($_POST["memberIndustries"]);
$sql="SELECT * FROM Members WHERE Industries_Industry_ID='$memberIndustries'";
$result = mysql_query($sql) or die (mysql_error());
   
while ($myrowe = mysql_fetch_array($result)) {?>
   <? // if new member, label it 
   //$todays_date = date("Y-m-d");
   //$dateCompare = $myrowe[Creation_Date]+30;
   //$dateCompare = strtotime(date("Y-m-d", strtotime($myrowe[Creation_Date])) . " +30 days");
   //if(strtotime($todays_date)<=$dateCompare){
   ?>
   <table width="100%">
   <tr>
   <td align="right">
            <img src="/members/new.gif">
   </td>
   </tr>
   </table>
   <? //}?>
   
   <? if($myrowe[LOGO_lnk]!='') {?>
   <img src="<? echo $myrowe[LOGO_lnk]; ?>">
   <? } ?>
   <br /> <br /> 
   <font style="font-family: Arial; font-size: 10.5pt; font-weight:bold;color:#C1121F">
   <? echo $myrowe[Company_Title];?>
   </font>
   <? if($myrowe[Person_Name_1]!='') {?>
   <br />
   <font style="font-family: Arial; font-size: 8.5pt; font-weight:bold;color:#000000"><? echo $myrowe[Person_Name_1];?></font>
   <font style="font-family: Arial; font-size: 8.5pt; font-weight:bold;color:#000000"><? echo $myrowe[Person_Title_1];?></font>
   <? } 
   if($myrowe[Person_Name_2]!='') {?>
   <br />
   <font style="font-family: Arial; font-size: 8.5pt; font-weight:bold;color:#000000"><? echo $myrowe[Person_Name_2];?></font>
   <font style="font-family: Arial; font-size: 8.5pt; font-weight:bold;color:#000000"><? echo $myrowe[Person_Title_2];?></font>
   <? } 
   if($myrowe[Person_Name_2]!='') {?>
   <br />
   <font style="font-family: Arial; font-size: 8.5pt; font-weight:bold;color:#000000"><? echo $myrowe[Person_Name_3];?></font>
   <font style="font-family: Arial; font-size: 8.5pt; font-weight:bold;color:#000000"><? echo $myrowe[Person_Title_3];?></font>
   <? } 
   if($myrowe[Address_row1]!='') {?>
   <br />
   <font style="font-family: Arial; font-size: 8.5pt; color:#000000"><? echo $myrowe[Address_row1];?></font>
   <? } 
   if($myrowe[Address_row_2]!='') {?>
   <br />
   <font style="font-family: Arial; font-size: 8.5pt; color:#000000"><? echo $myrowe[Address_row_2];?></font>
   <? } 
   if($myrowe[Address_row_3]!='') {?>
   <br />
   <font style="font-family: Arial; font-size: 8.5pt; color:#000000"><? echo $myrowe[Address_row_3];?></font>
   <? } 
   if($myrowe[Phone]!='') {?>
   <br />
   <font style="font-family: Arial; font-size: 8.5pt; color:#000000">Tel:<? echo $myrowe[Phone];?></font>
   <? } 
   if($myrowe[Fax]!='') {?>
   <br />
   <font style="font-family: Arial; font-size: 8.5pt; color:#000000">Fax:<? echo $myrowe[Fax];?></font>
   <? } 
   if($myrowe[email]!='') {?>
   <br />
   <a href="mailto:<? echo $myrowe[email];?>">
   <font style="font-family: Arial; font-size: 8.5pt; color:#000000"><? echo $myrowe[email];?></font>
   </a>
   <? } 
   if($myrowe[web]!='') {?>
   <br />
   <a href="<? echo $myrowe[web];?>"target="_blank">
   <font style="font-family: Arial; font-size: 8.5pt; color:#000000"><? echo $myrowe[web];?></font>
   </a>
   <? } 
   if($myrowe[industries_Industry_ID]!=0) {
      $queryInd = "SELECT Industry_Title FROM Industries WHERE Industry_ID=$myrowe[industries_Industry_ID]";
      $resultInd = mysql_query($queryInd) or die (mysql_error());
      $myroweIND = mysql_fetch_array($resultInd)
   ?>
   <br />
   <font style="font-family: Arial; font-size: 8.5pt; color:#000000"><? echo $myroweIND[industry_Title];?></font>
   <? } 
   if($myrowe[Description]!='') {?>
   <br />
   <font style="font-family: Arial; font-size: 8.5pt; color:#000000"><? echo $myrowe[Description];?></font><p></p>
   <? } ?>
   <br /><br />
<? } 
<? }} ?>


Link to comment
https://forums.phpfreaks.com/topic/228702-php-data-filtering-from-db/
Share on other sites

start with the following, then repost the code for the search page:

turn error reporting on, change this line:

$memberIndustries =['memberIndustries'];

to

[php$memberIndustries =$_POST['memberIndustries'];[/code]

stop using short tags "<?" and learn how to echo rather then constantly breaking out of script.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.