steviez Posted February 13, 2007 Share Posted February 13, 2007 Hi, I run a music website for new bands, i want to be able to give them the option to allow their mp3 to be downloaded free. I only want the download link to apear on listen.php if the user has specified allow downloads in myaudio.php. It needs to pull the song info from the "audio" database. Any ideAs as i am stuck Thanks Link to comment https://forums.phpfreaks.com/topic/38365-solved-help-with-php-page/ Share on other sites More sharing options...
simcoweb Posted February 13, 2007 Share Posted February 13, 2007 One way would be to put a field in the database that provides a 'yes' or 'no' for the downloads and have your query reflect only the yes's. Link to comment https://forums.phpfreaks.com/topic/38365-solved-help-with-php-page/#findComment-183894 Share on other sites More sharing options...
steviez Posted February 13, 2007 Author Share Posted February 13, 2007 i amnew to php, could anyone point me in the right direction on how to do this? Link to comment https://forums.phpfreaks.com/topic/38365-solved-help-with-php-page/#findComment-183895 Share on other sites More sharing options...
simcoweb Posted February 13, 2007 Share Posted February 13, 2007 I'd point you to many of the fine tutorials here at PHPFreaks as well as others you can learn the basics from for free all around the web. Plus, there's always the official PHP site at www.php.net There's some great mini-tutorials and basics on both PHP and MySQL here: http://www.w3schools.com/php/default.asp Link to comment https://forums.phpfreaks.com/topic/38365-solved-help-with-php-page/#findComment-183901 Share on other sites More sharing options...
The Bat Posted February 13, 2007 Share Posted February 13, 2007 To give you a rough outline of what you can do, first you can create a field in the specified table called 'allow_free_mp3' (or whatever you want) and on myaudio.php, have a form with 'yes' or 'no' options and have that inserted into the field: myaudio.php <form action="myaudio.php" method="post"> Allow free MP3s to be downloaded? <select name="allowfree"> <option value="yes">Yes</option> <option value="no">No</option> </select> <input name="update" type="submit" value="Update" /> </form> <?php if ($_POST['update']) { // Connect to your database. mysql_query('INSERT INTO table_name (allow_free_mp3) VALUES ('.$_POST['allowfree'].')') or die (mysql_error()); } ?> listen.php <?php $allowquery = mysql_query('SELECT allow_free_mp3 FROM table_name /* Specify WHERE options */'); $row = mysql_fetch_array($allowquery); if ($row['allow_free_mp3'] == 'yes') { // Your code when free MP3 downloading is allowed. } else { // Your code when free MP3 downloading is NOT allowed. } ?> It isn't that great, but it's a start. If you want to know about using MySQL with PHP, just searh Google. Link to comment https://forums.phpfreaks.com/topic/38365-solved-help-with-php-page/#findComment-183908 Share on other sites More sharing options...
steviez Posted February 13, 2007 Author Share Posted February 13, 2007 Thank you so much! worked like a charm after a little tweaking. Link to comment https://forums.phpfreaks.com/topic/38365-solved-help-with-php-page/#findComment-184011 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.