php - Mysql SELECT / INSERT realtime VS Later + Securtiy [Q]uestion prepared Statements -


mysql select / insert realtime vs later + securtiy question prepared statements

hello,

i wrote small script unique in , out counter, timestamp + ip of user , referer gets added txt file , every 5 mins cronjob calls script update db gets data txt file.

i found mysql function "insert delay" - "set update low_priority" im using both commands in cronjob, im thinking, inserting data straight db these both commands, increase db load? or better make every 5 mins.

about script: checks if ip exist if ip exists drops insert, , deletes ips older 24h, if ip not exist adds ip , deletes older 24h , other things, in worst case 15 things db select / insert / update / delete , optimize table each ip

about environment: every 1 sec 5 user coming, , in 5 mins should have around 1500 ips in txt file. table: there arround 300k+ ips, deletes / checks / inserts.

so better make how right now? or possible add data in realtime db insert delayed , on?

ok want improve script, , found out prepared statements, use mysqli extension: sample

$sql = "select * table row1 = ? , row2 = ? , row3 = ?"; $stmt = $mysqli->prepare($sql); $stmt->bind_param('sss', $var1, $var2, $var3); $stmt->execute(); $stmt->close(); 

so dont anymore mysqli->real_escape_string($var); question still possible sql injections, prepared statements? if yes how can prevent this?

thank you


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -