Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

Connecting mysql to PHP

$
0
0

Hey, can someone tell me what's wrong with this code?

My browser says that line 3 is wrong, but I'm not sure what's wrong about it.

Thanks 

 

--------------------------------------------------------------------------------------------

 

<?php
    if ($_POST['submit1'] != ''){
      $link = mysql_connect("$dbname", "$_library_lab", "$password");
      if (!$link == FALSE) {
        $database = mysql_select_db('bookmark');
        if ($database==TRUE){
          $name = $_POST['name'];
          $book = $_POST['book'];
          $bookmark = $_POST['bookmark'];
          $shiori = $_POST['shiori'];
 
          $sql="insert into bookmark (name, book, bookmark, shiori) values('{$name}','{$book}','{$bookmark}','{$shiori}')";
          $result = mysql_query($sql);
          if ($result == TRUE){
          }else{
            echo('DB insert Failure!');
          }
        }
        mysql_close($link);
      }
    }
    ?>

Viewing all articles
Browse latest Browse all 13200

Trending Articles