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
<?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_assoc( mysql_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
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..