PHP mySQL Update not working

Status
Not open for further replies.

cldev01x

New Member
Messages
8
Reaction score
0
Points
1
I'm scratching my head on this a little, I would be very grateful for some help.

I am attempting to make a very simple UPDATE to a specific row on a MySQL table from PHP. I have tried using PDO but cannot get this to work so I have simplified it to try and find the problem.

I do not get any errors but I also do not get any UPDATE. Can anyone help?

Code:
<?php
require_once 'dbconfig.php';
$CustNo = 103;

$conn = mysqli_connect($host,$username,$password,$dbname);

if (!$conn)
{
    die('Could not connect: ' . mysql_error());
}

$quUpdate = "UPDATE customers SET creditlimit = 20000000 WHERE customerNumber = 103";

$RESULTSTART = @mysql_query($quUpdate , $conn ) or die(mysql_error());

mysqli_close($conn);

?>
 
Last edited by a moderator:

AngusThermopyle

Active Member
Messages
319
Reaction score
52
Points
28
Why are you combining mysql and mysqli ? Especially since mysql is deprecated and will soon disappear?
Why , if some is going wrong, are you using "@" which suppresses error messages which might tell you what is going wrong?
Why aren't you testing the return value of the query?
 

cldev01x

New Member
Messages
8
Reaction score
0
Points
1
Thanks both, looks like I've got this script mangled instead of simplified.

I will try again using PDO.
 

cldev01x

New Member
Messages
8
Reaction score
0
Points
1
leafypiggy: thanks for the link, your help is very much appreciated (again)
 
Status
Not open for further replies.
Top