I have a php script that is interacting with the database. It gets an array of the Characters that the user's account has.

I get their account number using

$GetAccNum = "SELECT acct FROM accounts WHERE login = '$user'";
 $AccNumResult = mysql_query($GetAccNum);
 while ($AccNumRow = mysql_fetch_array($AccNumResult, MYSQL_NUM))
 {
 	$AccNum = $AccNumRow[0];
 }

That part works fine.

Now, if they have only one character, i can get their Character name using

$Chars_Exist = "SELECT * FROM characters where acct = $AccNum";
 $Chars_Exist_Result = mysql_query($Chars_Exist);
 $Chars_Exist_Count = mysql_num_rows($Chars_Exist_Result);
 if ($Chars_Exist_Count > 0)
 {
 	$GetChars = "SELECT name FROM characters where acct = '$AccNum'";
 	$CharResult = mysql_query($GetChars);
 	while ($CharRow = mysql_fetch_array($CharResult, MYSQL_NUM))
 	{
 		echo $CharRow[0];
 	}
 }

My problem is, for example, lets say they have two characters. $CharRow[1] Has no value, both names are stored in $CharRow[0]. How can I get each one assigned to its own number?

Thanks for your help,

SiPex

<a href="http://in2.php.net/addslashes">addslashes</a>

Sorry for the mistake .. the previous post is not actually for u..

sorry once again..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.