[reply to a personal email posted here for the benefit of all :)]

> Are you sure you can't?

Yes.

> Could ASP do something that MySQL/SQL can't?

You confusing apples and oranges ... ASP is not a database. You should be comparing ASP to PHP.

So the short answer is PHP does not have an equivalent function to ASP's update() or whatever it is.

> That is very strange.

No it isn't. These are different languages.

> I wonder what mode ASP is accessing DB which lets you set record variables then paste them into
> it?


A very bad mode I would think. Very dangerous. But I can see how it is convenient.

> Perhaps it just does an update in the background.

Of course. No you understand. ASP is using a convenience method that does all that ugly SQL updating in the background. As far as I know PHP does not have such functionality.

> This bugs me because my db has 125 fields and it will be a very long sql string!

I bet!

> The form page generates form contents by using a while loop.
>
> How would you build the sql string from the form page?

Use a while loop ;) Name the GET or POST vars the same as the field names in the DB. Then you could use something like (I say like b/c this won't work, it's just an idea):

$sql = "update table A SET ";
while (list($fieldName, $value) == each($_POST)) {
  $sql .= " $fieldName='$value', ";
}

This won't work because there will be POST values passes in that are not part of your form data. Oh, and there will be a trailing "," you need to trim off ...

Just a quick idea.

--

Jean-Christian Imbeault


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



Reply via email to