vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   What is wrong with this query? (https://vborg.vbsupport.ru/showthread.php?t=68176)

TheMayhem 08-10-2004 01:21 AM

What is wrong with this query?
 
I'm trying to custom write a user title color hack and I almost got it... However when the page loads online and I update the settings for some reason it's not making changes to the database row in the user table which is called titlecolor.

// ############################### Edit Title Color ###############################

if ($_REQUEST['do'] == 'edittitlecolor')
{
$templatename = 'titlecolor';
}

// ############################### Update Title Color ###############################

if ($_POST['do'] == 'updatetitlecolor')
{
globalize($_POST, array('titlecolor' => STR));

// Support tags HTML grog6
$titlecolor = strip_tags($titlecolor);


$DB_site->query("
UPDATE " . TABLE_PREFIX . "user SET
titlecolor = '" . addslashes($titlecolor) ."'
WHERE userid = $bbuserinfo[userid]
");

echo "titlecolor";

$url = "usercp.php?$session[sessionurl]";
eval(print_standard_redirect('redirect_updatethank s'));

}

Colin F 08-10-2004 04:14 AM

good question...

do you have global.php required?
And do you make sure somewhere, that the user is logged in? (not that $bbuserinfo[userid] is empty)
are you getting any error messages anywhere?

Modin 08-10-2004 04:32 AM

add echo statements to see if it's actually getting the variable. (I notice you're missing the $ in your echo statement)

Other than that the code looks fine, so I would say it's on the html form side of the script.

TheMayhem 08-10-2004 03:39 PM

Script's going through and I just used that echo statement as an example. I edited a row on my user in phpmyadmin and like changed the "titlecolor" to silver... went online on the page it was there and it showed silver, I then changed it to white and clicked save and then it went back to being blank where $usertitle should of been. So for some reason it's not saving through the database as text *shrugs*

Modin 08-10-2004 04:16 PM

$titlecolor is probably not being set.

post the html of your form that submits to script, the problem is probably in there.

Dean C 08-10-2004 04:17 PM

Can you format you code with tabs to make it a little easier for us to read :)?

TheMayhem 08-10-2004 11:14 PM

Okay here's the complete non working script. ;)

Under the template definitions at the top of profile.php I have added this...

Quote:

'edittitlecolor' => array(
'titlecolor',
),
Then I have what I listed at the top of this page...

And to finish it off I have this template...

Quote:

<form action="profile.php" method="post">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="do" value="updatetitlecolor" />

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td>

<fieldset class="fieldset">
<legend>Update User Title Color</legend>
<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="100%">
<tr>
<td><smallfont>Enter the color of what you would like your User Title Color to appear on posts.</smallfont>
<div>
<textarea name=font rows=1 cols=30>$bbuserinfo[titlecolor]</textarea>
</div> </td>
</tr>
</table>
</fieldset>

</td>
</tr>
<tr>
<td>


<div style="margin-top:$stylevar[cellpadding]px">
<input type="submit" class="button" value="$vbphrase[save_changes]" accesskey="s" />
<input type="reset" class="button" value="$vbphrase[reset_fields]" accesskey="r" />
</div>
</td>
</tr>
</table>

</form>


All times are GMT. The time now is 10:54 AM.

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.01016 seconds
  • Memory Usage 1,728KB
  • 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_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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