Skip site navigation (1) Skip section navigation (2)

select * from table not showing everything

From: Richard Dunne <richarddunne1971(at)yahoo(dot)com>
To: pgsql-php(at)postgresql(dot)org
Subject: select * from table not showing everything
Date: 2007-04-28 14:09:14
Message-ID: 99437.76872.qm@web50303.mail.re2.yahoo.com (view raw or flat)
Thread:
Lists: pgsql-php
I am using a php script via an xmlhttprequest to insert data into a postgresql table from a php web page form.  before submitting the form data, I had 1 entry in my table.  after submitting the form data, I ran a select * from table query which declared there were 2 entries in the table, but it only displayed the original entry.  Is this a know issue?  If this is not the corect forum for this post, please advise.

This is the code.  

php web page

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<? include("http://localhost/Databases/getCustomers.php") ?>
<HTML>
 <HEAD>
  <TITLE> ALLIED AUTO PARTS </TITLE>
  <meta http-equiv="content-type" content="text/xml; charset=iso-8859-1">
  <META NAME="Generator" CONTENT="EditPlus">
  <META NAME="Author" CONTENT="">
  <META NAME="Keywords" CONTENT="">
  <script language="JavaScript">
function Customers()
{ 
var url="http://localhost/Project/customers.php"; 
if(window.XMLHttpRequest)
http = new XMLHttpRequest(); 
else if (window.ActiveXObject)
http  = new ActiveXObject(Microsoft.XMLHTTP); 
http.onreadystatechange = function()
{ 
alert(http.readyState);
if(http.readyState == 4)
{
alert(http.status)
if(http.status == 200)
{
 response = http.responseText;
 alert(response);
}    
else    
{
// + " " + http.statusText;
alert(http.status);
}    
} 
}
http.open("GET", url, true); 
http.setRequestHeader("text"); 
http.send(null); 
} 
</script>
  </HEAD>
    <BODY>
 <p align="center">
 <form action="viewCustomer.php">
 <input type="button" value="View Customers" onclick="return Customers();" />
 </form>
 <script type="text/javascript" language="javascript">
 var numfields;
 var numrows;
 function viewCustomers()
 {
  document.write('<tr>');
  for (i=0; i < numfields; i++)
   {
   document.write('<td>' + fieldname[i] + '</td>');
   }
  document.write('</tr>');
 }
 for (i=0; i < numrows; i++)
  {
  document.write('<tr>');
  for (j=0; j < numfields; j++)
   {
   document.write('<td>' + customers[i][j] + '</td>');
   }
  document.write('</tr>');
   }
 </script>
 <p>
 <p>
 <TABLE align="center">
<TR>
 <TD align="center" colspan="6"><H3>Choose from the following funtions</H3></TD>
</TR>
<TR>
 <TD><a href="ViewParts.php">View Parts</a></TD>
 <TD><a href="Purchases.php">Purchases</a></TD>
 <TD><a href="Sales.php">Sales</a></TD>
 <TD><a href="UpdateParts.php">Add parts</a></TD>
 <TD><a href="UpdateCustomer.php">Update Customer</a></TD>
 <TD><a href="UpdateSupplier.php">Update Supplier</a></TD>
</TR>
</TABLE>
 </BODY>
</HTML>


php script for inserting form data

<?php 
$connect=pg_connect("dbname=DatabaseName host=localhost user=User password=password");
if (!pg_connection_busy($connect))
 {
 $result=pg_query($connect, "insert into customer values('$customer_name', '$customer_address', '$customer_contact_no')");
 }
 echo "New customer added";
?>

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Responses

pgsql-php by date

Next:From: John DeSoiDate: 2007-04-28 14:50:38
Subject: Re: select * from table not showing everything
Previous:From: Erik JonesDate: 2007-04-19 14:17:12
Subject: Re: php-pgsql no longer works under 8.2

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group