Page 1 of 1

SET MYSQL Variables

Posted: Fri Feb 24, 2006 7:54 am
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