This souce generates a form for editing a database record.
It 'manually' puts code for the most important fields at top.
It worked in asp despite repeating fields in array list.
form action='update.php?ID=? echo $dbrec[ID]; ?' method='POST'
Streetnum: input name=Streetnum value='? echo $dbrec[Streetnum];
?'br
Streetname: input name=Streetname value='? echo $dbrec[Streetname];
?'
p/p
Complex Name: input name=Complexname value='? echo
$dbrec[ComplexName]; ?'br
(this is printed for address under active listings)p/p
Subdivision: input name=Subdivision value='? echo $dbrec[Subdivision];
?'br
Beds: input name=Beds value='? echo $dbrec[Beds]; ?'br
BathsTotal: input name=BathsTotal value='? echo $dbrec[BathsTotal];
?'br
SqFtTotal: input name=SqFtTotal value='? echo $dbrec[SqFtTotal];
?'br
ListPriceLow: input name=ListPriceLow value='? echo
$dbrec[ListPriceLow]; ?'br
ListStatus: input name=ListStatus value='? echo $dbrec[ListStatus];
?'br(Active=act,
Pending=pend, Sold=closd)br
input type=submit value=Update this listing
?
print p/pDetailed info for this item is belowp/p;
}
while (list($k,$v)=each($dbrec)) {
echo $knbsp;input type='text' value='$v' name='$k'BR;
}
?
/form
The asp code now converted to php came out like this:
?
$sql=SELECT * FROM lsm where ID = .$HTTP_GET_VARS[ID];
$result=query($sql);if (!$result) die('sql error');
$dbrec=getrec($result);
if ($dbrec)
{
$dbrec[Complexname]=$HTTP_POST_VARS[Complexname];
$dbrec[Subdivision]=$HTTP_POST_VARS[Subdivision];
$dbrec[Beds]=$HTTP_POST_VARS[Beds];
$dbrec[BathsTotal]=$HTTP_POST_VARS[BathsTotal];
if ($HTTP_POST_VARS[SqFtTotal]!=)
$dbrec[SqFtTotal]=$HTTP_POST_VARS[SqFtTotal];
$dbrec[ListPriceLow]=$HTTP_POST_VARS[ListPriceLow];
$dbrec[Streetnum]=$HTTP_POST_VARS[Streetnum];
$dbrec[Streetname]=$HTTP_POST_VARS[Streetname];
updrec($dbrec,'lsm','ID');
}
?
where updrec is jibberish now- in .asp it looped the form and set the db fields then
executed
dbrec.update()
Yes I could make a form that loops the db fields and an update page that loops the
form fields and
creates an UPDATE string. This is the correct way yes?
The reason I'm asking is because I have more sites and this will take a lot of editing
and also
I'd like to understand the differences here- for instance if it is all asp objects
doing this for
me then it is possible to write ones in php that do same?
Sorry if I get php/mysql terms confused.
I see linux running a mysql server and a php interpreter that calls mysql server right?
--- Becoming Digital [EMAIL PROTECTED] wrote:
I'm sorry, but that is the most confusing question I've heard in some time.
The operating system has nothing to do with your ability to update the DB. That
is a user permissions issue. If you're referring to PHP as Linux, I can see
where the confusion came from.
I'd like to help you. So I can attempt to do that, let's see the ASP code
you're trying to convert to PHP.
Edward Dudlik
Becoming Digital
www.becomingdigital.com
- Original Message -
From: Steve B. [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, 09 June, 2003 22:14
Subject: Re: [PHP-DB] how to update field without using UPDATE query? you are
kidding?
Hi
in asp it lets me say
~get a record into dbrec which is a database object.
dbrec['field1'] = 'wow'
dbrec.update;
is there no way to do this in linux?
thats lame if it is then that means my 25 web sites have to be re-written to
work on Linux.
--- Becoming Digital [EMAIL PROTECTED] wrote:
I assume you lack update permissions, which means you probably don't have the
other permissions necessary to change data. Assuming you actually do, you
could
use REPLACE or DELETE followed by INSERT.
Edward Dudlik
Becoming Digital
www.becomingdigital.com
- Original Message -
From: Steve B. [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, 09 June, 2003 19:29
Subject: [PHP-DB] how to update field without using UPDATE query?
how to update field without using UPDATE query?
I open the db at a certain ID then set
$dbrec['field'] = new value
How do you update the db?
Thanks
-steve
-
Do you Yahoo!?
Free online calendar with sync to Outlook(TM).
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
__
Do you