Jump to content

Search the Community

Showing results for tags 'php mysql insert'.

  • 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 2 results

  1. Hey guys, this is my first post here(not going to be the last one, Im sure), im trying to insert in mysql from session array, i don't know where is my error, I leave the code below, if someone can help me please . $conn = mysql_connect("localhost","root","Password"); $err_db = mysql_select_db('bd_amics'); $sql = ('INSERT INTO `'.$_SESSION["use"][0].'` (ID,Amic) VALUES (`'.$_SESSION["person"][0].'`, `"1"`)'); mysql_query("SET NAMES utf8"); mysql_query($sql, $conn); mysql_close(); Im trying to insert in table $_SESSION["use"][0] the values $_SESSION["person"][0] and 1. Thank you guys.
  2. Hey all this is my first time posting and was wondering if I could get some help and see what I am doing wrong. // I've tried my best to find my answer through google searches and after days of working on this I finally decided to ask for some guidence. // Project: I am trying to make a web based form that will take information about my comic books and input them into a mysql database. Info: I have got the code for the html input page all done and have it sending the $_POST[''] variables to another script that will actually input the data into the database. / In addition this app is only available to me and won't be facing the public world so I have left out the checks on the data since most of it is controled variables from the form. Problem: After I input the 7 values into the html form and submit them the script never inputs the data. I have echoed out the $_POST[''] variables to make sure they were being passed correctly and well they are. Question: It's a multi part question / a.) Can anyone see what I am doing wrong in my INSERT statement and mysqli_query b.) Is there a better way? I saw PDO but couldn't really wrap my head around it. c.) what could or should I be using to see what mysql is telling me when the INSERT statement runs to see if Its a problem on the other side. What I've done/tried: Seems like too much too say... lol but I've verified the user permissions for the DB and the user I'm connecting with and it has full rights on DB / Multiple INSERT statements but none of em work. / I've tried moving the table into a separate database scheme (still no go) / I've tried different ways of selecting the DB outside of the connection params as well as in the connection params with no favorable result. / I tried using the string that mysql workbench creates to input values the same as the php code to input values and that didn't work. Code: [comic_form.php] $comic_db = mysqli_connect("foo", "bar", "foobar", "comic_info_db"); if(!$comic_db){ echo "Connection to DB Failed"; } else { echo "Connect to DB Established"; } // Variables From Web Form $idcomic_db = $_POST['idcomic_db']; $publisher = $_POST['publisher']; $comic_name = $_POST['comic_name']; $comic_num = $_POST['comic_num']; $comic_cover = $_POST['comic_cover']; $price_paid = $_POST['price_paid']; $quantity = $_POST['quantity']; $sql_insert = "INSERT INTO `comic_db` (idcomic_db, publisher, comic_name, comic_num, comic_cover, price_paid, quantity) VALUES ('$idcomic_db', '$publisher', '$comic_name', '$comic_num', '$comic_cover', '$price_paid', '$quantity')"; $db_con = mysqli_query($sql_insert, $comic_db); $error = mysqli_error($db_con); In that same script I also have echoed the variables as well as the sql_insert string and this is what I get. I did this just to see what variables were being passed as well as the string that was being created. Dunno if there is a better way to do it. 1 Marvel Comics The Superior Spider-Man 1 original 3.99 1 INSERT INTO `comic_db`.`comic_db` (`idcomic_db`, `publisher`, `comic_name`, `comic_number`, `comic_cover`, `price_paid`, `quantity`) VALUES ('0', 'Marvel Comics', 'The Superior Spider-Man', '1', 'original', '3.99', '1') I've also included a screen shot of the table params from mysql. if it helps I also am using PHP Version 5.3.10-1ubuntu3.6 Sorry if this is lengthy thought more info would be better Thanks for the help
×
×
  • 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.