ok, i reduced it to
Code: Select all
<?php
include("dbinfo.inc.php");
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$first = mysql_real_escape_string ($_POST['first']);
echo $first;
$query = "INSERT INTO data1 (first) VALUES ('$first')";
mysql_query($query);
mysql_close();
?>
the dbinfo.inc.php file looks like this
Code: Select all
<?php
$username="inovacap_alf";
$password="alf123";
$database="inovacap_intake";
?>
if i tinker with the dbinfo file, i will get an access error, so it seems there is a connection?
i manually inserted a row in the db and this code reads it and shows it on the web page with no trouble:
Code: Select all
<?php
include("dbinfo.inc.php");
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM data1";
$result=mysql_query ($query);
$num=mysql_num_rows ($result);
mysql_close();
echo "<b><center>Database Output</center></b><br><br>";
?>
<table border="0" cellspacing="2" cellpadding="2">
<tr>
<th><font face="Arial, Helvetica, sans-serif">Name</font></th>
<th><font face="Arial, Helvetica, sans-serif">Street</font></th>
<th><font face="Arial, Helvetica, sans-serif">City</font></th>
<th><font face="Arial, Helvetica, sans-serif">State</font></th>
<th><font face="Arial, Helvetica, sans-serif">Fee Rcpt (Y/N)</font></th>
<th><font face="Arial, Helvetica, sans-serif">Date Rcd</font></th>
<th><font face="Arial, Helvetica, sans-serif">Opened By</font></th>
<th><font face="Arial, Helvetica, sans-serif">Check Encl (Y/N)</font></th>
</tr>
<?php
$i=0;
while ($i < $num) {
$first=mysql_result($result,$i,"first");
$last=mysql_result($result,$i,"last");
$street=mysql_result($result,$i,"street");
$city=mysql_result($result,$i,"city");
$zip=mysql_result($result,$i,"zip");
$fee_rcpt=mysql_result($result,$i,"fee_rcpt");
$date_rcd=mysql_result($result,$i,"date_rcd");
$opnd_by=mysql_result($result,$i,"opnd_by");
$check_encl=mysql_result($result,$i,"check_encl");
?>
<tr>
<td><font face="Arial, Helvetica, sans-serif"><?php echo "$first $last"; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo "$street"; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo "$city"; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo "$state"; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo "$zip"; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo "$fee_rcpt"; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo "$date_rcd"; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo "$opnd_by"; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo "$check_encl"; ?></font></td>
</tr>
<?php
++$i;
}
echo "</table>";
?>
so there has to be a connection ... but the insert isnt working ... might be an issue with how the db is setup?