passing value from one page to another but it shows error message when it does query with this value in PHP and mySQL -


in php passed value through url 1 page other page, on other page use $_request variable value , get, when write sqlquery not get, if check value var_dump() method.. shows boolean(false).solve please

page1:

<strike>  <select onchange="location=this.value">  <option value="adminviewcontact" active>view contact group</option>   <?php     while($row=mysql_fetch_array($result1))    {     echo ' <option value="userviewcontactgroup.php?    id='.$row['user_id'].' &&  var='.$row['rel_name'].'   ">'.$row['rel_name'].'</option> ';                                            } ?>   </select> </strike> 

page2:

<strike> <?php   if(isset($_request['id']) && isset($_request['var']))  {   $id= $_request['id'] ;   $relation1= $_request['var'] ;  }  $query1 = "select * tbl_contact st_contact_id=$id ,    rel_status==$relation1 "; ?> </strike> 

this while loop use retrive database value not work.:

<?php  $query1 = "select * tbl_contact st_contact_id=$id , rel_status='$relation1' "; $result1 = mysql_query($query1); while($row = mysql_fetch_array($result1)) {        $i++; ?> <tr class="info">     <td><?php  echo $i ; ?></td>     <td><?php  echo $row['firststname']; ?></td>     <td><?php  echo $row['lastname']; ?></td>     <td><?php  echo $row['address']; ?></td>     <td><?php  echo $row['email']; ?></td>     <td><?php  echo $row['contact_date']; ?</td>     <td><?php  echo $row['phone']; ?></td> </tr> <?php                    }                                                ?> 

1. rel_status==$relation1 wrong in sql.

you must use rel_status='$relation1'.

and think problem solve.

2. should replace

echo ' <option value="userviewcontactgroup.php? id='.$row['user_id'].' && var='.$row['rel_name'].' ">'.$row['rel_name'].'</option> ';

with:

echo "<option value='userviewcontactgroup.php?id=".$row['user_id'].'& var='.$row['rel_name']."'>".$row['rel_name']."</option>";


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -