PDA

Click to See Complete Forum and Search --> : MSQL Help - Returning Value


Gunner54
Aug 1st, 2007, 05:05 PM
$query = mssql_query("UPDATE Character SET Sex = '$Sex' WHERE Name = '$Char'"
$CID = mssql_query("SELECT CID FROM Character WHERE Name = '$Char'");
$query = mssql_query("DELETE FROM CharacterItem WHERE CID = '$CID'"

Obviously i thought $CID would = the value selected. But Obviously it doesnt. How can i make $CID = the SELECT CID FROM Character WHERE Name = '$Char' Value?

Thank You

dclamp
Aug 1st, 2007, 11:18 PM
well on some of those lines you are missing things.


$query = mssql_query("UPDATE Character SET Sex = '$Sex' WHERE Name = '$Char'");
$CID = mssql_query("SELECT CID FROM Character WHERE Name = '$Char'");
$query = mssql_query("DELETE FROM CharacterItem WHERE CID = '$CID'");

penagate
Aug 2nd, 2007, 01:00 AM
mssql_query, if successful, returns a result set, not a single result.

$resultset = mssql_query("SELECT CID FROM Character WHERE Name = '$Char'");

while ($row = mssql_fetch_assoc($resultset))
print_r($row);


More examples on the manual page.
http://php.net/manual/en/function.mssql-query


dclamp—that post is thoroughly unhelpful—missing what, exactly?

dclamp
Aug 2nd, 2007, 01:05 AM
there was some parenthesis missing, some quote marks, and semi-colon