0

I have tried "everything" to get it working, but I just doesn't :-(

$maxcount = 3;
$conn->query("INSERT INTO getal (getal, aantalmaal) SELECT getal, aantalmaal FROM v_topgetallen limit '.$maxcount.'");

Do you guys have any idea? Thanks a lot!

chris85
  • 23,846
  • 7
  • 34
  • 51
franky555
  • 31
  • 7

1 Answers1

1

Try this:

$maxcount = 3;

$conn->query("INSERT 
              INTO getal (getal, aantalmaal) 
              SELECT getal, aantalmaal 
              FROM v_topgetallen 
              LIMIT $maxcount");

but please use prepared statements.

KIKO Software
  • 15,283
  • 3
  • 18
  • 33
  • Yes! That works!! I'll try to find out if I can use prepared statements. Thanks a lot! – franky555 Sep 20 '17 at 19:14
  • @franky555 You can find information on [Prepared Statements](https://en.wikipedia.org/wiki/Prepared_statement) for [MySQLi](http://php.net/manual/en/mysqli.quickstart.prepared-statements.php) or [PDO](http://php.net/manual/en/pdo.prepared-statements.php). – GrumpyCrouton Sep 20 '17 at 19:25
  • Thanx, I'll read about it. – franky555 Sep 20 '17 at 19:29