Link to home
Create AccountLog in
Avatar of wantabe2
wantabe2Flag for United States of America

asked on

PHP Form/Mysql Issues

I've taken some of your advice, example codes, read some URLs & have build the following but it is not pulling the data from my mysql database so I can see it to edit it. Can soomeone take a look at this to see where my mistake is? I've also attached a photo of the fields I'm trying to edit to help you better understand what I am doing. Thanks


$con = mysql_connect("localhost","uname","password");
if (!$con)
  die('Could not connect: ' . mysql_error());

mysql_select_db("mydb", $con);

$result = mysql_query("SELECT * FROM mytable ");


while ($i < $num) {


<form action="updated.php">
<input type="hidden" name="id" value="<? echo "$id"; ?>">
DATE1: <input type="date" name="due_ge" value="<? echo "$due_ge"?>"><br>
DATE2: <input type="date" name="due_rk" value="<? echo "$due_rk"?>"><br>
DATE3: <input type="date" name="due_ny" value="<? echo "$due_ny"?>"><br>
<input type="Submit" value="Update">


Open in new window

Avatar of Lukasz Chmielewski
Lukasz Chmielewski
Flag of Poland image

Use this at the top to see what's wrong

$con = mysql_connect("localhost","uname","password") or die(mysql_error());
mysql_select_db("mydb", $con) or die(mysql_error());;

$result = mysql_query("SELECT * FROM mytable ") or die(mysql_error());;
Avatar of Lukasz Chmielewski
Lukasz Chmielewski
Flag of Poland image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
I've noticed that there is no $id declared and for each record there is a form generated - is that correct thing to do ?

to the top of the script and this will tell you more.