Re: updating a database

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 14, 2010 at 9:59 AM, David Mehler <dave.mehler@xxxxxxxxx> wrote:
> Hello,
> What i'm trying to do certainly doesn't seem hard conceptually, but
> coding it has been rough. I'm wondering if anyone has anything
> similar.
> I've got a database with records. The first time the page is accessed
> the submit button won't be selected, so display information about the
> record with a checkbox for selection. If a user selects a checkbox and
> hits submit, display only that specific record in a form for editing,
> once editing is complete feed the edited data back to the database.
> I'd like all this to be done in a single sticky file.
> If anyone has any code similar to this i'd appreciate getting a look,
> mine is nonworking.
> Thanks.
> Dave.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Are you passing back the id of the record that you want to see as the
value for the checkbox? It should be a simple matter then of pulling
just that id

<?php

//check and set the id
$id = '';
if(!empty($_POST['id'])){
  $id = (int)$_POST['id'];
}

$sql = "select * from table where 1 ";

if(!empty($id)){
  $sql = " and record_id = $id ";
}

//run query here

...

?>
-- 

Bastien

Cat, the other other white meat

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux