Description:
I am running mysql version 3.23, and I have a php script involving a mysql query.
Updating two varchar fields worked fine, but when I try to update many more fields, it
gives an error in return. I have tried updating the fields manually with phpmyadmin, and
generate code from there, but even the suggested code gives an error.
How-To-Repeat:
My php code:
Some initializing code:
$row_array = mysql_fetch_array($result); //set fields of the matching row as an array.
//Set session variables according to DB.
session_unset(); //be sure to start with an empty session.
$_SESSION['char_class'] = $row_array["class"];
$_SESSION['char_name'] = $row_array["name"];
$_SESSION['char_level'] = $row_array["level"];
$_SESSION['char_strenght'] = $row_array["strenght"];
$_SESSION['char_speed'] = $row_array["speed"];
$_SESSION['char_stamina'] = $row_array["stamina"];
$_SESSION['char_iq'] = $row_array["iq"];
$_SESSION['char_dodge'] = $row_array["dodge"];
$_SESSION['char_h2h'] = $row_array["h2h"];
$_SESSION['char_wpskill'] = $row_array["wpskill"];
$_SESSION['char_hp'] = $row_array["hp"];
$_SESSION['char_chakra'] = $row_array["chakra"];
$_SESSION['char_ticks'] = $row_array["ticks"];
$_SESSION['char_user_id'] = $row_array["login"];
$_SESSION['authed'] = $auth;
The piece of code containing the query which fails.
$char_level = 1;
$char_strenght = 8;
$char_speed = 10;
$char_stamina = 12;
$char_iq = 13;
$char_dodge = 12;
$char_h2h = 11;
$char_wpskill = 4;
$char_hp = 28;
$char_chakra = 12;
//Update DB. Problem HERE! doesn't seem to work, even php
my admin proposed code gives an error.
$query = "UPDATE users SET level='$char_level',
strenght='$char_strenght', speed='$char_speed', stamina='$char_stamina', iq='$char_iq',
dodge='$char_dodge', h2h='$char_h2h', wpskill='$char_wpskill', hp='$char_hp',
chakra='$char_chakra' WHERE login='$char_user_id' LIMIT 1";
mysql_query($query, $connection) or die(mysql_error());
Fix:
I don't know the fix for this. Maybe there is a limit for the amount of fields to update?
Synopsis: mysql updatequery involving many fields
Submitter-Id: mattm
Originator: Matt
Organization: None
MySQL support: email support
Severity: serious
Priority: medium
Category: mysqld
Class: support
Release: mysql-3.23.38
Exectutable: mysqld
Environment: AMD XP 1600, 512MB Ram, Maxtor HD's...
System: Win2000
Compiler: VC++ 6.0
Architecture: i