Jump to content

Search the Community

Showing results for tags 'mysql_error'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 1 result

  1. Hi, I am having an Issue inputting data into my database with this code. I tested the connection, which works fine, but when I try to submit the form I get the "die("lid query: " . mysql_error());". Any Ideas? <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <form action="thispage.php" method="POST"> <input type="text" name="name" placeholder="Check-in Name"> <input type="submit" value='submit'></form> <?php if (isset($_POST['submit'])) { $name = $_POST['name']; $host ="localhost"; $username = "username"; $password = "password"; $dbname = "database"; $con = mysql_connect($host, $username, $password, $dbname); //Check Connection if (!$con) { die("Could not connect: " . mysql_error()); } //Select your database mysql_select_db("database",$con); //Check to make sure the database is there if (!$mysql_select_db) { die ('Can't use the db : ' . mysql_error()); } //Run query $insert = mysql_query("insert into Users(name) values ('$name')"); } //Check Query if (!$insert) { die("lid query: " . mysql_error()); } echo "Data inserted"; mysql_close($con); ?> </body> </html>
×
×
  • Create New...