Jump to content

Search the Community

Showing results for tags 'sql databse'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

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


Age


Donation Link

Found 1 result

  1. Hello everyone! For a home project I have to create a database and a table inside. Then let users insert data into table via simple html form. This form uses a php file to do the inserting, the form is just to get data. I'm using MyphpAdmin in wampserver to create database and table manually. here is my code: in the first file for connecting to server and selecting database <?php $server="localhost"; $user= "root"; $password=""; $connect=@MySQL_Connect($server,$user,$password) or die ("connection failed!"); echo "Server Access granted"; $base= "Mabase"; MySQL_Select_db($base); echo "<br>Mabase was selected" ?> =================== the second file is a simple html form =================== <html> <head> <title>Formulaire de Saisie</title> </head> <body> <form action = "traiter.php" method = "POST"> Enter Code : <input type = "text" name = "Code"></input><br> Enter Designation : <input type = "text" name = "Des"></input><br> Entrez Prix Unitaire : <input type = "text" name = "PU"></input><br> Entrez Quantite en stock : <input type = "text" name = "QS"></input><br> <input type = "submit" value = "valider"> </form> </body> </html> ==================== the third file is traiter.php that you see in the html form ==================== <?php require ("choixBD.php"); $code = $_POST["Code"]; // product code $des = $_POST["Des"]; // meaning $pu = $_POST["PU"]; // unie price $qs = $_POST["QS"]; // quantity $pttc = $pu*1.2; // TAX $nomtable = "Produit"; $req = "INSERT INTO $nomtable (Code,Designation,Quantite,PrixUnitaire,PTTC) VALUES('$code','$des,'$qs','$pu','$pttc')"; $result = @MySQL_Query($req); if (!$result) { echo "<br> impossible to execute ($req) in db".@MySQL_error(); exit; } echo"<br>Values have been added"; ?> ===================== the idea is that the user will open the form file and enter data and click submit and data should be added the problem is that data are not added and I don't know why. here is the error message impossible to execute (INSERT INTO Produit (Code,Designation,Quantite,PrixUnitaire,PTTC) VALUES('s425','gaming mouses,'190','1300','1560')) in dbYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '190','1300','1560')' at line 1 Thanks in advance
×
×
  • 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.