Jump to content

Mysql update without field names


jandrews3

Recommended Posts

I need to update a particular table and there be a whole lot of field names. I'd like to do it without having to use them the same way you can access then like $row[12] after a "select" query. The standard for updating (at least how I write it) goes like this ...

$query = "UPDATE linguistics SET welcome1='$var3', welcome2='$var4' WHERE language = '$lengua'";

Well, I'd like to do it where I don't have to name welcome1 and welcome2, but instead refer to their numerical position within the database. On a "select" query we can do this. Can this be done on an update? Something perhaps like ...

$query = "UPDATE linguistics SET 3='$var3', 4='$var4' WHERE language = '$lengua'";

... where 3 and 4 represent the 4th and 5th fields respectively. I know that this particular phrasing doesn't work because I've tried it, but surely there has to be something. This will save me LOTS of time. Thanks!!

Link to comment
https://forums.phpfreaks.com/topic/237917-mysql-update-without-field-names/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.