Please Help ME For Update Database

Discussion in 'MySQL' started by salayhin, Nov 19, 2009.

  1. #1
    I have a code like this but it couldn't run and database couldn't edited.
    Please help me ASAP.

    ###################################
    From To Input
    ###################################
    <?php
    /*
    session_start();
    $_SESSION["username"];
    $_SESSION["password"];
    $username=$_SESSION["username"];
    $password=$_SESSION["password"];


    include('config/common_db.inc');
    db_connect();

    $qu_chk = mysql_query("select * from music_admin where user_name='$username' and admin_password='$password'");
    $no_f = mysql_num_rows($qu_chk);

    */
    ?>
    <html>

    <head>
    <link href="files/CSS/style.css" rel="stylesheet" type="text/css">
    <title>.::Edit Song::.</title>

    </head>

    <body>

    <?php include('menubar.php');
    include('config/common_db.inc');
    db_connect();
    add_header();
    admin_menu();
    search();?>
    <div align="" id=leftcol>
    <?php
    echo "<h4>";
    echo "Welcome ";
    //echo $_SESSION["username"];
    echo "<br>";
    echo "Today is ";
    echo date("d.m.Y");
    echo "</h4>";
    ?>
    </div>

    <div align="center">
    <h2>.::Edit Song::.</h2>
    <?php
    $id=$_GET[id];

    $query="SELECT * FROM song_detail WHERE song_ID=$id";
    $result=mysql_query($query);
    $row=mysql_fetch_array($result);

    /*
    $query1="SELECT * FROM music_admin WHERE admin_ID=$row[3]";
    $result1=mysql_query($query1);
    $admin=mysql_fetch_array($result1);
    */

    $query2="SELECT * FROM album WHERE album_ID=$row[4]";
    $result2=mysql_query($query2);
    $album=mysql_fetch_array($result2);


    $query1="SELECT * FROM music_category WHERE catagory_ID=$row[5]";
    $result1=mysql_query($query1);
    $mus_cat=mysql_fetch_array($result1);





    $query4="SELECT * FROM singer_band WHERE singer_ID=$row[6]";
    $result4=mysql_query($query4);
    $singer=mysql_fetch_array($result4);

    $query5="SELECT * FROM add_image WHERE album_ID=$row[4]";
    $result5=mysql_query($query5);
    $al_img=mysql_fetch_array($result5);
    ?>


    <!--Edit Start-->

    <form action="update_song.php?song_id=$id" method="get">
    <table width="700" border="0" align=center class="table_admin_section">

    <tr class="tda">
    <td width="50"> <center><b>Image</b></center></td>
    <td><img src=album_images/<?php $al_img[4];?> width="80" height="80" alt=<?php echo "$al_img[3]"; ?>" border="0"></td>
    </tr>

    <tr class="td">";
    <td width="50"> <center><b>Title</b></center></td>
    <td><input name="title" type="text" value="<?php echo "$row[1]"; ?>" size="80"></td>
    </tr>

    <tr class="tda">
    <td width="100"> <center><b>Description</b></center></td>
    <td><input name="description" type="text" value="<?php echo "$row[2]" ; ?>" size="80"></td>
    </tr>

    <!--
    <tr class="tda">
    <td width="20"> <center><b>Admin Name</b></center></td>
    <td><input name="admin" type="text" read only></td>
    </tr>
    -->



    <tr class="tda">
    <td width="30"> <center><b>Album Name</b></center></td>
    <td><?php echo "$album[1]"; ?> <select size=\"1\" name=\"album_name\">
    <option>Select Album</option>
    <?php
    $query_album="SELECT * FROM album ORDER BY album_Name";
    $result_album=mysql_query($query_album);
    while($row_album=mysql_fetch_array($result_album))
    {
    echo "<option value=\".$row_album[0].\">$row_album[1]</option>\n";
    }
    ?>
    </td>
    </tr>

    <tr class="tda">
    <td width="20"> <center><b>Music Category</b></center></td>
    <td width="10"><?php echo "$mus_cat[1]" ; ?>
    <select size=\"1\" name=\"song_category\">
    <option>Select Your Song Category</option>
    <?php
    $query_category="SELECT * FROM music_category ORDER BY name";
    $result_category=mysql_query($query_category);
    while($row_category=mysql_fetch_array($result_category))
    {
    echo "<option value=\".$row_category[0].\">$row_category[1]</option>\n";
    }
    ?>

    </select>
    </td>
    </tr>

    <tr class="tda">
    <td width="30"> <center><b>Singer</b></center></td>
    <td> <?php echo "$singer[1]"; ?>
    <select size=\"1\" name=\"singer_id\">
    <option>Select Singer</option>
    <?php
    $query_singer="SELECT * FROM singer_band ORDER BY singer_Name";
    $result_singer=mysql_query($query_singer);
    while($singer_band=mysql_fetch_array($result_singer))
    {
    echo "<option value=\".$singer_band[0].\">$singer_band[1]</option>\n";
    }
    ?>
    </td>
    </tr>

    <tr class="tda">
    <td width="80"> <center><b>Song Name</b></center></td>
    <td><input name="song_name" type="text" value="<?php echo "$row[7]"; ?>" size="80"></td>
    </tr>

    <tr class="tda">
    <td width="80"> <center><b>Song Path</b></center></td>
    <td><input name="song_path" type="text" value="<?php echo "$row[8]"; ?>" size="80"></td>
    </tr>

    <tr class="tda">
    <td width="30"> <center><b>Update</b></center></td>
    <td width="30"><input type="submit" value="Update"></td>
    </tr>


    </table>








    </form>

    <!--Edit End-->
    </div>


    <br>
    <br>
    <br>
    <?php footer(); ?>

    </body>

    </html>





    ###############################################
    Update Script
    ###############################################
    <?php
    /*session_start();
    $_SESSION["username"];
    $_SESSION["password"];
    $username = $_SESSION["username"];
    $password = $_SESSION["password"];
    */
    ?>
    <?php
    include('config/common_db.inc');
    db_connect();
    ?>
    <?php
    /*
    $qu_chk = mysql_query("select * from music_admin where user_name='$username' and admin_password='$password'");
    $row=mysql_fetch_array($qu_chk);
    $no_f = mysql_num_rows($qu_chk);
    $user_id=$row[0];
    if($no_f !=1)
    {
    header('location:index.php');
    exit;
    }
    */
    ?>


    <html>

    <head>
    <link href="files/CSS/style.css" rel="stylesheet" type="text/css">
    <title>.::Update Song::.</title>

    </head>

    <body>



    <?php include('menubar.php');
    add_header();
    admin_menu();
    search();
    $song_idy=$_GET["song_id"];
    $song_title=$_GET["title"];
    $song_description=$_GET["description"];
    $album_id=$_POST["album_name"];
    $music_category_id=$_GET["song_category"];
    $singer_id=$_GET["singer_id"];
    $song_name=$_GET["song_name"];
    $path=$_GET["song_path"];


    $my_update = mysql_query( "UPDATE song_detail SET
    song_Title='$song_title',
    description='$song_description',
    album_ID='$album_id',
    music_category_ID='$music_category_id',
    singer_ID='$singer_id',
    song_name='$song_name',
    song_Path='$path' WHERE song_ID='$song_idy'") or die(mysql_error());
    //echo "Song Updated Successfully!";

    //$result=mysql_query($my_update)



    ?>

    <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
    <?php footer(); ?>
    <!--Add Add Singer/Band Form End-->

    </body>

    </html>




    ######################################

    Where Is the problem.

    Please Help Me.
     
    salayhin, Nov 19, 2009 IP
  2. gacba

    gacba Peon

    Messages:
    75
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Throw us a bone here, man...what's your error message? What's the output? Something! :)
     
    gacba, Nov 20, 2009 IP
  3. salayhin

    salayhin Peon

    Messages:
    51
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    There is no error massage showing and nothing change in database.
     
    salayhin, Nov 20, 2009 IP