Quarterbore
05-06-2006, 10:04 PM
I have a script that I want to be able to convert an entered username (in $username) to the userid (in $userid).
I found an old thread for vb 3.0 here:
https://vborg.vbsupport.ru/showthread.php?t=61558
I tried to use the code suggested in there as follows:
$getuser = $vbulletin->db->query("
SELECT userid,username
FROM myuser
WHERE username = $username
");
$user = $DB_site->fetch_array($getuser);
echo("The userid for $user[username] is <b>$user[userid]</b>");
I know my post is getting the correct $username into this but I am getting a MYSQL error that says...
Database error in vBulletin 3.5.2:
Invalid SQL:
SELECT userid,username
FROM XXXXXXXXXX
WHERE username = Quarterbore;
MySQL Error : Unknown column 'Quarterbore' in 'where clause'
Error Number : 1054
Date : Saturday, May 6th 2006 @ 05:17:49 PM
Script : http://www.XXXXXXXXXX.com/XXXXXXXXXX.php
Referrer : http://www.XXXXXXXXXX.com/XXXXXXXXXX.php?do=ad&id=50
IP Address : XXX.XXX.XXXX
Username : Quarterbore
Classname : vb_database
I just can't finish my minor addition until I can get this basic change of $username into $userid
I really do appreciate any help as I have tried all kinds of combinations for the past 4-hrs or more and I am just stumped...
I found an old thread for vb 3.0 here:
https://vborg.vbsupport.ru/showthread.php?t=61558
I tried to use the code suggested in there as follows:
$getuser = $vbulletin->db->query("
SELECT userid,username
FROM myuser
WHERE username = $username
");
$user = $DB_site->fetch_array($getuser);
echo("The userid for $user[username] is <b>$user[userid]</b>");
I know my post is getting the correct $username into this but I am getting a MYSQL error that says...
Database error in vBulletin 3.5.2:
Invalid SQL:
SELECT userid,username
FROM XXXXXXXXXX
WHERE username = Quarterbore;
MySQL Error : Unknown column 'Quarterbore' in 'where clause'
Error Number : 1054
Date : Saturday, May 6th 2006 @ 05:17:49 PM
Script : http://www.XXXXXXXXXX.com/XXXXXXXXXX.php
Referrer : http://www.XXXXXXXXXX.com/XXXXXXXXXX.php?do=ad&id=50
IP Address : XXX.XXX.XXXX
Username : Quarterbore
Classname : vb_database
I just can't finish my minor addition until I can get this basic change of $username into $userid
I really do appreciate any help as I have tried all kinds of combinations for the past 4-hrs or more and I am just stumped...