How to use image definition in SQL query?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • antoine1987
    New Member
    • Aug 2010
    • 5

    How to use image definition in SQL query?

    hi,

    please i need some help;


    i have a "for" function that create for each ip address found in the database an image button having a name="the ip address". this is the code:

    <?php
    $query = mysql_query("SE LECT * FROM site_status");
    $number= mysql_num_rows( $query);

    for ($i=0; $i<$number; $i++){
    $row[$i] = mysql_fetch_ass oc($query);
    ?>

    in HTML :

    <input type="image" src="./images/bat.png" border="0" alt="<?php echo $row[$i]["CSTip"];?>" name="<?php echo $row[$i]["CSTip"];?>" width="80" height="90" onClick="window .open('real_tim e_graph-v1.php','Qualit y_Graph','width =1000,height=50 0,resizable=yes ,scrollbars=yes ')" />


    when i click on an image; i ll redirect to the file
    real_time_graph-v1.php where i have an SQL query:

    $voltage_query = "SELECT volt FROM volt_table where CSTip='%NAME_VA LUE%'and date='%CSXdate% '";


    the NAME_VALUE should be the name of the image where i clicked(or any identity of the clicked image)

    i dont know how to write this :( !!!!
  • johny10151981
    Top Contributor
    • Jan 2010
    • 1059

    #2
    Code:
    window.open('real_time_graph-v1.php?CSTip=<?=$row[$i]["CSTip"]?>','Quality_Graph','width=1000,height=500,res izable=yes,scrollbars=yes')
    please encode $row[$i]["CSTip"] properly

    and in real_time_graph-v1.php file add the below code

    Code:
     if(isset($_GET['CSTip'])==fase)
     {
      echo "Unexpected access";
      exit;
     }
    
    $CSTip=$_GET['CSTip'];
    $voltage_query = "SELECT volt FROM volt_table where CSTip='%".$CSTip."%'and date='%CSXdate%'";

    Comment

    Working...