This topic is locked

Add button on list page with sql code

4/5/2008 6:04:12 PM
PHPRunner General questions
I
inko_nick author

Hello ! Thanks for great application... I'm a newbie in php...
I need a button on list page that will show custom data from SQL ..

So i made:

  1. Add HTML code:

    <input class=button type=submit value="CUSTOM LIST" name=submit2>
  2. Add code to the ListOnLoad event.
    global $conn;

    if ($_REQUEST["submit2"])

    {

    $str = "select * from TABLE where Data >= 'DATE1' and Data <='DATE2'";

    $rs = db_query($str,$conn);
    while($row = db_fetch_array($rs))

    {

    print_r($row); //<This will list the result but outside of list table

    }

    }
    I don't know how to display the result of query in _list.php table .... <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=8057&image=1&table=forumtopics' class='bbc_emoticon' alt=':unsure:' />
    Help me please. What is correct syntax?.. Thank You...

J
Jane 4/7/2008

Nick,
to change main SQL query use List page: Before SQL query event on the Events tab.

For example to add WHERE clause use this code:

$strWhereClause = whereAdd($strWhereClause,"Data >= 'DATE1' and Data <='DATE2'");