WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] mysql Query executed ? (2 posts)

  1. chaaban
    Member
    Posted 8 years ago #

    How can i know if a query was executed correctly ...

    i did this :

    $sql = " the sql query " ;

    $sql_query = $wpdb->query($sql);

    then tested both :

    if (! $sql_query) { the query dident work } else ...

    and

    if ($sql_query != 1) { the query dident work }else ...

    but both dident work in term of showing that the query were executed (i know it did because i can see some results in my phpMyAdmin)

    also another weird thing is that i use the same command

    " if ($sql_query != 1) " in another php file and it work !

    any idea ?

    also the $sql_query return 0 if it was executed and nothing if it dident (weird ? )

  2. chaaban
    Member
    Posted 8 years ago #

    fixed it using : if($sql_query === 0) { query executed } else { problem occured } ;

    it seem 2 be working in this way

    Thank's alot for the Help :p

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags