View Full Version : MySQL Help
pyro.699
10-11-2005, 12:49 AM
$db->query_write("
UPDATE `" . TABLE_PREFIX . "user` SET `rpg_name` = 'Life' WHERE '" . $vbulletin->userinfo['userid'] . "'
`rpg_sex` = 'Life'
`rpg_skin` = 'Life'
`rpg_eyes` = 'Life'
`rpg_hair` = 'Life'
`rpg_age` = 'Life'
`rpg_height` = 'Life'
`rpg_build` = 'Life' WHERE '" . $vbulletin->userinfo['userid'] . "';
");
this is the query for my current rpg script, sorry if your offended by the word "sex".
it wont run, theres no errors, everytuhgn is fine, except it dosent do its job /;
Guest190829
10-11-2005, 12:57 AM
$db->query_write("
UPDATE `" . TABLE_PREFIX . "user` SET `rpg_name` = 'Life' WHERE '" . $vbulletin->userinfo['userid'] . "'
`rpg_sex` = 'Life'
`rpg_skin` = 'Life'
`rpg_eyes` = 'Life'
`rpg_hair` = 'Life'
`rpg_age` = 'Life'
`rpg_height` = 'Life'
`rpg_build` = 'Life' WHERE '" . $vbulletin->userinfo['userid'] . "';
");
this is the query for my current rpg script, sorry if your offended by the word "sex".
it wont run, theres no errors, everytuhgn is fine, except it dosent do its job /;
Try this....
$rpg = $db->query_write("UPDATE ". TABLE_PREFIX ."user
SET rpg_name='life', rpg_sex='life', rpg_skin='life', rpg_eyes='life',
rpg_hair='life', rpg_age='life', rpg_height='life', rpg_build='life'
WHERE userid='" . $vbulletin->userinfo['userid'] . "'
");
Also, you should alter the default vbulletin user table, as it doesn't follow normalization rules. It would be best to make a seperate table and join the tables via userid. I'm also not sure if userid is the correct field name in the user table.
pyro.699
10-11-2005, 01:21 AM
Hmmmm, i put the same code (eited the php parts) in the mysql box, and it worked /; but it wont work in my php script, ill ive you all i got so far
<?php
//vBulletin crap
error_reporting(E_ALL & ~E_NOTICE);
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'rpg');
$phrasegroups = array(
);
require_once('./global.php');
// ################################################## #####################
// ######################## START MAIN SCRIPT #################################
// ################################################## ####################
//Permission
if (is_member_of($vbulletin->userinfo, 1))
{
print_no_permission();
}
//Post?
if ($_POST)
{
}
else
{
$navbits = array();
$navbits[$parent] = 'RPG Stats';
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('RPG') . '");');
}
//test query!
$rpg = $db->query_write("UPDATE ". TABLE_PREFIX ."user
SET rpg_name='life', rpg_sex='life', rpg_skin='life', rpg_eyes='life',
rpg_hair='life', rpg_age='life', rpg_height='life', rpg_build='life'
WHERE userid='" . $vbulletin->userinfo['userid'] . "'
");
?>
as to teh correct userid thingie, it works, as i was playing earlyer, and got a mysql error, and saw that it did have the correct userid!
Guest190829
10-11-2005, 01:27 AM
Hmmmm, i put the same code (eited the php parts) in the mysql box, and it worked /; but it wont work in my php script, ill ive you all i got so far
<?php
//vBulletin crap
error_reporting(E_ALL & ~E_NOTICE);
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'rpg');
$phrasegroups = array(
);
require_once('./global.php');
// ################################################## #####################
// ######################## START MAIN SCRIPT #################################
// ################################################## ####################
//Permission
if (is_member_of($vbulletin->userinfo, 1))
{
print_no_permission();
}
//Post?
if ($_POST)
{
}
else
{
$navbits = array();
$navbits[$parent] = 'RPG Stats';
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('RPG') . '");');
}
//test query!
$rpg = $db->query_write("UPDATE ". TABLE_PREFIX ."user
SET rpg_name='life', rpg_sex='life', rpg_skin='life', rpg_eyes='life',
rpg_hair='life', rpg_age='life', rpg_height='life', rpg_build='life'
WHERE userid='" . $vbulletin->userinfo['userid'] . "'
");
?>
as to teh correct userid thingie, it works, as i was playing earlyer, and got a mysql error, and saw that it did have the correct userid!
Try this:
<?php
//vBulletin crap
error_reporting(E_ALL & ~E_NOTICE);
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'rpg');
$phrasegroups = array(
);
require_once('./global.php');
// ################################################## #####################
// ######################## START MAIN SCRIPT #################################
// ################################################## ####################
//Permission
if (is_member_of($vbulletin->userinfo, 1))
{
print_no_permission();
}
//Post?
if ($_POST)
{
}
else
{
$navbits = array();
$navbits[$parent] = 'RPG Stats';
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('RPG') . '");');
}
if ($_REQUEST['do'] == 'insert')
{
//test query!
$rpg = $db->query_write("UPDATE ". TABLE_PREFIX ."user
SET rpg_name='life', rpg_sex='life', rpg_skin='life', rpg_eyes='life',
rpg_hair='life', rpg_age='life', rpg_height='life', rpg_build='life'
WHERE userid='" . $vbulletin->userinfo['userid'] . "'
");
}
?>
Then add ?do=insert to the end of your .php in your url to see if it is working.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.