我试图通过发送PHP帖子请求到列号为
的MySQL来获取MySQL列PHP:
<?php
$columns = $_POST['number'];
$result = mysql_query(" SELECT * FROM table3 order by RAND() LIMIT '$columns'");
?>
HTML:
<form action="file.php" method="post" >
<input type="text" name="number" value="5" autocomplete="off">
<input type="submit" Value="Submit">
</form>
答案 0 :(得分:1)
你在说
SELECT * FROM table3 order by RAND() LIMIT '5'
查看报价问题?
应该是
<?php
$columns = (int)$_POST['number'];
$result = mysql_query(" SELECT * FROM table3 order by RAND() LIMIT $columns");
?>