Just a quick question, I am trying to convert a few older modules I have laying around the place, and was wondering if there is a better way to do the following:
First, an example of the old code:
Code:
$tmpOpponentID = mysql_query("SELECT blackPlayer FROM games WHERE gameID = ".$_POST['gameID']);
$opponentID = mysql_result($tmpOpponentID, 0);
Then the code that I have converted it to that works:
Code:
$tmpOpponentID = $db->sql_query("SELECT blackPlayer FROM "$.prefix."_chess_games WHERE gameID = ".$_POST['gameID']);
$row = $db->sql_fetchrow($tmpOpponentID);
$opponentID = $row[0];
My question is: Is there some other function that I am missing that does the above, without the temporary assignment of $row?!? Is there an equivalent function of mysql_result(), that actually returns a single element from an array of database queries?!?
Thanks, did try passing a query to _fetchrow, and when it didn't work, I figured ya meant it like above
I have "standardised" on the list() method for single elements, and just leaving arrays as is via _fetchrow
I have even managed to implement auto table creation in an Administration module for the standalone version of "WebChess v0.8.2" found around the place, all up-to-date and RN2.30.01 compliant!!
View next topic View previous topic
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum