Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Clean UP DB

Asked Modified Viewed 2,864 times
J
Jay
J
Jay 10
  • Member, joined since
  • Contributed 170 posts on the community forums.
  • Started 57 threads in the forums
  • Started this discussions
asked
Member

Hello community! Aloha!!

I just moved my database and successfully restored the databased backup from the prevous database, however i have accidently deleted the avatar gallery thus all the avatars are gone from the FTP end, so now I wish to clean up the database so everything can just restart fresh I cant be bothered finding images for over 500 users.

How can i clean up the Avatar table so it doesnt show broken links for old avatars?

I checked the db end (phpmyadmin) but couldnt locate the avatar table.
I cant find it.
Edited by Jay on 05-07-2008 10:11,
0 replies

13 posts

J
Jay
J
Jay 10
  • Member, joined since
  • Contributed 170 posts on the community forums.
  • Started 57 threads in the forums
  • Started this discussions
answered
Member

Any one?

Also I wish to clean up the admin area, some items repeat themselves more than once for instance i got 3 News category icon in Content Admin...please suggest.

Your time, effort and help is very much appreciated. merci.
0 replies
I
inFuzed
I
  • Newbie, joined since
  • Contributed 4 posts on the community forums.
answered
Newbie

From memory..
In php-fusion 6.15 -
Avaters are recorded in the user table.
Running the following query in custom page editor as a preview should clear all avatars
<?php 

dbquery("UPDATE ".DB_PREFIX."users SET user_avatar = 'NULL' ");

?>

In php-fusion 7.00 +
If Avaters are still recorded in the user table.
Running the following query in custom page editor as a preview should clear all avatars
<?php 

dbquery("UPDATE ".DB_USERS SET user_avatar = 'NULL' ");

?>
0 replies
J
Jay
J
Jay 10
  • Member, joined since
  • Contributed 170 posts on the community forums.
  • Started 57 threads in the forums
  • Started this discussions
answered
Member

it says table does not exist when i run that code

<?php

dbquery("UPDATE ".DB_USERS." SET user_avatar = 'NULL' ");

?>
0 replies
X
Xessive
X
I am not always right, but I'm never wrong.
http://www.xessive.nl
  • Senior Member, joined since
  • Contributed 327 posts on the community forums.
  • Started 4 threads in the forums
answered
Senior Member

Quote

Jay wrote:
it says table does not exist when i run that code

<?php

dbquery("UPDATE ".DB_USERS." SET user_avatar = 'NULL' ");

?>


This code is for V7.

Try this one:

<?php

dbquery("UPDATE ".DB_PREFIX."users SET user_avatar = 'NULL' ");

?>
Edited by Xessive on 05-07-2008 20:57,
0 replies
J
Jay
J
Jay 10
  • Member, joined since
  • Contributed 170 posts on the community forums.
  • Started 57 threads in the forums
  • Started this discussions
answered
Member

Thanks man

that one works but I think there is misunderstanding, these codes delete the avatars on user profiles, I want to clean up the database end because im using that Random Avatar profile..see the code below.

$result = dbquery(
"SELECT user_avatar,user_name,user_id FROM ".$db_prefix."users WHERE user_avatar OR user_id != '' ORDER BY RAND() LIMIT 1"
);

if (dbrows($result) == 1) {
@openside('Random Avatar');
$data=dbarray($result);

echo "<div style='text-align:center'>
<a href='".BASEDIR."profile.php?lookup=".$data['user_id']."' title='".$data['user_name']."'>\n";
if ($data['user_avatar']) {
echo "<img src='".BASEDIR."images/avatars/".$data['user_avatar']."' alt='".$data['user_name']."' border='0' width='100'>
<br>
".$data['user_name']."";
}
else {
echo "<img src='".BASEDIR."images/avatars/noimage.gif' alt='".$data['user_name']."' border='0'>
<br>
".$data['user_name']."
</a>
</div>";
@closeside();
}
}


Its still calling out old avatars, i want it to reset everything (empty the cache) coz there are no images in avatar, i deleted them by accident, now the first think it should show should be my avatar as far as i know im the only one who updated my profile thus it should only show mine for now and stop saying 25% of members got avatars.

Thanks
0 replies
J
Jay
J
Jay 10
  • Member, joined since
  • Contributed 170 posts on the community forums.
  • Started 57 threads in the forums
  • Started this discussions
answered
Member

biiiiiiib :D
0 replies
J
Jay
J
Jay 10
  • Member, joined since
  • Contributed 170 posts on the community forums.
  • Started 57 threads in the forums
  • Started this discussions
answered
Member

anyone please?? I need this...
0 replies
F
fanggaming
F
  • Junior Member, joined since
  • Contributed 43 posts on the community forums.
  • Started 3 threads in the forums
answered
Junior Member

I'm not 100% on what you are asking. But this code will make it ignore the database entry if it cant find the file.

<?php
$result = dbquery("SELECT user_avatar,user_name,user_id FROM ".$db_prefix."users WHERE user_avatar AND user_id != '' ORDER BY RAND() LIMIT 1");

if (dbrows($result) == 1) {
@openside('Random Avatar');
$data=dbarray($result);

echo "<div style='text-align:center'>
<a href='".BASEDIR."profile.php?lookup=".$data['user_id']."' title='".$data['user_name']."'>\n";
if ($data['user_avatar'] && file_exists(BASEDIR."images/avatars/".$data['user_avatar'])) {
echo "<img src='".BASEDIR."images/avatars/".$data['user_avatar']."' alt='".$data['user_name']."' border='0' width='100'>
<br>
".$data['user_name']."";
}
else {
echo "<img src='".BASEDIR."images/avatars/noimage.gif' alt='".$data['user_name']."' border='0'>
<br>
".$data['user_name']."
</a>
</div>";
@closeside();
}
}
?>
0 replies
J
Jay
J
Jay 10
  • Member, joined since
  • Contributed 170 posts on the community forums.
  • Started 57 threads in the forums
  • Started this discussions
answered
Member

Well I deleted the avatar folder on the FTP end by accident while moving database and my system still thinks they there, so i want to clear up the cache and database for avatars, so when i upload avatars now it can restart from 0 rather than 200+ etc
0 replies
F
fanggaming
F
  • Junior Member, joined since
  • Contributed 43 posts on the community forums.
  • Started 3 threads in the forums
answered
Junior Member

The only place information about the avatars is held is in the users table under this column user_avatar , in this format:

filename[user_id].extension


e.g.

my_avatar[19132].jpg


For you to reset the numbers which show there you would have to drop the user table OR drop the user_id column and recreate it (But both these methods would reset all users ids and therefore remove and relative links to all the other tables on your site and you may as well buold your site from scratch! SO NOT RECOMMENDED :P ) and im not even sure thats what you are trying to do?
0 replies
F
fanggaming
F
  • Junior Member, joined since
  • Contributed 43 posts on the community forums.
  • Started 3 threads in the forums
answered
Junior Member

AAhh I think I get what the problem is now. Although im not sure the info is a bit vague :P

<?php

dbquery("UPDATE ".DB_PREFIX."users SET user_avatar = 'NULL' ");

?>


Run this like was already stated which will clear out ALL users avatar data.

Then change this part of your php code.

From:
$result = dbquery(
"SELECT user_avatar,user_name,user_id FROM ".$db_prefix."users WHERE user_avatar OR user_id != '' ORDER BY RAND() LIMIT 1"
);


To:
$result = dbquery(
"SELECT user_avatar,user_name,user_id FROM ".$db_prefix."users WHERE user_avatar != '' ORDER BY RAND() LIMIT 1"
);


Basically the code was saying return all records where user_avatar OR user_id is not equal to nothing (empty field) and since user_id has to have a value in the table you will always return all users in that query. I think that might be what you mean? :|


Also I showed before that if you change this

if ($data['user_avatar']) {


To this

if ($data['user_avatar'] && file_exists(BASEDIR."images/avatars/".$data['user_avatar'])) {


That will stop it trying to show avatars which dont exist
Edited by fanggaming on 06-07-2008 17:08,
0 replies
A
afaaro
A
afaaro 10
  • Senior Member, joined since
  • Contributed 295 posts on the community forums.
  • Started 68 threads in the forums
answered
Senior Member

I hope this should help


echo "<table width='100%'><tr><td>";
opentable('Random Avatar');
$result = dbquery(
"SELECT user_avatar,user_name,user_id FROM ".$db_prefix."users WHERE user_avatar != '' ORDER BY RAND() LIMIT 1"
);
if (dbrows($result) == 1) {
$data=dbarray($result);

echo "<div style='text-align:center'>
<a href='".BASEDIR."profile.php?lookup=".$data['user_id']."' title='".$data['user_name']."'>\n";
if ($data['user_avatar'] && file_exists(BASEDIR."images/avatars/".$data['user_avatar'])) {
echo "<img src='".BASEDIR."images/avatars/".$data['user_avatar']."' alt='".$data['user_name']."' border='0' width='100'>
<br>
".$data['user_name']."";
}
else {
echo "<img src='".BASEDIR."images/avatars/noimage.gif' alt='".$data['user_name']."' border='0'>
<br>
".$data['user_name']."
</a></div>";
}
}
closetable();
echo "</td></tr></table>";
0 replies
J
Jay
J
Jay 10
  • Member, joined since
  • Contributed 170 posts on the community forums.
  • Started 57 threads in the forums
  • Started this discussions
answered
Member

Thank You guys, appreciated ur help.

TammyK got it yeah wat i was after was to clear the cache in the database UPDATE PREFIX_users SET user_avatar = '''; did it.
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 13 posts
  • Votes 0 votes
  • Topic users 5 members

0 participants

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet