Jump to content

Dime

New Members
  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Dime

  • Rank
    Newbie
  1. Hello I work on my school project where we have to create a website with front and back end. So I decided to create a lyrics website. I created a DB, with a table table called "lyrics" This is the structure: CREATE TABLE lyrics ( lyricsId int(8) PRIMARY KEY AUTO_INCREMENT, artist varchar(100), song varchar(100), cover varchar(100), lyrics varchar(9999), chartId int(8), commentId int(8), FOREIGN KEY (chartId) REFERENCES charts(chartId), ); So right now I dont know how I can create a Editlyrics.php button where I can edit he lyrics by the ID page for example I have 2 sogns with lyrics and when i press on a song i go to the lyris of that song, and on that page I want to have a button where i can edit the lyrics. Tjis is what i did: I created a editlyrics.php file and added this code, but its not working and I know for a fact that nothing is right here, there are so many errors, but I dont know what the errors are or how can i fix this... <?php session_start(); include("connectdb.php"); $id = $_SESSION['id']; $lyricsId = $_POST['lyricsId']; $col = "UNDEFINED"; if(isset($_POST['lyricsId'])){ $col = "lyrics"; $val = $_POST['lyrics']; } $query = "UPDATE lyrics SET $col='$val' WHERE lyricsId=$id;"; if(mysqli_query($dbc_form,$query)){ header("Location: index.php"); }else{ $_SESSION['error_msg'] = "Same Lyrics!"; header("Location: index.php"); } ?> Any help? thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.