First, let me apologize if I'm reiterating something already said, but I'm new to the newsgroup.

What does mysql say the problem was? That is, if you put

echo mysql_error();

immediately after the query, what does it say?

Is it possible you have one of the fields set to be unique in your db and are trying to insert duplicate data?

Bill Anderson

Jeff wrote:
Hi... again. :P

Been working on this code all weekend, and I did take everyone's advice, but
I'm still getting the same error.  "Error retrieving records.  From line
"$result = mysql_query($query, $link_id) OR DIE("Error retrieving
records."); " of my code.  When I first put the insert query in, it allowed
me to add one record, then started returning the error, and hasn't let me
enter another record since.

Here is the entire code.


   $link_id = mysql_pconnect("localhost","admin","f1r3w0rks")
            or die("Unable to connect to SQL server");
            or die("Unable to select database");

foreach ($_POST as $var=>$value) ${$var}=$value;



<BODY BGCOLOR="white">

<a href="index1.php"> Home </a>|<a href="list_db.php"> Display All </a>|<a
href=""> Search </a>
Total Entries:

<BR><div align="center"><img src=http://dataguy/logo_small.jpg>

<BR><b>Encana Gradient Data Base</B><BR></div>

<div align="center">
<FORM METHOD="post" ACTION="<?php echo $PHP_SELF; ?>">
<PRE> <b>

       $query  = "INSERT INTO gradients (kwo, lsd, date, well, field, uni,
license, formation) values ('$kwo', '$lsd', '$date', '$well', '$field',
'$uni', '$license', '$formation')";
       $result = mysql_query($query, $link_id) OR DIE("Error retrieving

KWL WO#: <INPUT TYPE="text" NAME="kwo" VALUE=""> LSD: <INPUT TYPE="text" NAME="lsd" VALUE=""> Date Completed: <input type="text" name="date" value=""> Well Name: <INPUT TYPE="text" NAME="well" VALUE=""> Fieled/Pool: <INPUT TYPE="text" NAME="field" VALUE=""> Unique: <INPUT TYPE="text" NAME="uni" VALUE=""> License #: <input type="text" name="license" value=""> Formation: <input type="text" name="formation" value=""> Perfs: <input type="text" name="perfs" value=""> Event No.: <input type="text" name="event" value=""> Well Fluid Status: <input type="text" name="fluid" value=""> Well Status Mode: <input type="text" name="mode" value=""> Well Status Type: <input type="text" name="type" value=""> Type V/D/H: <input type="text" name="vdh" value=""> File Name: <input type="text" name="file" value=""> KB: <input type="text" name="kb" value=""> GRD: <input type="text" name="grd" value=""> Open Hole: <input type="text" name="open" value=""> Sour: <input type="text" name="sour" value=""> Tubing Size: <input type="text" name="tube" value=""> Landed @: <input type="text" name="landed" value=""> Casing Size: <input type="text" name="casing" value=""> Landed @: <input type="text" name="landed2" value=""> Shut In Date: <input type="text" name="shut_date" value=""> Shut In Time: <input type="text" name="shut_time" value=""> Pres TUB/CAS KPAg: <input type="text" name="pres" value=""> Tag PBTD: <input type="text" name="tag" value="">

<br>  <HR><HR>
 <INPUT TYPE="submit" VALUE="Submit">

</PRE>    </b>



PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to