• lincolin

    (@lincolin)


    Hello!
    I using WordPress and I like show data on other extra php site.
    Be interested in me some let read data directly from mySQL base from wordpress?
    I using this code:

    mysql_connect(“zamenjaj z sql serverom”, “user”, “pass”);
    mysql_select_db(“baza”);
    $rezultat = mysql_query(“SELECT * FROM ‘wordpress_tabela'”);
    $num = mysql_num_rows($rezultat);
    for($i=0;$i<$num;$i++)
    {
    mysql_result($rezultat, $i,”prvistolpec”);
    mysql_result($rezultat, $i,”drugistolpec”);
    }

    … and this code in not working!
    Pleas for help me!

    Sory for my Englih language is wery bad but I from Slovenija ??

    Great, thanks, Grega

Viewing 2 replies - 1 through 2 (of 2 total)
  • Michael Torbert

    (@hallsofmontezuma)

    WordPress Virtuoso

    Test to see if mysql_result($rezultat, $i,”prvistolpec”) returns a value.
    What are you trying to do with it? Do you want to print whatever it returns to the screen? or do you want to use it in another function?

    moshu

    (@moshu)

    You can use WP functions, template tags on other .php files (not located in WP install) – without accessing directly the database.

    Put this on the top of a PHP file, before everything:

    <?php
    require('./path-to-your-blog/wp-blog-header.php');
    ?>

    and you can call any WP data in that file using the Template_Tags

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘read mySQL (wordpress) on php site’ is closed to new replies.