Jump to content

Johninbc

New Members
  • Posts

    5
  • Joined

  • Last visited

Johninbc's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Bingo... sort of... I had to change the $writedata variable setting too... AWESOME!!! now it works... That shoud teach me not to listen to the tutorials on the net, I guess... LOL thank you so much.... John.
  2. MAde the corrections and it hasn't changed the issue with it not actually inputing the data to the Db... It's strange that I can do it manually with the exact same statement and it works fine, but not when called from software.
  3. Thanks guys. As for teh credentials, it's not a live database and the real one will be rather different. The purpose is not for general public, but internal use by only a few people, so injection isn't much of an issue. I will be adding security and validation as I go. All the values are strings... Teh quote error was from a test I did with another fellow that didn't get corrected properly. I will try the corrections suggested and advise.
  4. A very simple script to pass a form to a databasase.... Should be simple, right? Well, the script runs without errors, the var_dump output is apparently correct, the sql statement runs when I put it in the mysql window of phpmyadmin (without the enclosing quotes that are output in the var_dump) and enters the data into the database, but when I run it for real, nothing is inserted intothe database, though the key counter is incremented. I will post the entire code for the script as well as the output of hte var_dump. I'm absolutely certain it's something really simple and stupid, but for eh life of me I cannot see it. Been fighting with this for over 40 hours. Any insight would be appreciated. *********************************************************** <?php define('db_name', 'ssidata'); define('db_table', 'man_data'); define('db_user', '*******'); define('db_pass', '*******'); define('db_server', 'localhost'); $company = $_POST['company']; $first = $_POST['first']; $last = $_POST['last']; $position = $_POST['position']; $addr = $_POST['addr']; $city = $_POST['city']; $state = $_POST['state']; $country = $_POST['country']; $zip = $_POST['zip']; $phone = $_POST['phone']; $email = $_POST['email']; $skype = $_POST['skype']; $type = $_POST['type']; $notes = $_POST['notes']; $dbconnect = "'localhost', 'john', 'roobear', 'ssidata'"; $conn = "mysqli_connect($dbconnect)"; if (!$conn) { (die('No database table connection')); } echo "connected to database"; echo""; $user_info = "INSERT INTO man_data (company, first, namlast, position, addr, city, state, country, zip, phone, email, skype, type, notes) VALUES ($company','$first','$last','$position','$addr','$city','$state','$country','$zip','$phone','$email','$skype','$type','$notes')"; $writedata = "mysqli_query($conn $user_info)"; echo "dbconnect"; var_dump($dbconnect); echo "writedata"; var_dump($writedata); echo "user info"; var_dump($user_info); echo $user_info; if ( $writedata ) { echo "Your information was added to the database."; // mysqli_close($dbconnect); } else { die("Error posting to database: " .mysql_error()); } ?> <a href='entry_form.php'>Click to return to Data Entry Page</a>; ****************************************************************************** Var_dump for user_info 'INSERT INTO man_data (company, first, namlast, position, addr, city, state, country, zip, phone, email, skype, type, notes) VALUES (1','2','3','4','5','6','7','8','9','12','23','34','fullsystems','1234')' The only thing I can think of is the enclosing quotes but I cannot figure out how to pass that variable without them. Peace... john.
×
×
  • 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.