How To Mysql Select And Update In One Query
Posted On Wed Jan 28, 2009 By juvan In MySQL Forums And Topics Discussions About Open Source Database Forums
i am learning php and mysql database, i know how to query and update in two separate quqeries, but i was wondering if its possible to do a SELECT and UPDATE in one query? like this for example
$sql = "SELECT hits FROM counter WHERE id = 23";
$sql = "UPDATE counter SET hits=24"
$sql = "SELECT hits FROM counter WHERE id = 23";
$sql = "UPDATE counter SET hits=24"
Cyber Tue Sep 22, 2009
update counter set hits=hits+1
justin Wed Jan 28, 2009
i will try it i dont konw if its going to work. ill let you know what i find out
dbnovice56 Wed Jan 28, 2009
have you tried this:
$sql = "SELECT hits FROM counter WHERE id = 23 AND UPDATE counter SET hits=24"
$sql = "SELECT hits FROM counter WHERE id = 23 AND UPDATE counter SET hits=24"
Related Content
Information
Forums »
MySQL Forums And Topics Discussions About Open Source Database »
How To Mysql Select And Update In One Query
MySQL Forums And Topics Discussions About Open Source Database »
How To Mysql Select And Update In One Query
Title: How To Mysql Select And Update In One Query
Description: How To Mysql Select And Update In One Query
Tags: how ,to ,mysql ,select ,and ,update ,in ,one ,query
Info: This Post Has Been Viewed 0 Times Since
Date: Wed Jan 28, 2009
Author juvan Received 3 Replies #915
Date: Wed Jan 28, 2009
Author juvan Received 3 Replies #915
Share
URL: 

Embed: 

To embed this topic, just copy the code from the "Embed" box. Once you've copied the code, just paste it into your website or blog to embed it
BBCODE:: 

BBCODE is use on forums. You can put this code on all your BBCODE enabled forums like PhpBB, vBulletin® and others. Just Copy and Paste this code on your Posts and Replies on your forums
wallpaperama | Wallpapers | Forums | Terms Of Service
copyright © 2013 wallpaperama - All Rights Reserved - Last Updated Mon May 06, 2013 (-8 GMT)
Powered by: Webune Forums V5
copyright © 2013 wallpaperama - All Rights Reserved - Last Updated Mon May 06, 2013 (-8 GMT)
Powered by: Webune Forums V5