Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-20-2004, 04:12 PM
Davey Davey is offline
 
Join Date: Nov 2002
Location: England
Posts: 383
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Changing all rows in a table from a selected field.

Couldn't think how to title this one.
In my table, I have a field called 'cid'.
There are 518 rows at the moment, I need to change the URL because it takes up a lot of space. I want the url to be changed to a special part of the URL, the "character id" string.
The URL looks like this:

(dont forget to add https://www it shows up funny on forum so I removed it.)
.novaworld.com/NWCommunities/charStats.aspx?id=xxxxxxxxxxx&productid=xxxxxx&pla yerCard=1

The first string 'id' is the string I need all the 'cid' fields changed to. This is the character id string. The second 'productid' string, is the ID of a certain game (3 different IDs atm). Space isn't the only reason I want this changed. I currently have it so that it only shows stats from the certain game, even if the player plays more than that 1 game. So with the character ID, I could just build a URL for their stats to each game, if you see what I mean.
See attachment for the piece of the URL I need.

Is it possible to update all 518 fields from:
(dont forget to add https://www it shows up funny on forum so I removed it.)
.novaworld.com/NWCommunities/charStats.aspx?id=xxxxxxxxxxx&productid=496057&pla yerCard=1 to xxxxxxxxxxx only?
Even if this is done via script, or perhaps even a phpMyAdmin query.

I believe it'd need a regexp of some kind to get 'xxxxxxxxxxx' from the string? Maybe not? This is the only bit I need help with, getting 'xxxxxxxxxxx' from that url string.

Thx for help.
Reply With Quote
  #2  
Old 08-21-2004, 03:20 AM
Brad Brad is offline
 
Join Date: Nov 2001
Posts: 4,765
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't understand what you are looking to do, can you provide us with some sample info and show us how you want it changed?
Reply With Quote
  #3  
Old 08-21-2004, 03:37 AM
Davey Davey is offline
 
Join Date: Nov 2002
Location: England
Posts: 383
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Difficult to explain lol.
I need a specific part of a URL.
Then I need to make a script which replaces each URL with the string of the URL I need.

The url is:
// ignore the space
https://www .novaworld.com/NWCommunities/charStats.aspx?id=xxxxxxxxxxx&productid=496057&pla yerCard=1
I need to get the xxxxxxxxxxx bit out of that URL string. Possible?
Reply With Quote
  #4  
Old 08-22-2004, 04:35 AM
Brad Brad is offline
 
Join Date: Nov 2001
Posts: 4,765
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Davey
Difficult to explain lol.
I need a specific part of a URL.
Then I need to make a script which replaces each URL with the string of the URL I need.

The url is:
// ignore the space
https://www .novaworld.com/NWCommunities/charStats.aspx?id=xxxxxxxxxxx&productid=496057&pla yerCard=1
I need to get the xxxxxxxxxxx bit out of that URL string. Possible?
It is possible, but I am not skilled in asp.net. In php however, you would get the var as so:

PHP Code:
$_GET['id'
Reply With Quote
  #5  
Old 08-22-2004, 11:07 AM
Davey Davey is offline
 
Join Date: Nov 2002
Location: England
Posts: 383
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I figured it out, but I ballsed my database up.
It changed all the CID to the 1st CID only. I can't figure out why it did that.

PHP Code:
<?php
error_reporting
(E_ALL & ~E_NOTICE);
// details removed for security reasons.
$dbase mysql_connect('*','*','*');
mysql_select_db('*');
// 
$cheatdb1 mysql_query("SELECT * FROM cheatdb",$dbase);
echo 
"begin database...<br><br>";
$count 0;
while (
$cheatdb mysql_fetch_array($cheatdb1))
{
    
$count++;
    
$url parse_url($cheatdb['cid']);
    
parse_str($url['query'], $outcome);
    
mysql_query("UPDATE cheatdb SET cid='" $outcome['id'] . "'",$dbase);
}
echo 
"<br>end database.";
?>
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:11 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.04211 seconds
  • Memory Usage 2,206KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete