mysql_query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello all,

Not sure what I am doing wrong.

I have a simple form that populate the variables in a mysql query. I
know the selected values are making it to the form porcessing script
because I can echo them on the processing script as indicated below.

You Selected Cell_Sect = 1_1
You Selected Date = 03/10/11 18:15
You Selected Market = MCI

For some reason the above is all I am getting when I submit my form.

I beleive it has somthing to do with my results query below.

$result = mysql_query("select * FROM evdo WHERE Market like '%$term'
and Cell_Sect = '$cat' and Date = '$subcat' LIMIT 10");

Beow is my whole script for processing the form in case it maybe something else.

Thanks,

Chris


<!doctype html public "-//w3c//dtd html 3.2//en">

<html>
<?php

// database access parameters
$dbservertype='mysql';
$servername= left out for privacy;
// username and password to log onto db server
$dbusername='$$$$';
$dbpassword='$$$$';
// name of database
$dbname='pcmd';

connecttodb($servername,$dbname,$dbusername,$dbpassword);
function connecttodb($servername,$dbname,$dbuser,$dbpassword)
{
global $link;
$link=mysql_connect ("$servername","$dbuser","$dbpassword");
if(!$link){
die('Could not conect: ' . mysql_error());
}
echo 'YOU ARE CONNECTED TO PCMD DATABASE';

mysql_select_db("$dbname",$link) or die ("could not open db".mysql_error());
}
//////// End of connecting to database ////////
?>
<!<!DOCTYPE HTML PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN'
'http://www.w3.org/TR/xhtml1-transitional.dtd'>
<head>
<title>Demo Multiple drop down list box for PCMD data</title>
<style type="text/css" >
  TABLE {
     border: 1px solid #98bf21;
     border-collapse:collapse;
  }

  TH {
     border: 1px solid #98bf21;
     padding-bottom: 4px;
     padding-left: 7px:
     padding-right: 7px;
     padding-top: 5px;
     font-size: 1.2em;
     background-color:limegreen;
     color: white;
     text-align: left;
  }

  TD {
     border: 1px solid #98bf21;
     padding-bottom: 2px;
     padding-left: 7px:
     padding-right: 7px;
     padding-top: 3px;
     font-size: 1.0em;
  }

  TR.alt TD {
  background-color: #eaf2d3;

  }

</style>
<meta name="GENERATOR" content="Arachnophilia 4.0">
<meta name="FORMATTER" content="Arachnophilia 4.0">
</head>

<body>
<?php
$cat=$_POST['cat'];
$subcat=$_POST['subcat'];
$term=$_POST['term'];

$result = mysql_query("select * FROM evdo WHERE Market like '%$term'
and Cell_Sect = '$cat' and Date = '$subcat' LIMIT 10");


$firstRow=1;
$rowNum = 0;
echo "<table>";
while($row = mysql_fetch_assoc($result)) {
   if($firstRow == 1) {
      echo "<tr>";

      foreach($row as $key => $value) {
          echo "<th>" . $key . "</th>";
      }
      echo "</tr><tr>";
      $firstRow=0;
      $rowNum++;
   }
   else {
      if(  ($rowNum++ % 2) == 1) {
         echo "<tr class=\"alt\">";
      } else {
         echo "<tr>";
      }
   }
   foreach($row as $key => $value ) {
       echo "<td>" . $value . "</td>"  ;
   }
   echo "</tr>";
}
echo "</table>";

echo "You Selected Cell_Sect = $cat <br>You Selected Date =
$subcat<br>You Selected Market = $term";


?>

</body>

</html>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux