SQL Server Developer Center >
SQL Server Forums
>
SQL Server Driver for PHP
>
how to solve my problem??
how to solve my problem??
- i think the problem is from my table... anybody can help me please?
its very important.. the insert query not have a problem because i already test it using command promt and successfull.. after i aplly it into my form.. its cannot function. and this my fisrt new database using.. postgre, using php...
//this my form//
<form action="f_loan_sport.php" method="post" name="myForm" class="style4">
<td><p align="center" class="style4"> </p>
<div align="left"> <br>
<table width="386" border="0">
<tr>
<td width="157">Select Your Item Borrow:</td>
<td width="124"><select name="choose_equ" id="choose_equ">
<option>-SELECT-</option>
<option value="B">BADMINTON</option>
<option value="BJ">BOLA JARING</option>
<option value="T">TENNIS</option>
<option value="BS">BOLA SEPAK</option>
<option value="BL">BOLA BALING</option>
<option value="BK">BOLA KERANJANG</option>
<option value="H">HOKI</option>
<option value="KB">KEPERLUAN BILIK</option>
</select></td>
<td width="83" bgcolor="#FFFFFF"><input type="submit" name="Submit" value="SELECT" ></td>
</tr>
<tr>
<td>Date Borrow:</td>
<td><input id=MyDate name=MyDate type="text" size=15 > <a href="JavaScript:;" onClick="toggleCalendar('MyDate')"><img src="images/cal.gif" width="28" height="27" border="0"></a></td>
</tr>
</table>
<?php
session_start();
$stud_id=$_SESSION['stud_id'];
$stud_name=$_SESSION['stud_name'];
$dbh = pg_connect("host=localhost dbname=laon user=postgres password=zuraihanim");
if(isset($_POST['Submit'])){
$choose_equ=$_POST['choose_equ'];
}
$sql = "SELECT * FROM equ_detail where equ_type_detail = '$choose_equ' ORDER BY equ_name , equ_se_num ASC ";
echo "<table border=0 >";
$result1 = pg_query($sql);
echo $stud_id;
echo "<tr bgcolor='#FFFF33'><th > |-No-| </th><th> |-Item Equipment-|</th><th>|-Series Item-| </th><th>|- Check-| </th></tr>";
while ($row = pg_fetch_array($result1))
{
$loan = ++$loan;
echo "<tr>";
echo "<td bgcolor='#FFFF99' cellpadding='0' cellspacing='0'>" .$loan. "</td>";
// echo "<input type='hidden' name='equ_id' id='equ_id' value='$equ_id' >";
echo "<td bgcolor='#FFFF99' cellpadding='0' cellspacing='0'>". "<input name='equ_name' id='equ_name' type='text' value='$row[equ_name]' readonly>" ."</td>";
echo "<td bgcolor='#FFFF99' cellpadding='0' cellspacing='0'>". "<input name='equ_se_num' id='equ_se_num' size='7' type='text' value='$row[equ_se_num]' readonly >" ."</td>";
echo "<td bgcolor='#FFFF99' cellpadding='0' cellspacing='0'>". "<input type='checkbox' name='check1[]' id='check1' size='7' value='yes' readonly>" ."</td>";
echo "</tr>";
}
echo "</table>";
echo "<INPUT type='button' value='SAVE' name=button2 onclick='return OnButton2();'>";
echo "<input type='reset' name='Reset' value='RESET'>";
pg_free_result($result1);
pg_close($dbh);
require "n_call";
?>
//form finish//
//insert query
<?php
session_start();
$stud_id = pg_escape_string($_POST['stud_id']);
$loan_id = pg_escape_string($_POST['loan_id']);
$dbconn = pg_connect ("host=localhost dbname=laon user=postgres password=zuraihanim");
$loan_id =0;
if(isset($_POST['Submit']))
{
$loan_id=$_POST['loan_id'];
$equ_name=$_POST['equ_name'];
$equ_se_num=$_POST['equ_se_num'];
$check1=$_POST['check1'];
?>
<html>
<style type="text/css">
<!--
.style4 {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
-->
<script language="Javascript1.2">
<!--
function printpage() {
window.print();
}
//-->
</script>
</style>
<body onload="printpage()">
<div align="center">
<table width="748" height="269" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><img src="images/banner1.jpg" width="800" height="150"></td>
</tr>
<tr>
<td class="style4"><div align="center"><span class="style4"><br>
<br>
<?php
echo $stud_id;
echo "<table border=0 >";
echo "<font size=12 span class='style4'> ".'List Equipment That You Want To Borrow'."</font>".'<br>'.'<br>';
echo "<tr bgcolor='#FFFF33' size=12 span class='style4'><th > |-No.-| </th><th> |-Item Equipment-|</th><th>|-Series Item-| </th><th>|- Date Borrow-| </th></tr>";
foreach($check1 as $cValue)
{
$sql=pg_query("INSERT INTO loan_detail(loan_id,equ_name,equ_se_num,check1) VALUES ('".$loan_id."','".$equ_name."','".$equ_se_num."','".$check1."')");
$result=mysql_query($sql);
}
$ty++;
echo "<tr>";
echo "<td bgcolor='#FFFF99' cellpadding='0' cellspacing='0'>". $ty. "</td>";
echo "<input type='hidden' name='loan_id' id='loan_id' value='loan_id'>";
echo "<td bgcolor='#FFFF99' cellpadding='0' cellspacing='0'>". "<input name='equ_name' id='equ_name' type='text' value='$equ_name' readonly >" ."</td>";
echo "<td bgcolor='#FFFF99' cellpadding='0' cellspacing='0' >". "<input name='equ_se_num' id='equ_se_num' type='text' value='$equ_se_num' size='7' readonly >" ."</td>";
echo "</tr>";
echo "</table>";
echo '<br>';
echo '<br>';
echo "<a href='JavaScript:window.print();'>Print</a>";
pg_close();
require "n_call";
?>
</span> </div>
<p> </p>
<div align="center"></div></td>
</tr>
<tr>
<td><div align="center"><img src="images/footer.jpg" width="650" height="75"></div></td>
</tr>
</table>
</div>
//insert query finish..
Answers
We would like to help, but we are not familiar with either Progress or MySql drivers for PHP. This forum is dedicated to the Microsoft SQL Server Driver for PHP.
Thank you,
Serban
Serban Iliescu - MSFT- Marked As Answer bySerban Iliescu - MSFTAnswererWednesday, October 28, 2009 12:10 AM
All Replies
We would like to help, but we are not familiar with either Progress or MySql drivers for PHP. This forum is dedicated to the Microsoft SQL Server Driver for PHP.
Thank you,
Serban
Serban Iliescu - MSFT- Marked As Answer bySerban Iliescu - MSFTAnswererWednesday, October 28, 2009 12:10 AM


