SET MYSQL Variables

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

SET MYSQL Variables

Post by kendall »

Hey guys,

I have been reading up on MYSQL Variables and wanted to know how and when to set a mysql variable and how it is access in relation to carrying out SQL statements

Firstly i was trying to determing whether or not this is a MYSQL 5 feature which i dont have
Secondly Im trying to use this set variable option in an updating statement

Code: Select all

SET @Pos = 1; UPDATE cms_menu_test SET NavOrder = (@Pos+$position),@Pos:=(@Pos+1) WHERE MenuGroup = '$menuGroup'
Now would this variable increment to 10 for ten records in this update statement? I have tried it but it isnt erroring nor is it affecting anything.

How do you use this and when is it accessible

Kendall
Post Reply