Jump to content

Help Looking And Overright Data Base


just me and php

Recommended Posts

[code] switch( $tableselect )
{
case "ABC": $tablename = "TB1"; break;
case "DEF": $tablename = "TB2"; break;
case "123": $tablename = "TB3"; break;
case "456": $tablename = "TB4"; break;
default: die("Invalid Table Selected."); break;
}

if( $tableselect == "ABC" || $tableselect == "123" )
{//If this is a HotLap Record, we store this information
$fields = "Username, track, HL_F, HL_MS, online, disp, PCLabel, PCValid, PC, date, display, hacked, MP, os";
$values = "'$username', '$track', '$time_f', '$time_ms', '$online', '$disp', '$PCLabel', '$PCValid', '$PC', '$date', '$display', '$hacked', '$MP', '$os'";
}
else
{//And if this is a Total Race Time Record, we store this information
$fields = "Username, track, TRT_F, TRT_MS, online, disp, date, display, hacked, MP, os";
$values = "'$username', '$track', '$time_f', '$time_ms', '$online', '$disp', '$date', '$display', '$hacked', '$MP', '$os'";
}
$query = 'INSERT INTO ' . $tablename . ' (' . $fields . ') VALUES (' . $values . ')';
//echo $query . "<br />";
[/code]

This inserts data into my data base and works great but i need it to look at data base for

[code]$fields = "Username, track, HL_F, HL_MS, online, disp, PCLabel, PCValid, PC, date, display, hacked, MP, os";[/code]

First and over right if (HL_F, HL_MS,)Are a smaller numbers ( faster Times )

Can someone help me with code
thanks inavance ;)
Link to comment
https://forums.phpfreaks.com/topic/25828-help-looking-and-overright-data-base/
Share on other sites

Sorry il try to make this clearer
the code at top is php and it inserts data into mysql database from a exe file that users have on there computers for racing game. So i guess you would call it and interface code between users computers and database.
The code works great for inserting data , the problem is it inserts all the data every time user post new times (HL_F, HL_MS,)on same track(track) , I need the code above to look at data base and see that the new time (HL_F, HL_MS,)on the same track(track) and same user(username) is faster or slower if slower no post new data if faster it over rights the data.

faster times would be smaller numbers in(HL_F, HL_MS,)
or
slower times would be biger numbers in (HL_F, HL_MS,)

hope this this clearer

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.