Enjoy unlimited access to all forum features for FREE! Optional upgrade available for extra perks.
Domain summit 2024

Using MySQL UPDATE, I need help.

Status
Not open for further replies.

EM @MAJ.com

Visit MAJ.com for domain forsale.
Legacy Exclusive Member
Joined
Sep 10, 2002
Messages
5,833
Reaction score
75
I have this code ...

// connect to database
$sqlQuery = "SELECT * FROM table WHERE fieldname1= -123456 ORDER BY id DESC LIMIT 1";

[successfully executed my programming routine here.]

At the end of php script, I added this command to update the fieldname 'type' value to test4
$sqlQuery = "UPDATE `table` SET `type`='test4' WHERE fieldname1=-123456 ORDER BY id DESC LIMIT 1";

The UPDATE is not working. I suppose to see updated data for type=test4. What I'm missing here?

Thank you in advance.
EM
 
Domain summit 2024

Mr.Domains

DNF Addict
Legacy Exclusive Member
Joined
Sep 29, 2004
Messages
1,417
Reaction score
29
You are setting up your query string $sqlQuery, but are you actually executing it? In your code, you are not actually running the query.

$sqlQuery = "UPDATE table SET type='test4' WHERE fieldname1='-123456' ORDER BY id DESC LIMIT 1";
$result = mysql_query($sqlQuery) or die(mysql_error());
 

EM @MAJ.com

Visit MAJ.com for domain forsale.
Legacy Exclusive Member
Joined
Sep 10, 2002
Messages
5,833
Reaction score
75
Cheers to you Neil. It works. I'm getting old ...:)

Thank you for taking the time to post a solution.

Regards,
EM @ KING.NET
 

Mr.Domains

DNF Addict
Legacy Exclusive Member
Joined
Sep 29, 2004
Messages
1,417
Reaction score
29
No worries, glad I could help...
 
Status
Not open for further replies.

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Sedo - it.com Premiums

IT.com

Premium Members

AucDom
UKBackorder
Be a Squirrel
MariaBuy

New Threads

Our Mods' Businesses

UrlPick.com
Free QR Code Generator by MerchArts

*the exceptional businesses of our esteemed moderators

Top Bottom