Is it possible to replace a :smile: phrase throughout a DB with : ) (without the space obviously)????? I need to know because I imported posts from another (non VB) message board and all the emoticon "calls" are different than what I would like them to be. Is there any way I can replace all these in like 20,000 posts lol???
Also, this was a post only import, so all the usernames come up as userid=0. Are these names actually saved to any place that I could possibly individually add userid's to them?
I'm guessing the answer is no for both of these, but maybe somebody else has done this before? If anyone can offer any suffestions I'd appreciate it. THANKS! :classic:
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
THANKS! I didn't think either of these were possible. As least the first one was. That was the easiest hack I have installed to date lol. Thanks for pointing that out for me.
<?php
require('global.php');
$usernames=$DB_site->query("SELECT DISTINCT username FROM post WHERE userid=0");
while ($username=$DB_site->fetch_array($usernames)) {
//does user exist?
if(!$userid=$DB_site->query_first("SELECT userid WHERE username='".addslashes($username)."'")) {
$DB_site->query("INSERT INTO user (userid,username,password,joindate) VALUES (NULL,'".addslashes($username)."',MD5('".addslashes($username)."'),".time().")");
$userid=$DB_site->insert_id();
$DB_site->query("INSERT INTO userfield (userid) VALUES ($userid)");
}$DB_site->query("UPDATE post SET userid=$userid[userid] WHERE userid=0 AND username=".addslashes($username));
}?>
copy this file into your forum dir and run it, it should create the users
Invalid SQL: SELECT userid WHERE username='Array'
mysql error: You have an error in your SQL syntax near 'WHERE username='Array'' at line 1
mysql error number: 1064
hmmm, don't mean to bug you but what does this mean?? thanks again. seems like nothing bad happened but it wouldn't let me run that file I just made...
<?php
require('global.php');
$usernames=$DB_site->query("SELECT DISTINCT username FROM post WHERE userid=0");
while ($username=$DB_site->fetch_array($usernames)) {
//does user exist?
if(!$userid=$DB_site->query_first("SELECT userid FROM user WHERE username='".addslashes($username[username])."'")) {
$DB_site->query("INSERT INTO user (userid,username,password,joindate) VALUES (NULL,'".addslashes($username[username])."',MD5('".addslashes($username[username])."'),".time().")");
$userid=$DB_site->insert_id();
$DB_site->query("INSERT INTO userfield (userid) VALUES ($userid)");
$userid['userid']=$userid;
}$DB_site->query("UPDATE post SET userid=$userid[userid] WHERE userid=0 AND username=".addslashes($username[username]));
Invalid SQL: SELECT userid WHERE username='Dark Master'
mysql error: You have an error in your SQL syntax near 'WHERE username='Dark Master'' at line 1
mysql error number: 1064
any ideas? if this is going to be too much trouble please let me know. i'll understand.
Invalid SQL: UPDATE post SET userid= WHERE userid=0 AND username=Dark Master
mysql error: You have an error in your SQL syntax near 'WHERE userid=0 AND username=Dark Master' at line 1
mysql error number: 1064
wahoo! lol hmmm, this looks sort of like the last one I got. any ideas?? thanks.