Try to match steam id over mysql

I am trying to make something for my Motd.

the tab will be a lua code, and it will display if the user is VIP or not.

I already have a mysql database with steam id auto added

steamid longtext,
nick longtext,
donated longtext

And only steam ids that have donated are added to that database… soo

I am trying to make a script that will try to find their steam id on the mysql, and if it does, it will show an image (http:// image)
And if it doesn’t… it will show another image but with VIP: benefits (text, paragraph

The images will be either “You are already VIP” or “Go to blah blah to become one”

Can anyone assist me?

Assist you with what? You’ve pretty much told us nothing and to be honest, you say “I am trying to make something for my Motd” when it’s really “I am asking everywhere on the forum for people to ‘help’ me make my entire server for me”.

Seriously, look at the Wiki, there are plenty of tutorials

Your column types need to be changed. Not all values should be longtext. That is just going to take up a ton of space on your database just for placing a small amount of text. steamid could be changed to VARCHAR(20) and donated looks like its supposed to be a simple true/false. If donated is supposed to be a true/false then a better way to do it would be to make it an INT(1) and then have 0 represent non-donor and 1 represent donor. According to your description only donors are on the database so the donated column would then be unnecessary.

For the overall MOTD part you need to give more information. For what you are describing you would need to show us the MOTD script you are using (with all sensitive information removed of course)

We’re not going to make it for you…

If you personally dont want to then dont post at all

I posted this in request, did i not?
Please correct me if i am wrong

You don’t need longtext, just change it to text. Longtext supports a LOT of letters while text can handle less, but enough for SteamID’s etc.

[editline]24th October 2011[/editline]

Just read about MySQL here:

Longtext hold’s string lenght up to 4,294,967,295 characters while text hold’s up to 255 characters

You can also use tinytext and it can store 255 characters

Just use varchar(20) for ‘steamid’ and ‘nick’. I don’t see why you would need ‘donated’ if only donators are in that table.

i am trying to make a lua code

He is in the request section…

[editline]24th October 2011[/editline]

Texts in a mysql DB use link based allocation meaning it can be expanded to fit its contents. A varchar is generally 255 characters but can be upto (65,564?).

I don’t think so, if I’m right it changes from varchar to text when it goes further than 255 characters.

If you wanna be even more precise you may want to use VARBINARY instead of VARCHAR.

If you can code in PHP at all, just use $_GET[‘steamid’] and have line 48 of autorun/client/motd.lua be
Then have PHP check if an entry exists for that steamid in the database and, if so, it loads one image/the other. You can find about a billion tutorials online for PHP/MySQL usage.

…POST? It’s $_GET[ “steamid” ];

Whoops, how’d I screw that up? Fixed it in the post, though :confused:

Hes making a tab, not a web page. He should be using this:

[lua]function _R.Player:IsDonor()
local out, error = mysql.query(database, “SELECT * FROM table WHERE steamid = ‘“player:SteamID()…”’”)
if out and #out == 0 then return false end
return true

you didn’t begin the cocat on player:SteamID, also, player is nil in this instance

Looks like you are asking for one not making it.