Posts: 116
Location: Canandaigua, NY
|
Quote:
|
Originally Posted by NuWeb.co.uk
This is my current query:
Code:
$sql_query = "SELECT * FROM games WHERE gameid = $gameid";
//store the SQL query in the result variable
$result = mysql_query($sql_query);
if(mysql_num_rows($result))
{
//output as long as there are still available fields
while($row = mysql_fetch_array($result))
{
$gamefile = $row[gamefile];
$gamelocation = $row[gamelocation];
}
}
What i want to do is also update timesplay, so basicaly +1
I was wondeing instead of createing annouther query, is it not possible to do something on the lines of:
Code:
$sql_query = "SELECT * FROM games WHERE gameid = $gameid; UPDATE games SET gamesplay = '1'";
|
this will have to be done in two separate queries. mysql handles each query separately. as long as you are only connecting once, you shouldn't be suffering any loading lag if that is what you are worried about. but, the code that you posted would generate an SQL error.
also, in theory, to do what you're trying to do, you'll probably actually need 3 queries, one to select the game, one to retrieve how many times it has been played, then +1 with php, then a third query to update the number of times played
__________________
Please login or register to view this content. Registration is FREE : A distinguished web presence begins with distinguished web developers.
|