I feel like I'm bothering the only two people who really help out with PHP here (SuperWaffle and Secured), but asking questions is the best way to learn so.
I'm creating a "Send Item to Rank" script. I'm assuming it would be easiest to use an INNER JOIN to take the UGradeID from the Account table to check it's rank, and then take the CID from Character where the AID is equal to an AID with that rank.
This may be unfinished as I made it in a test file while I was working out the bugs.
PHP Code:
<?php
include("secure/config.php");
include("secure/functions.php");
include("secure/anti_sql.php");
include("language/$language.php");
?>
<form action="test.php" method="post">
<table width="350" align="center" height="60" border="0" style="font-weight:bold; color:#FF3300;">
<tr><td><?php echo $admingmp['64'].' :'; ?></td><td align="right"><input type="text" name="itemid" class="tbl_colbor" /></td></tr>
<tr><td><?php echo $admingmp['36'].' :'; ?></td><td align="right"><select name="rank" class="tbl_colbor">
<option value="255"><?php echo $staff['1']; ?></option>
<option value="254"><?php echo $staff['4']; ?></option>
<option value="0"><?php echo $staff['6']; ?></option>
<option value="253"><?php echo $staff['7']; ?></option>
</select></td></tr>
<tr><td></td><td width="130" align="right"><input type="submit" name="changerank" value="<?php echo $admingmp['4']; ?>" /></td></tr>
</table>
</form>
<?php
if(isset($_POST['changerank'])){
$rank = $_POST['rank'];
$itemid = $_POST['itemid'];
$sql = mssql_query("SELECT a.AID, b.CID FROM Account a INNER JOIN Character b ON a.AID = b.AID WHERE a.UGradeID='$rank'");
if(!$rank OR !$itemid){
echo $admingmp['174'];
}elseif(strlen($itemid)>9){
echo $admingmp['67'];
}elseif(mssql_num_rows($sql)<>0){
$CID = mssql_result($sql, 1, 'CID');
echo $CID;
$sql2 = mssql_query("INSERT INTO CharacterItem (CID, ItemID, RegDate, RentDate, cnt) VALUES('$CID','$itemid',GETDATE(),GETDATE(),'1')");
echo $admingmp['66'];
}else{
echo $admingmp['6'];
}
}
?>
Thanks, and thank you for your time.