• Resolved Tanaji

    (@tanajibhanvasegmailcom)


    I used a plugin for upload images, that also have one line code just put into theme page (s) and image gallery/ sliding images display, but I don’t like there display style and format, so I used my own display format. Its working fine, but just a expert or using your experience give me advice or suggestions it is correct or not (see the below code). And one think, is it any issues about the performance or website security?

    <?php $sql=mysql_query(“select * from table_name”);
    while($row=mysql_fetch_assoc($sql))
    { ?>
    Here my own display format like <div>, class, font etc.
    <?php } ?>

Viewing 6 replies - 1 through 6 (of 6 total)
  • Interacting with the database can be both tricky, and risky. It’s recommended to keep with the WP syntax…

    Something like:

    $myrows = $wpdb->get_results( "SELECT id, name FROM mytable" );

    Then, I usually “wrap” the results in a foreach loop:

    $myrows = $wpdb->get_results( "SELECT id, name FROM mytable" );
    foreach ($myrows as $myrow) (
       // Do something
    }

    This keeps everything inside the WP classes.. and minimizes instabilities and incompatibilities.

    Thread Starter Tanaji

    (@tanajibhanvasegmailcom)

    Thank you so much Josh.

    You bet!

    Remember also when you modify core files of plugins or themes… the changes will almost certainly be over-written when updating.

    It’s recommended to make these types of changes from the safety of a child theme.

    Thread Starter Tanaji

    (@tanajibhanvasegmailcom)

    Thanks again Josh

    My pleasure.

    (please mark thread as resolved, if resolved, to help others’ in the future)

    Thread Starter Tanaji

    (@tanajibhanvasegmailcom)

    Thanks and all the best..!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to display sliding images on website home page?’ is closed to new replies.