I'm having an issue with a SQL update query, it says successful but doesn't actually update the database record.
<?php
require_once('auth.php');
$host="localhost"; // Host name
$username="root"; // Mysql username
$password="sysadmin"; // Mysql password
$db_name="Elite"; // Database name
$tbl_name="Triage"; // Table name
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$sql="UPDATE Triage SET directly='$directly', psychologically='$psychologically' WHERE Reference='$Reference'";
$result=mysql_query($sql);
$sql="UPDATE Triage SET directly='$directly', psychologically='$psychologically' WHERE Reference='$Reference'";
none of the variables used in that query have been defined in the code above. $directly,$psychologically,$Reference
: none have a value. Define values for those and that's it.
That $Reference
is a must, even If others aren't.
$refrence="1";
$sql="UPDATE Triage SET directly='$directly' AND psychologically='$psychologically' WHERE Reference='$Reference'";
replace $refrence with your MySQL ref
Use this syntax
$sql= UPDATE Triage SET directly=?, psychologically=? WHERE Reference=?";
$param->execute(array($directly,$psychologically,$Reference));
$result=mysql_query($param);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.