vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   MySQL Help (https://vborg.vbsupport.ru/showthread.php?t=98098)

pyro.699 10-11-2005 12:49 AM

MySQL Help
 
Code:

$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

Quote:

Originally Posted by pyro.699
Code:

$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....

PHP Code:


$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 Code:

<?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->userinfo1))
{
    
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

Quote:

Originally Posted by pyro.699
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 Code:

<?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->userinfo1))
{
    
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 Code:

<?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->userinfo1))
{
    
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.


All times are GMT. The time now is 09:34 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01203 seconds
  • Memory Usage 1,765KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (4)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete