WordPress.org

Ready to get started?Download WordPress

Forums

Ajax and mysql DB (3 posts)

  1. domainmadness
    Member
    Posted 2 years ago #

    First of all, I do not have much coding knowledge. I barely can modify others scripts.

    That being said, I hired a coder to do an ajax form for me that fetch information from mysql database. It works fine on plaing html site, but now I'm trying to implement that into wordpress also. With no luck.

    I can integrate my other db with wordpress if necessary. I'll paste few lines here, which I think might be the problem. Thanks for correcting :)

    $connect = mysql_connect($host,$username,$password)or die("<hr>Can't connect server". mysql_error()) ;
    mysql_select_db($db,$connect) or die("Can't connect database");

    $query = mysql_query($sql) or die('error');

    while ($object = mysql_fetch_object($query))

    Are these correct?

  2. Tom
    Member
    Posted 2 years ago #

    WordPress has methods to pull data from the database without the need to query it directly. For example, querying a post: query_posts

    That being said, whatever you are trying to show in ajax can still be displayed using these methods. Here are a few links to ajax and WordPress related tutorials/articles. Hope they help!

    http://codex.wordpress.org/AJAX
    http://www.makeuseof.com/tag/tutorial-ajax-wordpress/
    http://wp.smashingmagazine.com/2011/10/18/how-to-use-ajax-in-wordpress/
    http://www.garyc40.com/2010/03/5-tips-for-using-ajax-in-wordpress/

  3. domainmadness
    Member
    Posted 2 years ago #

    Thanks for your reply.

    Tried to read those a bit, but I'm so overwhelmed when trying to understand all the info that it would take me weeks/months to get this done.

    Would appriciate a lot if someone could walk me trough...

    [ Please do not bump, it's not permitted here. ]

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags