Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - sk

Pages: [1]
1
Script Discussion / Re: Full document for Squirrel plugins
« on: October 05, 2014, 01:13:06 am »
if ( q && mysql_num_rows( q ) > 0 )
THANKXXXXXXX
worked :}
(Why didn,t i think of that >.<)

2
Script Discussion / Re: Full document for Squirrel plugins
« on: October 03, 2014, 10:05:20 pm »
Code: [Select]
function onScriptLoad()
{
local DB = mysql_connect("localhost", "user", "pass", "database");
if ( DB )
{
local q = mysql_query(DB, "SELECT * FROM accounts WHERE `username` = '" + mysql_escape_string( DB, "TestUser") + "'");
if ( q )
{
local row = mysql_fetch_assoc( q );
print( "Username: " + row["username"] );
print( "IP: " + row["ip"] );
}
else
print("Query failed: " + mysql_error( DB ) );
}
else
print("Connection to MySQL failed: " + mysql_error( DB ) );
}

Returns:
Quote
[SCRIPT]  Username: TestUser
[SCRIPT]  IP: 127.0.0.1
Thankx it works perfectly but only if data already exist in database if we change the Name "TestUser" to something else it shows index `Name` does not exist
so when i created a function to check if the player is registered or not its just showing an error.
so any way to get around it?

3
Script Discussion / Re: Full document for Squirrel plugins
« on: October 02, 2014, 08:02:08 pm »
thankx for the mysql sockets
one question how can we use mysql_fetch_assoc which stores all the data in arrays so very useful if used with loops in php
but in squirrel i don,t understand the arguments.According to your post
mysql_fetch_assoc( mysql_connect(szServer,szUser,szPass,szDatabase) );
but in php it is
mysql_fetch_assoc( mysql_query( SELECT 'blah' FROM 'blah' (etc) ) );
so can u please tell me the correct arguments to use SELECT function as sqlite had GetSQLColumnData(querysql(query) ); to get SELECT query
i will show u some of my codes that i used in php 
Code: [Select]
<?php
$db 
mysql_connect('localhost','root','mypass');
$mydb mysql_select_db('sk');
function 
getip($name){
$sql "SELECT * FROM testaccount where name = '$name'";
$row mysql_fetch_assocmysql_query($sql) );
$ip $row['IP'];
return 
$ip;
}
echo 
$getip getip('sk');

?>
this above code works good for php page but now check it out for squirrel
Code: [Select]
function onScriptLoad()
{
    stats <- array( GetMaxPlayers(), null );
db <- mysql_connect("localhost","root","mypass","Sk");
}
function getip(player){
local sql = "SELECT * FROM 'testaccount' where 'Name' = '"+player.Name+"'";
local row = mysql_fetch_assoc( mysql_query(db,sql) );
local ip =  row["IP"];
return ip;
}
function onPlayerCommand( player , cmd , text){
if ( cmd == "myip"){
local myip = getip(player);
MessagePlayer("Your last used ip was : " + myip,player);
}
Note = 'mypass' is not my original pass.
not its just a test server so i m just testing to use select query fucntion in squirrel which i m not able to do successfully >.<.
so ysc123 can u please tell me any alternative way to do it? or just fix the code that i provided..

4
Script Discussion / Re: MySQL Connect
« on: October 02, 2014, 07:29:32 pm »
Thankx thijin problem solved
and about no password Like i said i am testing it on my localhost server(xampp) so no need for pass thankx for the help..
locked..

5
Script Discussion / MySQL Connect
« on: October 01, 2014, 06:55:19 pm »
i wanted to use mysql database managed by phpmyadmin on my server.After connecting mysql plugin i used
OnScriptLoad(){
some of my own shity functions and then
mysql_connect("localhost","root","Sk",NULL);
}
so
localhost = my Server
root = my username(on sercver)
Sk = my database
NULL = password which in this case is not present
but after loading the executable file it says invalid argument.
this mysql_connect(); function is taken from php i don,t know how can i connect MySQL database i know that function mysql_connect works but i don,t know the exact arguments of this functions in squirrel so can any one can please tell me the how can i use this function in my 0.4 server.
Note = i m just testing my server in localhost (xampp).
so can any one tell me how can i connect my[ ;) ] MySQL database in my server.

6
Script Discussion / Re: Getting an error regarding ELF file OS ABI invalid.
« on: September 17, 2014, 08:22:08 pm »
well linux is case sensitive i got that same error. I Got it working by renaming "Plugins" folder to "plugins"

Pages: [1]