[PHP/MySQL][Ascent] - Playertools.
hey,
I am making some player tools for a server which I am GM on. However, i have come accoss a problem which has stumped me for once and for all.
PHP Code:
$result1 = mysql_query("SELECT acct FROM accounts where login = '$username'") or die("=)");
$result2 = mysql_query("SELECT * FROM characters") or die("=)");
$acctno = mysql_result($result1, 0);
echo $username;
echo $acctno;
echo $chars;
if(mysql_affected_rows($result2) == 0){die ("not good");
This will come up with "Admin 1 not good".
these are the character stored in the db
Code:
Char 1: Guid=1 acct=1 name=dave deathstate=1
Char 2: Guid=2 acct=1 name=bob deathstate=1
any ideas?
Re: [PHP/MySQL][Ascent] - Playertools.
I don't really understand what you're saying? What is the exact output?
anyway, shouldn't it be
PHP Code:
if(mysql_affected_rows($result2) == 0){die ("not good")};
?
Re: [PHP/MySQL][Ascent] - Playertools.
yeah i forgot that syntax, quickly adding it in to show.
i have data inside a characters table. I have a piece of data which identifies an account with the character (acct) so i have got the acct and stored it in a local variable, and then did a query to find the characted associated with that account. However, it doesn't show me any characters, even when i unrestrict it witl SELECT * FROM characters.
any clearer?
Re: [PHP/MySQL][Ascent] - Playertools.
You didn't give us enough of the script =/
I need to see where $chars is set at to see what the problem is
You have a pretty awkward script written lol, not many people use the result function despite its handiness. However your queries are only pulling 1 result. The only thing you're getting from the query is the account number (acct, pretty sure you knew all that - I'm just confused).
This is a fairly simple task but you're making it hard than it is lol
Also it's kinda inefficient to use that function under those circumstances, fetch row, would be much better.
Re: [PHP/MySQL][Ascent] - Playertools.
haha yup a messy script was my problems. redid it all, and fix up little bugs and it all worked like a dream. =) Thanks anyways =)