Jump to content

Connecting mysql to PHP


Misomurai

Recommended Posts

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);
      }
    }
    ?>
Link to comment
https://forums.phpfreaks.com/topic/276370-connecting-mysql-to-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.