how to connect phpmyadmin with my website - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: Other (
https://sampforum.blast.hk/forumdisplay.php?fid=7)
+--- Forum: Everything and Nothing (
https://sampforum.blast.hk/forumdisplay.php?fid=23)
+--- Thread: how to connect phpmyadmin with my website (
/showthread.php?tid=443170)
how to connect phpmyadmin with my website -
Geeboi_Mehdi - 10.06.2013
i was wondering how can i make my website show statistics from data from phpmyadmin like shows players stats etc
Re: how to connect phpmyadmin with my website -
Vince - 10.06.2013
You mean MySQL. phpMyAdmin is just a graphical interface.
You need to know PHP. If you don't know this or don't want to learn it then I'd advice downloading a ready made control panel.
Re: how to connect phpmyadmin with my website -
DanLore - 10.06.2013
Well, here's a start...
PHP код:
<?php
// Connect to your database (as Vince explained, phpMyAdmin is merely an interface)
$mysqli = new mysqli("localhost", "user", "pass", "db_name");
// Query your stats table? $user_id is a fictitious variable..
$tableQuery = $mysqli->query("SELECT * FROM `stats_table` WHERE `id` = '1'");
// Fetch an array for the data
$user = $mysqli->fetch_array(MYSQLI_BOTH);
?>
I'm using MySQLi as mysql_ is deprecated as far as I know. The other option might be PDO, but that's not necessarily needed. The queries above are fictional, don't expect them to work without some edits to match your database.
Re: how to connect phpmyadmin with my website -
Geeboi_Mehdi - 10.06.2013
wow thanks guys can you tell me some more about this