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

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,834
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
 
Dynadot - Expired Domain Auctions

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,834
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.

Who has viewed this thread (Total: 1) View details

Who has watched this thread (Total: 2) View details

The Rule #1

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

Members Online

Sedo - it.com Premiums

IT.com

Premium Members

MariaBuy

Upcoming events

Our Mods' Businesses

UrlPick.com

*the exceptional businesses of our esteemed moderators

Top Bottom