1

Hi friends,

I get some error for storing into database. I given that coding.any body know pls say to me.

accep.php

<?php


         $check=$_REQUEST['submit'];
        mysql_connect("localhost","root","");
        mysql_select_db("menus") or die(mysql_error());

         $projectid=$_REQUEST['pid'];
          $projectname= $_REQUEST['pname'];
         $projectcat=  $_REQUEST['pcat'];
         $scope=$_REQUEST['psco'];
         $location=$_REQUEST['plo'];
         $rate=$_REQUEST['prate'];



           $query="insert into order values('$projectid','$projectname','$projectcat','$scope','$location','$rate')";
           $dbase=mysql_query($query) or die(mysql_error());
                 if($dbase==TRUE)
                   {
                   include("congrat.php");
                   }



?>

Detail.php

<body>
<h3> <a href="additem.php">View Menu</a></h3>
  <form id="form1" name="form1" method="post" action="accep.php">
    <?php

    mysql_connect("localhost","root","");
    mysql_select_db("menus") or die(mysql_error());


    $idvalue=$_REQUEST['id'];




     $result=mysql_query("select * from smenu where id='$idvalue'");

         while($row=mysql_fetch_array($result))
         {

         $projectid=$row['id'];
         $projectname= $row['main'];
         $projectcat=  $row['itemm'];
         $scope=$row['descrip'];
         $location=$row['Category'];
         $rate=$row['Rate'];

         }
         echo "<input type='hidden' value=".$projectid." name=pid>";
         echo "<input type='hidden' value=".$projectname." name=pname>";
         echo "<input type='hidden' value=".$projectcat." name=pcat>";
         echo "<input type='hidden' value=".$scope." name=psco>";
         echo "<input type='hidden' value=".$location." name=plo>";
         echo "<input type='hidden' value=".$rate." name=prate>";


        /*
          echo " project name is $projectname";
         if($check==="Request for this")
         {
         echo " project id is $projectid <br>";
         echo "check value is $check"; 
         }*/
?>

                    <table width="380" height="363" border="0" align="center" cellpadding="4" cellspacing="3" >
                      <tr>
                        <td width="135">Item Id </td>
                        <td width="211"><?php  echo $projectid; ?></td>
                      </tr>
                      <tr>
                        <td>Main Item </td>
                        <td><?php  echo $projectname; ?></td>
                      </tr>
                      <tr>
                        <td>Item Name</td>
                        <td><?php  echo $projectcat; ?></td>
                      </tr>

                      <tr>
                        <td height="83">Description</td>
                        <td><?php  echo $scope; ?></td>
                      </tr>
                       <tr>
                        <td height="83">Category</td>
                        <td><?php  echo $location; ?></td>
                      </tr>
                       <tr>
                        <td>Rate</td>
                        <td><?php  echo $rate; ?></td>
                      </tr>

                      <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                      </tr>
                      <tr>
                        <td>&nbsp;</td>
                        <td><input name="submit" type="submit" id="submit" value="Order this" /></td>
                      </tr>
                    </table>

Edited by mike_2000_17: Fixed formatting

4
Contributors
10
Replies
11
Views
7 Years
Discussion Span
Last Post by rajarajan07
0

Notice: Undefined index: plo in C:\wamp\www\data\accep.php on line 19
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order values('1','starters','Edamame','Steamed','','4.95')' at line 1

0

I got this error message

Notice: Undefined index: plo in C:\wamp\www\data\accep.php on line 19
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order values('1','starters','Edamame','Steamed','','4.95')' at line 1

0

The syntax works properly for me, The fact is as utrivedi said Order is an keyword in sql instead of that anything works.

0

Really very thanks frnds. I got error when I insert empty field into table.

0

Always mention the error, what you get?. I think you have set not null for a field in a table and trying to input null value to that field. thats why?

0

But still i didn't get an idea that how you have resolved this so its my request to raja that please elaborate it.

0

I couldn't understand what u mean, but here I want to say already the code is written in a well manner, because of an sql keyword the code doesn't works. He removed the keyword and replaced with somename. the code worked.

Edited by rajarajan07: n/a

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.