Jump to content

coco243

Members
  • Posts

    73
  • Joined

  • Last visited

Everything posted by coco243

  1. Thank you very much Inglome, that it was.I had to put $x within ' signs. Thank you again.
  2. How I do that? if (mysqli_error()) { echo "error";} No, it is text field.
  3. I had taked the information taken from that form ( age parameter ) <form action="/PHP/update.php" method="post">Age: <input type="text" name="age"><input type="submit"></form> And introduced and I had introduce it on a variable: $x=$_POST["fage"]; and dyspayed it here. echo $x; It works. Also I had verified if my updating STATMENT IS OK, and I had placed the number 20 at Age parameter, and when I had dysplayed the table, it was apearing the modification, so the UPDATE statment is OK. The next step was to pass the value of submit to variable x, and than to the UPDATE statament: mysqli_query($con,"UPDATE Persons SET Age=$xWHERE FirstName='Peter' AND LastName='Griffin'"); Didn't worked, why?
  4. It's not working.When i display table the age value is the same as it was.I don't have experience, and I can't figure where is the problem. I have to modify something at the form script from index.php also?
  5. Hellow, I have the following issue if you please can help me. I have this index.php file: <html><body><h1>It works!</h1><form action="/PHP/update.php" method="post">Age: <input type="text" name="age"><input type="submit"></form><?php//connecting to database//$con=mysqli_connect("localhost","root","gogonea","my_db"); // conection checking//if (mysqli_connect_errno())//{// echo "conection failed ".mysqli_connect_error();//}//else//{//echo "Ghiata, conection established! <br>";//} function afi(){include("displaytable.php");}//afi(); //closing connection//mysqli_close($con);?><div><p>cucu</p><form name="displaytable" action="\PHP\displaytable.php" method="get"><input type="submit" value="Display Table"></form> </div></body></html> And this update.php file: <?php//connecting to database$con=mysqli_connect("localhost","root","gogonea","my_db"); //conection checkingif (mysqli_connect_errno()){ echo "conection failed ".mysqli_connect_error();}else{echo "Ghiata, conection established! <br>";} //Updating Tablemysqli_query($con,"UPDATE Persons SET Age=ageWHERE FirstName='Peter' AND LastName='Griffin'"); //closing connectionmysqli_close($con); ?> I can't update the age, taked from the form scripted in the index.php This is a test of how to take values from forms and transmit them to a database. If I wasn't exprimed clear please tell me to be more explicite if is the case. Thank you verry much
×
×
  • Create New...