3
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by rajarajan07
0

As most people, I don't like downloading files from the internet without knowing what might be inside. Either explain your problem better, or post some code. A screenshot is useless.

~G

0

Hey you dont have values in the databse, thats why? if you avoided that then how could you display other things in that relevant row? if you want to show something instead of null then check with the loop for empty values and assign some string in that row while display.

Note: If you want to show one more screenshot, no need to start a new thread, attached in your already existing thread.

0

i cant attached document in existing thread. there is no option. "Insert Link" only available.

0

No you have to use the advanced editor for that. See guidelines. Okay. What about my queries regarding your issue?

0

additem.php

<script type="text/javascript">
function showUser(str)
{
if (str=="")
  {
  document.getElementById("txtHint").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","getite.php?q="+str,true);
xmlhttp.send();
}
</script>
</head>
<body>
<form action="getite.php">
<h3><a href="getitem.php">Add Item</a></h3><br/>

<?php
error_reporting(0);
    mysql_connect("localhost","root","");
    mysql_select_db("menus") or die(mysql_error());

$query="SELECT DISTINCT main FROM smenu";


$result = mysql_query ($query);
echo "<select name='sers' onchange='showUser(this.value)'>";
// printing the list box select command

while($nt=mysql_fetch_array($result)){
echo "<option value='$nt[main]'>$nt[main]</option>";



}

echo "</select>";


?> 
<div id="txtHint"><b>Items info will be listed here.</b></div>
</form>
</body>
</html>

getite.php

<?php
$q=$_GET["q"];
echo "$q";
error_reporting(0);
    mysql_connect("localhost","root","");
    mysql_select_db("menus") or die(mysql_error());


    $sql="SELECT * FROM smenu WHERE main = '".$q."'";

$result = mysql_query($sql);


         mysql_close($con);
         echo "<table width=800 border=1 cellspacing=2>";
        echo "<tr bgcolor=#ccccc>";
        echo " <th width=100 height=34 scope=col>Item</th>";
        echo "<th width=500 scope=col><div align=center>Description</div></th>";
        echo "<th width=300 scope=col><div align=center>Category</div></th>";
        echo "<th width=94 scope=col>Rate</th>";
        echo "<th width=94 scope=col>Order Item</th>";
        echo "</tr>";

         while($row=mysql_fetch_array($result))
         {
         echo "<tr><td align='center'>";
         echo $row['itemm']; 
         echo "</td><td align='left'>";
         echo $row['descrip'];
         echo "</td><td align='center'>";
         echo $row['Category'];
         echo "</td><td align='center'>";
         echo $row['Rate'];
         echo "</td><td align='center'>";
         echo "order this";

         }
         echo "</table>";

            ?>

</body>
</html>

If Click "order this", then the particular item goes to separate database. How to do this..

Edited by mike_2000_17: Fixed formatting

0
while($row=mysql_fetch_array($result))
{
echo "<tr><td align='center'>";
echo $row['itemm']; 
echo "</td><td align='left'>";
echo $row['descrip'];
echo "</td><td align='center'>";
$check = $row['Category'];
if ($check == ' '  or $check == Null)
	echo 'NILL';
else
	echo $row['Category'];
echo "</td><td align='center'>";
echo $row['Rate'];
echo "</td><td align='center'>";
echo "order this";

}
echo "</table>";
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.