vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Changing all rows in a table from a selected field. (https://vborg.vbsupport.ru/showthread.php?t=68559)

Davey 08-20-2004 04:12 PM

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.

Brad 08-21-2004 03:20 AM

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?

Davey 08-21-2004 03:37 AM

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?

Brad 08-22-2004 04:35 AM

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'


Davey 08-22-2004 11:07 AM

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.";
?>



All times are GMT. The time now is 12:53 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.00983 seconds
  • Memory Usage 1,734KB
  • 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_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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