Kristian_C Posted December 29, 2006 Share Posted December 29, 2006 Is it possible? some thing like this :mysql_query("UPDATE avis SET $artikkel=$edi AND $tittel=$title WHERE avis=$bruker->avis'");Is this possible? Link to comment Share on other sites More sharing options...
CStrauss Posted December 29, 2006 Share Posted December 29, 2006 I think that is possible but be alot of extra unneeded code. you would have to run a query to your database to store the field name into your varaible $artikkel before you run the query you just posted. But like i said basicly your sorta doing things twice when you can do it once just by using the field name instead of $artikkel and this putts more overhead on your server. if that makes any sense Link to comment Share on other sites More sharing options...
Kristian_C Posted December 29, 2006 Author Share Posted December 29, 2006 I think that is possible but be alot of extra unneeded code. you would have to run a query to your database to store the field name into your varaible $artikkel before you run the query you just posted. But like i said basicly your sorta doing things twice when you can do it once just by using the field name instead of $artikkel and this putts more overhead on your server. if that makes any senseHehe, think i understand, just used the regular update with alot of if's/elseif's insted hehe...Thanks->Kristian_C Link to comment Share on other sites More sharing options...
justsomeguy Posted January 2, 2007 Share Posted January 2, 2007 The only thing to change would be to enclose all your variables with brackets so that it is clear to PHP. I think the object requires it.mysql_query("UPDATE avis SET {$artikkel}={$edi} AND {$tittel}={$title} WHERE avis={$bruker->avis}'");I noticed you also have an orphaned single quote at the end there. That will be a SQL error. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now