View Full Version : Query assistance
Sylvus
08-10-2003, 06:50 PM
I have Firefly's query hack installed, which is great for running querys and has helped me a lot. I just downloaded a hack but the author did not give the full query to enter and I'm a little stumped.
What's the full query to do the following?
use phpMyAdmin to add a row to the user table.
filed : alias
type : varchar
length : 250
and
"then use phpmyadmin to edit 'allowmultiregs' in the settings table to change the description to:"
Normally, vBulletin will stop users signing up for multiple names by checking for a cookie on the user's machine. If one exists, then the user may not sign up for additional names.<br>If you wish to allow your users to sign up for multiple names, then select yes for this option, and they will not be blocked from registering additional usernames.<br>You may track also track multiples. By using this option, the site will try to track and identify other screen names used by each member.
and change the optioncode to
<select name=\"setting[$setting[allowmultiregs]]\">
<option value=\"0\" ".iif($setting[value]==0,"selected","").">NO - Don't allow multiples</option>
<option value=\"1\" ".iif($setting[value]==1,"selected","").">YES - allow multiples</option>
<option value=\"2\" ".iif($setting[value]==2,"selected","").">YES - but track multiples</option>
</select>
Thanks,
Syl...
g-force2k2
08-10-2003, 08:39 PM
i believe filed is the column name?
if so run this query:
ALTER TABLE user ADD alias varchar(250) NOT NULL
g-force2k2
Sylvus
08-11-2003, 07:36 PM
Thanks g-force2k2. That worked. Any suggestions about the last two parts?
Dark_Wizard
08-12-2003, 08:17 AM
UPDATE setting SET description=your description,optioncode=your optioncode WHERE varname=allowmultiregs
Sylvus
08-12-2003, 05:42 PM
Thanks for the tip and I got the first part done correct (the description) but I'm having a heck of a time with the next query to add the select options.
If I use the code provided in the hack (which I must add is the worst documention I've come across in all the hacks I've installed), it works.
This is what the hack installer said to use:
<select name=\"setting[$setting[allowmultiregs]]\">
<option value=\"0\" ".iif($setting[value]==0,"selected","").">NO - Dont allow multiples</option>
<option value=\"1\" ".iif($setting[value]==1,"selected","").">YES - allow multiples</option>
<option value=\"2\" ".iif($setting[value]==2,"selected","").">YES - but track multiples</option>
But in the Control Panel, I receive this error:
Parse error: parse error, expecting `','' or `';'' in /mnt/web/guide/site/forum/admin/options.php(72) : eval()'d code on line 1
No modifications to options.php were ever done during the attempted install of this hack.
So I figured I'd give this a shot,
UPDATE setting SET optioncode '<select name=\"setting[$setting[allowmultiregs]]\"><option value=\"0\" \".iif($setting[value]==0,\"selected\",\"\").\">NO - Dont allow multiples</option><option value=\"1\" \".iif($setting[value]==1,\"selected\",\"\").\">YES - allow multiples</option><option value=\"2\" \".iif($setting[value]==2,\"selected\",\"\").">YES - but track multiples</option>'
But it gives me this error:
mysql error: You have an error in your SQL syntax near ''<select name=\"setting[$setting[allowmultiregs]]\"><option value=\"0\" \".iif($' at line 1
Any help would be appreciated.
Syl...
Dark_Wizard
08-12-2003, 06:28 PM
Hmmm, His code is correct...try this instead:
<select name=\\'setting[$setting[allowmultiregs]]\\'>
<option value=\\'0\\' '.iif($setting[value]==0,'selected','').'>NO - Dont allow multiples</option>
<option value=\\'1\\' '.iif($setting[value]==1,'selected','').'>YES - allow multiples</option>
<option value=\\'2\\' '.iif($setting[value]==2,'selected','').'>YES - but track multiples</option>
Sylvus
08-12-2003, 06:53 PM
Ah I'm such a n00b. I'm sorry I made you ponder your time with this. Your second suggestion did not work but your first one did. It was all me :( If you check out the code I pasted above that did not work, you'll see I forgot to add this to the query.
optioncode='select name
I had optioncode 'select name
No = sign.
In the end, for your own curiosity, the following just worked like a charm:
UPDATE setting SET optioncode='select name=\"setting[$setting[allowmultiregs]]\"> NO - Dont allow multiples YES - allow multiples YES - but track multiples ' WHERE varname='allowmultiregs'
Thanks for the help. Learned to always double and triple check :)
The only problem I have is this. The query ran smoothly but I'm still getting:
Parse error: parse error, expecting `','' or `';'' in /mnt/web/guide/skullport/forum/admin/options.php(72) : eval()'d code on line 1
Under the Allow multiple registrations per user in the CP, which is exactly where that query would update to add the last option.
Should there be a ; perhaps in the query somewhere?
Syl...
Dark_Wizard
08-12-2003, 08:00 PM
You forgot the <" in front of select...
g-force2k2
08-12-2003, 08:09 PM
UPDATE setting SET optioncode='<select name=\"setting[\$setting[allowmultiregs]]\">
<option value=\"0\" \".iif(\$setting[value]==0,\"selected\",\"\").\">NO - Dont allow multiples</option>
<option value=\"1\" \".iif(\$setting[value]==1,\"selected\",\"\").\">YES - allow multiples</option>
<option value=\"2\" \".iif(\$setting[value]==2,\"selected\",\"\").\">YES - but track multiples</option></select>' WHERE varname='allowmultiregs'
you have to escape the variables as well...
regards,
g-force2k2
Dark_Wizard
08-12-2003, 08:22 PM
Today at 05:09 PM g-force2k2 said this in Post #9 (https://vborg.vbsupport.ru/showthread.php?postid=425506#post425506)
UPDATE setting SET optioncode='<select name=\"setting[\$setting[allowmultiregs]]\">
<option value=\"0\" \".iif(\$setting[value]==0,\"selected\",\"\").\">NO - Dont allow multiples</option>
<option value=\"1\" \".iif(\$setting[value]==1,\"selected\",\"\").\">YES - allow multiples</option>
<option value=\"2\" \".iif(\$setting[value]==2,\"selected\",\"\").\">YES - but track multiples</option></select>' WHERE varname='allowmultiregs'
you have to escape the variables as well...
regards,
g-force2k2
Actually it should be:
UPDATE setting SET optioncode='<select name=\\"setting[\$setting[allowmultiregs]]\\">
<option value=\\"0\\" \".iif(\$setting[value]==0,\"selected\",\"\").\">NO - Dont allow multiples</option>
<option value=\\"1\\" \".iif(\$setting[value]==1,\"selected\",\"\").\">YES - allow multiples</option>
<option value=\\"2\\" \".iif(\$setting[value]==2,\"selected\",\"\").\">YES - but track multiples</option></select>' WHERE varname='allowmultiregs'
g-force2k2
08-12-2003, 08:29 PM
i don't see the difference in codes just the double slashes you could use triple or quadruple it wouldn't make a difference...
at least to my knowledge...
g-force2k2
Dark_Wizard
08-12-2003, 08:35 PM
Today at 05:29 PM g-force2k2 said this in Post #11 (https://vborg.vbsupport.ru/showthread.php?postid=425520#post425520)
i don't see the difference in codes just the double slashes you could use triple or quadruple it wouldn't make a difference...
at least to my knowledge...
g-force2k2
You still need to keep the escape for the value and the name in the database...
g-force2k2
08-12-2003, 08:45 PM
no you don't because they aren't variables until they pass on the HTTP submit...
regards,
g-force2k2
Sylvus
08-12-2003, 09:37 PM
Fixed. I re-ran the query. This ran cleanly.
UPDATE setting SET optioncode='<select name=\"setting[$setting[allowmultiregs]]\">
<option value=\"0\" ".iif($setting[value]==0,"selected","").">NO - Dont allow multiples</option>
<option value=\"1\" ".iif($setting[value]==1,"selected","").">YES - allow multiples</option>
<option value=\"2\" ".iif($setting[value]==2,"selected","").">YES - but track multiples</option>
</select>' WHERE varname='allowmultiregs'
Yet I'm still getting this error under the spot it should be displayed in the CP.
Parse error: parse error, expecting `','' or `';'' in /mnt/web/guide/skullport/forum/admin/options.php(72) : eval()'d code on line 1
I've tried to put a ; at the end of </select>;'
or
</select>';
or at the end of
varname='allowmultiregs';
or even
varname='allowmultiregs;'
All of these run with success yet still generate a parse error.
I even tried this, based on a hack made by Drak and the query runs OK but it still generates a parse error.
I'm stumped :(
Syl...
g-force2k2
08-12-2003, 09:40 PM
try updating the optioncode='' and see if it still generates a parse error...
if so it has something to do with an eval function have you done any other modifications or edited any templates?
regards,
g-force2k2
Sylvus
08-13-2003, 12:16 AM
Ack! I had left my post reply open for over an hour and didn't see all the posts above mine. I'm going to read those and go through the steps you suggested and see what I can come up with before I reply to your question above.
I just ran:
UPDATE setting SET optioncode='<select name=\"setting[\$setting[allowmultiregs]]\">
<option value=\"0\" \".iif(\$setting[value]==0,\"selected\",\"\").\">NO - Dont allow multiples</option>
<option value=\"1\" \".iif(\$setting[value]==1,\"selected\",\"\").\">YES - allow multiples</option>
<option value=\"2\" \".iif(\$setting[value]==2,\"selected\",\"\").\">YES - but track multiples</option></select>' WHERE varname='allowmultiregs';
This was the result:
Query added to database: ... Success!
Viewing changes in CP: Parse error: parse error, expecting `','' or `';'
So on to Dark_Wizards suggestion of running:
UPDATE setting SET optioncode='<select name=\\"setting[\$setting[allowmultiregs]]\\">
<option value=\\"0\\" \".iif(\$setting[value]==0,\"selected\",\"\").\">NO - Dont allow multiples</option>
<option value=\\"1\\" \".iif(\$setting[value]==1,\"selected\",\"\").\">YES - allow multiples</option>
<option value=\\"2\\" \".iif(\$setting[value]==2,\"selected\",\"\").\">YES - but track multiples</option></select>' WHERE varname='allowmultiregs';
Query added to database: ... Success!
Viewing changes in CP: WORKED!
Sorry about the post above where I state "
Fixed. I re-ran the query. This ran cleanly." as that was a post I left replying to for over an hour.
This issue is resolved but now my question is, could one of you make me understand why Dark_Wizards suggestion worked and the others did not?
Syl...
Dark_Wizard
08-13-2003, 01:06 AM
Let g-force2k2 explain it as he said what I did wouldn't make a difference.
Sylvus
08-13-2003, 01:23 AM
Oh come on! Don't be like that :)
The two of you took the time to help me out and I'm thankful for that. It's not going to help me learn how things work if you say stuff like that Mr. Wizard!
I'm sure G-Force2k2 didn't mean anything personal by his comment but rather, going on what he has learned from being here.
Well, I hope someone explains it.
Thanks again, both of you, right or wrong, it was a great lesson in syntax.
Syl...
g-force2k2
08-13-2003, 02:15 AM
Today at 10:06 PM Dark_Wizard said this in Post #17 (https://vborg.vbsupport.ru/showthread.php?postid=425612#post425612)
Let g-force2k2 explain it as he said what I did wouldn't make a difference.
wtf is up with the attitude?
you have a problem then act your age not like some two year old whinning that he was right...
i said "to my knowledge" so i learned something new like wtf is your problem with that?
i helped and you helped you don't like me helping then fine, can't help that im still learning... do a favor and get a life instead of starting fights because im just trying to help and you acting like an ass only shows how immature you are.
And don't say you aren't trying to prove that you're better because in another thread i was helping someone and you stepped in and just felt like showing that you're some kind of special person... well i hope you feel special for trying to act all bad online...
take Syl's advice we both learned something... if you want to be an ass and keep on targeting me then i won't waste my time helping others... get a life...
g-force2k2
Dark_Wizard
08-13-2003, 10:02 AM
I don't have an attitude, sorry if it was taken that way I was only trying to make a point and actually forgot to add the wink smilie as I originally intended. This had nothing to do with anything other than letting people learn why this works and why that doesn't. I struggled over this many months ago and couldn't understand why until I asked over at sitepointforums.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.