WordPress.org

Ready to get started?Download WordPress

Forums

Insert PHP
[resolved] dynamic table (6 posts)

  1. milba1164
    Member
    Posted 5 months ago #

    hello, i can seem to get anything to show when using table code - correct me if I am wrong but it should have been a find & replace? I appreciate your help Cheers;

    [insert_php] virtual('/Connections/VeganProducts.php'); [/insert_php]
    [insert_php]
    mysql_select_db($database_VeganProducts, $VeganProducts);
    $query_rsProductsList = "SELECT * FROM mmw_vProducts ORDER BY prodName ASC";
    $rsProductsList = mysql_query($query_rsProductsList, $VeganProducts) or die(mysql_error());
    $row_rsProductsList = mysql_fetch_assoc($rsProductsList);
    $totalRows_rsProductsList = mysql_num_rows($rsProductsList);
    [/insert_php]

    <table border="1">
    <tr>
    <td>prodID</td>
    <td>prodName</td>
    <td>prodCat</td>
    <td>allergenSoy</td>
    <td>allergenNuts</td>
    <td>allergenGluten</td>
    <td>knownSupp</td>
    <td>substitute</td>
    <td>image</td>
    <td>confirmedBy</td>
    <td>dateAdded</td>
    <td>dateUpdated</td>
    </tr>
    [insert_php] do { ?>
    <tr>
    <td>[insert_php] echo $row_rsProductsList['prodID']; [/insert_php]</td>
    <td>[insert_php]echo $row_rsProductsList['prodName']; [/insert_php]</td>
    <td>[insert_php] echo $row_rsProductsList['prodCat']; [/insert_php]</td>
    <td>[insert_php] echo $row_rsProductsList['allergenSoy']; [/insert_php]</td>
    <td>[insert_php] echo $row_rsProductsList['allergenNuts']; [/insert_php]</td>
    <td>[insert_php] echo $row_rsProductsList['allergenGluten']; [/insert_php]</td>
    <td>[insert_php] echo $row_rsProductsList['knownSupp']; [/insert_php]</td>
    <td>[insert_php] echo $row_rsProductsList['substitute']; [/insert_php]</td>
    <td>[insert_php] echo $row_rsProductsList['image']; [/insert_php]</td>
    <td>[insert_php] echo $row_rsProductsList['confirmedBy']; [/insert_php]</td>
    <td>[insert_php] echo $row_rsProductsList['dateAdded']; [/insert_php]</td>
    <td>[insert_php] echo $row_rsProductsList['dateUpdated']; [/insert_php]</td>
    </tr>
    [insert_php] } while ($row_rsProductsList = mysql_fetch_assoc($rsProductsList)); ?>
    </table>

    [insert_php]
    mysql_free_result($rsProductsList);
    [/insert_php]

    https://wordpress.org/plugins/insert-php/

  2. WillBontrager
    Member
    Plugin Author

    Posted 5 months ago #

    Hi milba1164,

    Insert PHP doesn't talk to code between [insert_php]...[/insert_php] blocks. In other words, this won't work:

    [insert_php]$name='Will';[/insert_php]
    [insert_php]echo $name;[/insert_php]

    But this will:

    [insert_php]$name='Will';
    echo $name;[/insert_php]

    because the variable name assignment and the echo of the variable name are in the same code block.

    More information here:

    http://www.willmaster.com/software/WPplugins/insert-php-wordpress-plugin-instructions.php#inandofitself

    Will

  3. milba1164
    Member
    Posted 5 months ago #

    thanks but i still cant get it to work
    i can add a form with the variable drop down list but then any code i test (i use DMW) that calls for the data blanks out the page.
    cheers

  4. WillBontrager
    Member
    Plugin Author

    Posted 5 months ago #

    Suggest checking the server's error log. It might provide some clues about what's going on.

    Will

  5. WillBontrager
    Member
    Plugin Author

    Posted 1 month ago #

    Because there has been no response, I'm assuming the original poster resolved the issue.

  6. WillBontrager
    Member
    Plugin Author

    Posted 1 month ago #

    Oops, forgot to check the "Mark this topic as resolved" checkbox.

    Now checked.

Reply

You must log in to post.

About this Plugin

About this Topic