Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <body style="color: #888888;font-size: 75%;">
- <?php
- $myServer = "localhost"; //sql server normally localhost
- $myUser = "radiodb"; //sql db user
- $myPass = "P0hv8jL2"; //sql db pass
- $myDB = "radiodbase"; //sql db name
- #
- $con = @mysql_connect($myServer, $myUser, $myPass) or die('mysql_connect: ' . mysql_error());
- #
- @mysql_select_db($myDB) or die('mysql_select_db: ' . mysql_error());
- #
- #
- $result = array();
- #
- if ($CURUSER["can_dj"] == "yes") {
- if (isset($_GET['id'], $_GET['action'])) {
- mysql_query("DELETE FROM song WHERE id = " . intval($_GET['id']));
- show_error_msg("Deleted", "Request Deleted", 1);
- }
- }
- if ($CURUSER["can_dj"] == "no") {
- show_error_msg("Error", "You dont have permission to delete requests.", 1);
- }
- #
- $res = mysql_query("SELECT * FROM song Limit 10"); //$res = mysql_query("SELECT * FROM song ORDER BY id DESC LIMIT 10");
- #
- while ($row = mysql_fetch_array($res))
- #
- $result[] = $row;
- #
- #
- array_reverse($result);
- #
- //print_r($result);
- #
- foreach ($result as $request) {
- #
- echo htmlspecialchars($request['song_name']) . ' <a href="requests.php?action=delete&id='.$request['id'].'">delete</a><br />';
- #
- }
- #
- #
- mysql_close();
- /*
- $con = mysql_connect("$myServer","$myUser","$myPass"); //connect to the db
- if (!$con) //if you cant connect then do this function
- {
- die('Could not connect: ' . mysql_error()); //say you cant connect and why
- }
- $db_selected = mysql_select_db($myDB, $con); //select the database you will be working with
- if (!$db_selected) { //if you cant select a db
- die ('Can\'t use '+ $myDB + ':' . mysql_error()); //say you cant select it and why
- }
- $query="SELECT * FROM song ORDER by id DESC"; //assign the query that you want to be done from the table and fields and sorting
- $result=mysql_query($query); //do the query you assigned
- $num=mysql_numrows($result); //calculate how many rows there are in the results you queried
- //echo "<b>10 Latest Requests</b><br />"; //output the words 10 Latest Requests
- $i=0; //assign 0 to variable i
- while ($i < $num) { //while i is less than the total number of rows run the function in the brackets
- $songname=mysql_result($result,$i,"song_name"); //assign songname to a variable named $songname from the results
- if ($i < 10) //if i is less than 10 since we only want the first 10 and the id starts at 0
- {
- $b = $i+1;
- echo "$b. $songname<br />"; //output the song name
- }
- $i++; //add 1 to i
- }
- */
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement