Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
A simple Query regarding php mysql query
Old 07-22-2010, 09:22 AM A simple Query regarding php mysql query
Junior Talker

Posts: 3
Name: Anes P.A
Trades: 0
Friend I have a Doubt Regarding Queries, that means
I have a Table named : TEST in mysql.
it has some fields like : mobi_deleted,pub_deleted,pdf_deleted ....

according to operation any one of field is updated ....
in my php i got a variable , $var , it's value may be mobi, pub or pdf....

Do I can Write a query like:

UPDATE TEST SET {$var}_deleted = 0;

is this Work properly.... Waoting for ur valuable Reply...

Bye Anes
admod is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-22-2010, 09:25 AM Re: A simple Query regarding php mysql query
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
PHP Code:
$sql "UPDATE TEST SET {$var}_deleted = 0;"
That should work fine provided $var is set to either 'mobi', 'pub', or 'pdf'.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 07-22-2010, 10:10 AM Re: A simple Query regarding php mysql query
Average Talker

Posts: 16
Name: Filip Filipov
Location: Bulgaria
Trades: 0
My opinion is:
$table = $var."_deleted";
$sql = "UPDATE TEST SET `".$table."` = 0";
or shortly:
$sql = "UPDATE TEST SET `".$var."_deleted` = 0";
__________________

Please login or register to view this content. Registration is FREE
- IP Address Lookup. Domain Lookup. Geolocation by IP or Doomain Name

Please login or register to view this content. Registration is FREE
- Check PageRank, Alexa Rank, Backlinks, Indexed Pages, ...
primecode is offline
Reply With Quote
View Public Profile Visit primecode's homepage!
 
Reply     « Reply to A simple Query regarding php mysql query
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.14016 seconds with 12 queries