Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function countusers($connection, $column, $table)
- {
- $stmt = mysqli_prepare($connection, "
- SELECT
- COUNT($column)
- FROM
- $table");
- if($stmt)
- {
- mysqli_stmt_bind_result($stmt, $num);
- mysqli_execute($stmt);
- mysqli_stmt_fetch($stmt);
- mysqli_stmt_close($stmt);
- }
- return $num;
- }
- <?php
- require_once "conn.php";
- include "func.php";
- echo countusers($conn, "id", "mods");
- <?php
- $conn = mysqli_connect("localhost", "root", "", "test", 3306);
- if(!$conn)
- {
- echo "An Error Occurred";
- }
- //... SNIP...
- if($stmt)
- {
- mysqli_stmt_execute($stmt); // Changed this to mysqli_stmt_execute
- mysqli_stmt_bind_result($stmt, $num);
- mysqli_stmt_fetch($stmt);
- mysqli_stmt_close($stmt);
- }
- return $num;
- // ... SNIP ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement