Id query problem

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
robaiken
Forum Newbie
Posts: 4
Joined: Wed Jun 17, 2009 5:44 am

Id query problem

Post by robaiken »

Code: Select all

print "<form methord='post'>";
    $insql = "UPDATE `pubpartners`.`statements` SET `print_status` = '0' WHERE `statements`.`id` ={$r['id']} LIMIT 1";
    if( is_readable('../statements_invoices/statement/'.$r['FileName']) ) echo '<input type="submit" value="Print">'; 
    mysql_query ($insql);
    print "</form>";
this is my code when ever the button is clicked it updates all the print_statuses, which is really annoying becasue i only what to update one of id in the database.


Thanks for any help
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: Id query problem

Post by McInfo »

Are you sure $r['id'] contains a value?

This could cause a problem. "methord" is not a valid form tag attribute, so the form will default to using the GET method.

Code: Select all

print "<form methord='post'>";
The Print button has no name, so it will not be connected to any POST or GET variable. Since the button appears to be the only input in the form, the form will submit nothing.

Code: Select all

echo '<input type="submit" value="Print">'; 
The code you have provided is really not enough to work with.

Edit: This post was recovered from search engine cache.
Post Reply