vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   one simple line (https://vborg.vbsupport.ru/showthread.php?t=79162)

Lionel 04-01-2005 05:52 AM

one simple line
 
in register php,right after:

PHP Code:

$DB_site->query("INSERT INTO " TABLE_PREFIX "userfield $userfieldsnames VALUES ($userid$userfields)"); 

I'd like to add
PHP Code:

$DB_site->query("UPDATE userfield SET field10 = SUBSTRING(MD5(userid) FROM 10 FOR 5)"); 

but just for the user who is registering. That code does it for every body.

can someone please just tell me that WHERE statement for the new userid?

PHP Code:

 $DB_site->query("UPDATE userfield SET field10 = SUBSTRING(MD5(userid) FROM 10 FOR 5) WHERE ????"); 

Simple, but I haven't slept for two days, can't figure it out and I don't want a trial and error on a live board where I get people registering constantly.

Thank you.

cinq 04-01-2005 05:57 AM

I dun have access to see how the userfield table looks like now, but I believe you can obtain the userid of the person who is only just registering by using :

PHP Code:

$newuser $DB_site->insert_id(); 


Lionel 04-01-2005 06:06 AM

I am looking for the where statement
PHP Code:

UPDATE userfield SET field10 SUBSTRING(MD5(useridFROM 10 FOR 5WHERE insert_id()"); 

So it would be like that?

Marco van Herwaarden 04-01-2005 06:10 AM

[sql]WHERE userid = $userid[/sql]try that one, but best would be to add the field10 to $userfieldnames and $userfields before the original query, so it would already get updated there. No need for an extra query then.

PS You should never experiment with coding on a live board.

Lionel 04-01-2005 06:13 AM

Thanks Marco. I got burnt a couple times with experiments. Thank God for backups.

That did not insert anything.

Duh, that's exactly what I meant. I was sleeping. That was field15 instead of field10. Field10 is for the weather. I got it set default to Miami. I registered and the weather displayed for Chad Nigeria. hahaha

cinq 04-01-2005 12:42 PM

Sorry just reread your query.
I think you should be doing this, like Marco mentioned.
PHP Code:

UPDATE userfield SET field10 SUBSTRING(MD5(useridFROM 10 FOR 5WHERE userid $userid 



All times are GMT. The time now is 06:22 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.01051 seconds
  • Memory Usage 1,725KB
  • 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
  • (6)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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