Jump to content

acer2

Member
  • Posts

    2
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    Suriname

About acer2

acer2's Achievements

0

Reputation

  1. Well, I'm embarred to say that I had made a little mistake . The first variable was numeric, so the quotes ("username") where wrong. And the rest should have been : "$passwrd", "$adres") You can say I solved the problem myself thanks anyway. acer
  2. Hi, I was wondering if someone knows the answer. I just installed Wamp with: Apache Version : 2.2.8 PHP Version : 5.2.5 and phpMyAdmin - 2.11.5 with MySQL client version: 5.0.45 and Used PHP extensions: mysqli. I want to insert data in a table. The table exist in mysql! I do everything correct but i keep getting this error: Couldn’t execute query This is the code: connect.php <?php //connect to database $server='localhost'; $host='127.0.0.1'; $user='root'; $password=''; $dbname = 'tester'; $cxn = mysqli_connect($host,$user,$password,$dbname) or die ('Couldn’t connect to server.'); $username = $_POST["username"]; $passwrd = $_POST["passwrd"]; $adres = $_POST["adres"]; $query = 'INSERT INTO test1 (username, passwrd, adres) VALUES ($username, $passwrd, $adres)'; $result = mysqli_query($cxn,$query) or die ('Couldn’t execute query.'); echo "Data inserted in table " . ; ?> </body> </html This is the code for the form: add.php <html> <head> <title> add</title> </head> <body> <form action="adduser.php" method="post"> <table width="400" border="0" cellspacing="1" cellpadding="2"> <tr> <td width="100">User</td> <td><input name="username" type="text" id="username"></td> </tr> <tr> <td width="100">Password</td> <td><input name="passwrd" type="text" id="passwrd"></td> </tr> <tr> <td width="100">adres</td> <td><input name="adres" type="text" id="adres"></td> </tr> <tr> <td width="100"> </td> <td> </td> </tr> <tr> <td width="100"> </td> <td><input name="add" type="submit" id="add" value="Add New User"></td> </tr> </table> </form> </body> </html> Hope to get help! Thanks Acer
  3. Hello , a warm hello from me. I try to go through life whistling. At this moment i'm learning Xampp with php 5 and Mysql 5. I saw this wonderful site a couple of times earlier and decided to register. Compliments on your great site !!!!!!!!!! Anyway, from here on I hope we'all will have a great friendship. Acer2
×
×
  • Create New...