i want to insert bid price with product title,bidding time ,username into table wherever title and bidding time is not into a input form and username is session.plz help.i m not geting solution even i tried a lot.
<?php
// check that the session variable does exist
// check that the user 'LoggedIn' has been set to 1 (true)
if (!isset($_SESSION['userName']) && $_SESSION['userName'] != 1)
{
$username= $_SESSION['userName'];
header("Location: logindetail.php?redir=detailproduct.php?username=$username");
?>
<?php
}
else
{
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("gunjanbid", $con);
$result = mysql_query("SELECT * FROM bids WHERE id = $_GET[id]");
//$query=mysql_query("SELECT * FROM bid
$numrow = mysql_num_rows($result);
if ($numrow == 0)
{
die('No record found.');
}
$row=mysql_fetch_array($result);
$closedate = date_format(date_create($row[2]), 'm/d/Y H:i:s');
?>
<table border="0" cellpadding="0.1">
<tr>
<td height="52"><div id="title"><?php echo $row[1];?> </div></td>
</tr>
<tr>
<td><div id="clock"><table><tr><td style="font-size:18px;text-align:center; padding-left:25px;">Days Hr Min Sec</td></tr><tr><td style="font-size:32px; font:bold; text- align:center;padding-left:30px;">
<div id="counter1">
<div class="box days">0</div>
<div class="box hours">0</div>
<div class="box minutes">0</div>
<div class="box seconds">0</div>
</div>
<script> cdtd("#counter1",new Date("<?php echo $closedate; ?>"));</script>
</td></tr></table></div></td>
</tr>
<tr>
<td style="padding-left:45px;">Single Bid eg. (1.23)</td>
</tr>
<tr>
<td ><table><tr><td>Rs.</td><td> </td><td>
<?php
/*$con=mysql_connect("localhost","root","","database");
// Check connection
if (mysql_error())
{
echo "Failed to connect to MySQL: " . mysql_error();
}*/
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("gunjanbid", $con) or DIE('Database name is not available!');;
if(isset($_POST['submit']))
{
function check_input($value)
{
// Stripslashes
if (get_magic_quotes_gpc())
{
$value = stripslashes($value);
}
// Quote if not a number
if (!is_numeric($value))
{
$value = "" . mysql_real_escape_string($value) . "";
}
return $value;
}
//$f=check_input($_POST['$title']);
//$m=check_input($_POST['$closedate']);
$l=check_input($_POST['bid1']);
//$u=$_POST['userName'];
//$p=$_POST['passWord'];
//$g=check_input($_POST['bid2']);
//$g1=check_input($_POST['bid3']);
//$c=implode($_POST['newsletter']);
//$username=$_SESSION['userName'];
//$u=check_input($_POST['$username']);
/*$sql="INSERT INTO bid ( product,date,bid1,bid2,bid3,userName
)
VALUES (
(SELECT id,description,
closing_date
FROM bids
ORDER BY id ASC),'$l','$g','$g1','$u')";*/
$sql="INSERT INTO biden(bid1)VALUES('$l')";
//$sql1="INSERT INTO bident(bid2,bid3)VALUES('$g','$g1')";
$result=mysql_query($sql) or die ("Could not insert data into DB: " . mysql_error());
//$query=mysql_query($sql1) or die ("Could not insert data into DB: " . mysql_error());
if($result!=1)
{
echo"failure!";
}
/*if($query!=1)
{
echo"failure!";
}*/
}
?>
<form action="" method="post"><input name="bid1" type="text" size="5" /></td> <td> </td><td><input type="submit" value="Bid Now"></form></td><td style="padding- left:90px;" ><div class="dhtmlgoodies_question"><img src="image/more.png" alt="more" /> </div>
div class="dhtmlgoodies_answer">
<div>
<table border="0" cellpadding="0.1">
<tr>
<td><table><td>Rs.</td><td> </td><td><form action="auctionbid.php" method="post"><input name="bid2" type="text" size="5" /></td><td> </td></table></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><table><td>Rs.</td><td> </td><td><input name="bid3" type="text" size="5" /><input type="submit" value="Bid Now"></form></td><td> </td></table></td>
</tr>
</table>
</div>
</div>
</td> </table></td>
</tr>
<tr>
<td style=padding-left:45px;>Multiple Bid (Max100) ?</td>
</tr>
<tr>
<td style="padding-left:45px;"><table><td>Rs.</td><td> </td><td><form action="auctionbid.php" method="post"><input name="bid4" type="text" size="5" /> to <input name="bid5" type="text" size="5" /></td><td> </td> <td><input type="submit" value="Bid Now"></form></td>
</table></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td style="padding-left:45px;">Lowest Unique Bidder :</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<?php } ?>
</div><!----left end---->
<div id="right">
<table border="0" cellpadding="0.1">
<tr>
<td><img src="productimage/1/001.jpg" width="405" height="300" style="padding- top:5px; padding-left:5px; padding-right:5px;"alt="image" /></td>
</tr>
<tr>
<td><table border="0" cellpadding="0.1" style="padding-left:5px; margin- top:15px;">
<tr>
<td><p><a href="productimage/1/001.jpg " rel="thumbnail" title="This is product for sale!"><img src="productimage/1/1.1.jpg" style="width: 70px; height: 60px" /> </a></p></td>
<td> </td>
<td><p><a href="productimage/1/002.jpg" rel="thumbnail"><img src="productimage/1/1.2.jpg" style="width: 70px; height: 60px" /></a></p></td>
<td> </td>
<td><p><a href="productimage/1/003.jpg" rel="thumbnail"><img src="productimage/1/1.3.jpg" style="width: 70px; height: 60px" /></a></p></td>
</tr>
</table></td>
</tr>
</table>
此处即尝试用户已登录其中有$ _session [&#39; userName&#39;]并输入出价值,该出价值应存储在表格中,其中包含产品标题,出价时间,用户名和出价值,其中出价值为输入和用户名是$ _session [&#39; userName&#39;]和tilte,从另一个表插入出价。我试过的东西是评论的,所以请看看它并帮助我。我是新来的。&#39;&#39;