• Hi there, I wonder why I couldn’t save much information into Mysql database. For one column “comments”, I used “LongText” type without a specified value. Ir looked fine and but only showed 1 row of words :-). Do you have an idea of how to fix it? Thanks :-).

Viewing 15 replies - 16 through 30 (of 32 total)
  • It would go in place of what you already have to do the inserting.

    Do you have the entire function that you’re using for your inserting that you can show us (using the code tags of coourse)? If it’s too big, you can use Pastebin to post it and link that here.

    You will find that with WordPress there is a little bit more of a learning curve then there is when you’re using PHP by itself. There’s a few more things that you need to be aware of, and you need to do things in a WordPress-centric sort of way.

    Thread Starter hh2015

    (@hh2015)

    Here’s my contact form. I put your code in process after submit. It didn’t insert anything into the table but it seems to leave a blank row :-).

    Thread Starter hh2015

    (@hh2015)

    Insert:

    `<?php include(‘connection1.php’); ?>

    <?php

    $wpdb->insert ( $wpdb->prefix.’parents2_contact’, array (
    ‘name’,
    ’email’,
    ‘tel’,
    ‘inquiry’,
    ‘security’
    ), array (
    $_POST[‘name’],
    $_POST[’email’],
    $_POST[‘tel’],
    $_POST[‘inquiry’],
    $_POST[‘security’]
    ));

    ?>

    Just to be clear here… Are you even using WordPress? That contact form isn’t attached with a WordPress system in any way.

    Thread Starter hh2015

    (@hh2015)

    no, I didn’t use WP. I just used php code to test some ideas.

    The code that I gave only works within a WordPress system. it won’t work outside of that.

    If you are working in WordPress we can help, but this forum is for issues with WordPress and working with WordPress. For PHP help outside of that it’s probably best to look for a more dedicated PHP forum.

    @catactaustic > wpdb is a native wordpress php call

    @hh2015 > if your connection1.php file makes the right call, from let’s say yoursite.com/testform1.php, it’s workeable.

    But you can use plugins with WordPress to have same results.

    Thread Starter hh2015

    (@hh2015)

    oh, I thought WP was only used for plugin to make the websites alive :-). My code already worked. I just couldn’t figure out how to insert a long string text into mysql table. Do you think WP will make it easy for me :-)? I’ll have a try.

    Thread Starter hh2015

    (@hh2015)

    Hi catacustic, I have tried WP. Both my code and the code you gave to me worked perfectly. Please click here if you want to try it.

    However I still didn’t solve the issue. Please see this capture picture. The 5th column should contain much more information instead of “…” at the end. This picture shows you the table setting. So can you give me an idea of why 5th column is like that? Thanks a lot :-)!

    That ‘…’ and the end is a standard English signifier meaning “there’s more then this, but it’s not shown”. If you go into that record you will see the entire text stored in that column. The standard list view in phpMyAdmin doesn’t show the entire contents of the column.

    Thread Starter hh2015

    (@hh2015)

    where is “record” :-)? Oh, I saw the full text when I clicked “Print View (full text)”. hehe, it took me a lot of time to figure out this :-),

    I found if the paragraph contained something like “it’s, we’re”. The whole paragraph couldn’t be saved into DB. Do you know why?

    Thread Starter hh2015

    (@hh2015)

    Hi Catacustic, are you there :-)? I am wondering: could you please tell me how to delete some rows in my PhpMyAdmin table. This system seemed not install the trigger. I got an error note like this: “This table does not contain a unique column. Grid edit, checkbox, Edit, Copy and Delete features are not available.” Many thanks!

    What column have you got that contains an ID for that row? Most times that’s an auto-incrementing integer value, but doesn’t have to be if you’re creating your own ID’s for each row. I wouldn’t suggest that in your case, just stick with the auto-incrementing ID.

    It sounds like you need ot go back and figure out some very basic structures for yor site and database. You have missed a lot of fundamental points that are needed for pretty much any development.

    And again, it’s definatly a good idea to research some other forums or resources that can guide you in more of the basics of programming before you go too far with this.

    Thread Starter hh2015

    (@hh2015)

    Thank you. You are so nice. I figured out how to do it.
    Just click “inline” type “DELETE FROM contact WHERE 1″ and run.

    Could you remind me of how to set up auto-incrementing ID?

    I did like this : id, INT, 80, A.I.yes
    But I got an error “Query error, #1075- Incorrect table definition. there can be only one auto column and it must be defined as a key”. what this means :-)?

    Thread Starter hh2015

    (@hh2015)

    I got it. I add “primary key” to id, it works.
    I think I got all I want. Thank you very much for all your help, catacaustic! I may have a new question and I will start a new topic. Digico, thank you too :-)!

Viewing 15 replies - 16 through 30 (of 32 total)
  • The topic ‘mysql’ is closed to new replies.