This is a pretty simple function yet it keeps giving me errors. Im writing a script to generate 100 10-digit random numbers but i keep having this error: "check the manual that corresponds to your MySQL server version for the right syntax to use near ''rand(1111111111, 9999999999)'' at line 1" This is my code
<?php
$cxn = new mysqli("localhost", "CJroot", "password", "random");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
for ($i=0; $i < 100; $i++) {
$sql = "INSERT INTO random (random) VALUES 'rand(1111111111, 9999999999)'";
if(!mysqli_query($cxn,$sql))
{
die("Error: ".mysqli_error($cxn));
}
}
/* close connection */
$cxn->close();
?>
Aucun commentaire:
Enregistrer un commentaire