And could you give me any security and optimization recommendations?
<?php
$datvariable = $_POST['comingover'];
$datvariable = htmlspecialchars($datvariable);
$datvariable = cleanPost($datvariable);
function cleanPost($item)
{ return mysql_real_escape_string(strip_tags(stripslashes($item))) }
$mysqliobject = new mysqli( 'localhost', 'myusername', 'mypassword', 'mydatabase');
if( mysqli_connect_errno( ) ) { echo "Central SQL Access Malfunction"; exit(); }
$uploadquery = $mysqliobject->prepare(
"INSERT INTO ENTIRETABLE ( WORD, SOUNDCLICKCOUNT ) VALUES (?,'0')
ON DUPLICATE KEY UPDATE SOUNDCLICKCOUNT = SOUNDCLICKCOUNT+1"
);
$uploadquery->bind_param('s', $datvariable);
$uploadquery->execute();
$mysqliobject->close();
?>
I do not see any fatal error for now.
I plan to have a database that has about 10 tables, and each table will contain about 500 records. Each column will have 50 characters at max. Is MySQL good enough for that purpose? It is for a smartphone application that helps students in East Asia learn the English language.
mysql_*
functions mixed withmysqli_*
functions.. along with double escaping \$\endgroup\$