Page 1 of 1

Id query problem

Posted: Thu Jun 18, 2009 7:35 am
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

Re: Id query problem

Posted: Thu Jun 18, 2009 10:50 am
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.