![]() |
MySQL Query worked in 3.23 but not 4.1 (Help Requested)
Hello Everyone,
I was running MySQL v3.23 until yesterday - I Upgraded to 4.1, with the latest PHP and Apache. I want to run a script locally on the server to remove all the users who were imported from my UBB system, and the lastvisit = 0 (b/c they haven't visited since i've upgraded to vb). Here's the actual query im running minus the connect details: PHP Code:
error 1064: You have an error in your SQL syntax. Check the manual that corresp onds to your mysql server version for the right syntax to use near '3,10,11' So I read up a little, and put 2 OR 3 OR 10 OR 11, but that just totally deleted my entire USER table ( Good thing I make backup of everything before I start :nervous: ) I have this one to run via cron job (worked before) to remove any users who have not visited in the past 365 days. Now this doesn't work either. PHP Code:
|
Change the syntactually incorrect usergroupid clause to:
Code:
...AND usergroupid IN (2, 3, 10, 11) |
hmm, i cannot believe that worked in 3.23
*still wondering* |
Something so simple, yet complex, lol. I Appreciate it! Worked like a charm :) I'm getting a lot better, but still got some training to do, not off training wheels just yet :)
Hope you both had a great Christmas/New Year :) |
Well, It worked one time, and not the next time. I run this via cron script - did not include entire cron script, just the delete statement.. The problem I have is that it will not remove anyone.. I never put it into use on my real db yet. I had to end up recompiling MySQL/PHP/Apache -- Did I maybe not include something I should have when I compiled PHP?? If so, my entire ./configure is below -- thanks for any help, again! :)
My exact DELETE query is this: PHP Code:
Code:
'./configure' '--with-apxs2=/etc/httpd/bin/apxs' '--with-freetype-dir=/usr/local' '--with-png-dir=/usr/local' '--with-gd=/usr/local/gd' '--enable-gd-native-ttf' '--with-ttf' '--with-gdbm' '--with-jpeg-dir=/usr/local' '--with-openssl' '--with-png' '--with-xml' '--with-zlib' '--enable-track-vars' '--with-kerberos=/usr/kerberos' '--with-mysql' '--enable-memory-limit' '--enable-calendar' |
Quote:
|
Quote:
|
Hmm, well, if you're running
Code:
'DELETE FROM user WHERE (lastvisit<'.(time() - (60 * 60 * 24 * 487)).') AND (usergroupid IN (2, 3, 10, 11))' Code:
'SELECT userid FROM user WHERE (lastvisit<'.(time() - (60 * 60 * 24 * 487)).') AND (usergroupid IN (2, 3, 10, 11))' |
WetWired - Thanks for all your help! I just hacked the file with several combinations of what you and filburt have told me to do, and finally must have gotten a good combination.. This leads my to my next question (about the orphaned records).. The hack called "Unactivated User Management" has the following code:
Code:
$DB_site->query("UPDATE post SET username='".addslashes($user[username])."',userid=0 WHERE userid='$user[userid]'"); BTW -- Where do you live in Texas? I am also from Texas and live in Beaumont. Thanks for all of your help and have a great weekend! |
Well, you couldn't do this for the usernames (which should revert to the name of the user when they posted the post, anyway), but for the deletion of tables, after you do the select for users meeting the criteria, you need to run a loop to make a list of IDs. Once you have the list of IDs, you can feed them to each query in turn. So:
Code:
$idlist='0'; [sql]SELECT usertextfield.userid FROM usertextfield LEFT JOIN user ON usertextfield.userid=user.userid WHERE ISNULL(user.username)[/sql] |
All times are GMT. The time now is 02:09 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|