I just set up a pc with mysql-3.23.51/php-4.2.1/apache-1.3.26. I have
created a database and tables and a web interface to insert data into
it. I can insert data from the command line just fine. From the web
interface there is nothing inserted and no error messages. I have tried
connection string with root and with user names, both of which can
insert data from a remote client as well as on the sql server itself.
When I enter data and press submit the page redraws, and I don't get the
message the data was entered, and checking the database, I see nothing
indeed was entered. I've used post and get, makes no differance. In the
database I have set the fields as int, small int, varchar (shows char in
describe table_name), makes no differance.
I have made other web interfaces to mysql databases before, on slightly
older versions of mysql/php/apache and have never had this problem.
If anyone has a few minute to review my code below, hopefully someone
will find whatever it is I am missing. I have pasted in the html for the
web page, and below that a .csv copy/pasted of the database.
--
Thanks
Chip W
www.wiegand.org
[EMAIL PROTECTED]

Below is the web page -

<html>
<head></head>
<body bgcolor="aqua">
<div align="center">
<?
if(isset($submit)):
$db = mysql_connect("localhost", "root", "******") or die 
("Could not connect to the server");
print "<br>connected to the server successfully";
mysql_select_db("workout", $db) or die ("<br>Could not get the
database<br>"
 .mysql_error());
$sql = "INSERT INTO legs
(squats,squats_reps,legpress,legpress_reps,legext,legext_reps,legcurls,
legcurls_reps,calfraise,calfraise_reps,hipabducter,hipabducter_reps,
hipadducter,hipadducter_reps,comments) VALUES('$squats','$squats_reps',
'$legpress','$legpress_reps','$legext','$legext_reps','$legcurls',
'$legcurls_reps','$calfraise','$calfraise_reps','$hipabducter',
'$hipabducter_reps','$hipadducter','$hipadducter_reps','$comments')";
mysql_query($sql, $db) or die ("Query failed" .mysql_error());
print "<br>The data has been entered";
endif;
?>
<h2>Work-Out Data Entry Screen</h2>
<h3>Legs Work-out</h3>
<form action="<? $PHP_SELF ?>" method="get">
<table summary="" width="70%" border="1" align="center" bgcolor="green">
<tr>
<th>Excercise</th><th>Weight</th><th>Reps</th>
</tr>
<tr>
<th>Squats</th>
<td align="center">
<input type="text" name="squats" size="3" maxlength="3"></td>
<td align="center">
<input type="text" name="squats_reps" size="3" maxlength="3"></td>
</tr>
<tr>
<th>Leg Press</th>
<td align="center">
<input type="text" name="legpress" size="3" maxlength="3"></td>
<td align="center">
<input type="text" name="legpress_reps" size="3" maxlength="3"></td>
</tr>
<tr>
<th>Leg Extension</th>
<td align="center">
<input type="text" name="legext" size="3" maxlength="3"></td>
<td align="center">
<input type="text" name="legext_reps" size="3" maxlength="3"></td>
</tr>
<tr>
<th>Leg Curls</th>
<td align="center">
<input type="text" name="legcurls" size="3" maxlength="3"></td>
<td align="center">
<input type="text" name="legcurls_reps" size="3" maxlength="3"></td>
</tr>
<tr>
<th>Calf Raise</th>
<td align="center">
<input type="text" name="calfraise" size="3" maxlength="3"></td>
<td align="center">
<input type="text" name="calfraise_reps" size="3" maxlength="3"></td>
</tr>
<tr>
<th>Hip Abducter</th>
<td align="center">
<input type="text" name="hipabducter" size="3" maxlength="3"></td>
<td align="center">
<input type="text" name="hipabducter_reps" size="3" maxlength="3"></td>
</tr>
<tr>
<th>Hip Adducter</th>
<td align="center">
<input type="text" name="hipadducter" size="3" maxlength="3"></td>
<td align="center">
<input type="text" name="hipadducter_reps" size="3" maxlength="3"></td>
</tr>
<tr>
<th>Comments</th>
<td colspan="2" align="center">
<textarea cols="50" rows="3" name="comments" wrap="virtual">
</textarea></td>
</table>
<br />
<input type="submit" name="submit" value="Send Data">
</form>
<br />
</div>
</body>
</html>


And here is the database (a mysqlnavigator .csv dump) -

id,int(3),,PRI,,auto_increment
squats,int(3),YES,,,
squats2,char(3),,,,
squats_reps,char(3),YES,,,
legpress,char(3),YES,,,
legpress_reps,char(3),YES,,,
legext,char(3),YES,,,
legext_reps,char(3),YES,,,
legcurls,char(3),YES,,,
legcurls_reps,char(3),YES,,,
calfraise,char(3),YES,,,
calfraise_reps,char(3),YES,,,
hipabducter,char(3),YES,,,
hipabducter_reps,char(3),YES,,,
hipadducter,char(3),YES,,,
hipadducter_reps,char(3),YES,,,
comments,text,YES,,,


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to