will this work

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gotornot
Forum Commoner
Posts: 54
Joined: Fri Jul 31, 2009 2:30 am

will this work

Post by gotornot »

$delq = "DELETE FROM '$tablename' WHERE id='$id'";
will this work?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: will this work

Post by requinix »

What makes you think that's anywhere near the amount of information we need to give you an answer?
gotornot
Forum Commoner
Posts: 54
Joined: Fri Jul 31, 2009 2:30 am

Re: will this work

Post by gotornot »

sorry
all i wondered was is the fatc that the variable $tablename sitting inside the string would work becaus ei cant seem to get it to any ideas?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: will this work

Post by requinix »

Without any PHP variables - just plain SQL - what does a DELETE query look like? You can use whatever names you want.
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: will this work

Post by jackpf »

I have an idea - why don't you go and test it and find out?
User avatar
Mirge
Forum Contributor
Posts: 298
Joined: Thu Sep 03, 2009 11:39 pm

Re: will this work

Post by Mirge »

jackpf wrote:I have an idea - why don't you go and test it and find out?
Would seem like the sensible thing to do.
Mark Baker
Forum Regular
Posts: 710
Joined: Thu Oct 30, 2008 6:24 pm

Re: will this work

Post by Mark Baker »

I predict it will compain about the quotes around '$tablename' when it should be backticks
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: will this work

Post by jackpf »

It probably will. So use backticks ;)
Post Reply