Using PWN To Write To MySQL DB - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Using PWN To Write To MySQL DB (
/showthread.php?tid=90238)
Using PWN To Write To MySQL DB -
jeff223 - 07.08.2009
I was hoping someone would be able to create me a script that would write information (bans) to a MySQL Database. I currently have this PHP script that retrieves the information and would like the PWN script to automatically put the ban in the separate rows of the database if someone is banned (/adban id reason). (Also, is it possible to put a date/time when the person was banned, if so, could you add that in as well?) Thanks in advance! Here is the PHP script, so you guys have the rows/w/e:
Код:
<?php
mysql_connect("secret_database", "secret_user", "secret_password") or die(mysql_error());
echo "Connected to MySQL<br /><hr />";
mysql_select_db("secret_database") or die(mysql_error());
echo "Connected to Database<br /><hr />";
$query = "SELECT * FROM bans";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)) {
echo "<b>Name: </b>" . $row['Name'] . "<b> - Reason: </b>" . $row['Reason'] . "<b> - Admin: </b>" . $row['Admin'] . "<b> - IP: </b>" . $row['IP'] . "<b> - Date: </b>" . $row['Date'];
echo "<br />";
}
?>
Re: Using PWN To Write To MySQL DB -
jeff223 - 07.08.2009
Also, each of the different strings of the thing would have to be like separate in separate fields. Just to clarify that.
Re: Using PWN To Write To MySQL DB -
jeff223 - 07.08.2009
So basically if you can't script in PHP, I need a pwn MySQL script that stores bans in the rows: Name, Reason, Admin (Who banned them), IP, Time when banned. Hope this helps!