11
preachur
Re: Porting an MS-Access database
  • 2006/11/30 17:35

  • preachur

  • Just can't stay away

  • Posts: 525

  • Since: 2006/2/4 4


Actually, I could use that myself. I need to display 2 gigantic database tables of old forum posts and news stories as an archive type of deal.
Magick can never be restrained, but when freely given is thrice regained!

12
preachur
Re: Porting an MS-Access database
  • 2006/12/25 4:06

  • preachur

  • Just can't stay away

  • Posts: 525

  • Since: 2006/2/4 4


Hmmm.... I still need to do this. I wonder how I can?
Magick can never be restrained, but when freely given is thrice regained!

13
skenow
Re: Porting an MS-Access database
  • 2006/12/25 14:33

  • skenow

  • Home away from home

  • Posts: 993

  • Since: 2004/11/17


This is kind of rough - but I have this working:

First the DB connection -
$db_user "user";
$db_pwd =  "password";
$db='db_name'\ something like "\\path\to\database.mdb";


$db_connection = @odbc_connect ("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$db"$db_user$db_pwdSQL_CUR_USE_ODBC) or die("The database is unavailable at this time. Please try again later");
?>


Then, you'll need a form -
<FORM METHOD "POST" ACTION "yourpage.php">
<
table width '100%' class='table1'><tr><td align='center'>
<
table class='table1'><tr><th size '10'>Call #Ref #Store #Store NameStart DateEnd Date
<tr>    <td><input type "text" name "call" size 10 value "">td>
    <
td><input type "text" name "ref" size 10 value "">td>
    <
td><input type "text" name "store" size 10 value "">td>
    <
td><input type "text" name "name" size 40 value "">td>
    <
td><input type "text" name "start" size 10 value "">td>
    <
td><input type "text" name "end" size 10 value "">td>
tr>
<
tr><td colspan='6' align='right'>
<
input type "submit" name "submit" value "Search">
<
input type "reset" name "reset" value "Clear">
td>tr>table>
td>tr>table>
FORM>



Then, the rest of the page
if (!$submit) {


    echo 
"

 Your page title 



"
;


    
$qsel_calls $YourQueryString;
} else {
    
// do something w/ POST vars

    
$callnum $_POST['call'];
    
$storenum $_POST['store'];
    
$storename $_POST['name'];
    
$startdate $_POST['start'];
    
$enddate $_POST['end'];
    
$refno $_POST['ref'];

    
$where "(table.opendate >= #$startdate#) AND (table.opendate <= #$enddate#) AND (table.accountnumber LIKE '$billto%')";
    if (
$callnum != "") {$where .= " AND (table.call_num LIKE '$callnum%')";echo "  Call # - ".$callnum ."*
"
;}
    if (
$storenum != ""){$where .= " AND (table.storeacct LIKE '$storenum%')";echo "  Store # - ".$storenum ."*
"
;}
    if (
$storename != ""){$where .= " AND (table.groupname LIKE '$storename%')";echo "  Store Name - ".$storename ."*
"
;}
    if (
$refno != ""){$where .= " AND (table.po_num LIKE '$refno%')";echo "  Ref # - ".$refno ."*
"
;}

    echo 
"  Start Date - ".$startdate ."
"
;
    echo 
"  End Date - ".$end ."
"


    
$qsel_calls "SELECT _________    WHERE ".$where ." ORDER BY table.opendate DESC";

}
echo 
"";
echo 
"Call #Ref #Date OpenedStoreSummaryStatus";
$result odbc_exec($db_connection$qsel_calls);

$firstrow odbc_fetch_row ($result1);
while (
$firstrow)
    {
        
        echo 
"$rowcolor'>".odbc_result($result,"call_num")."";
        echo 
".odbc_result($result,"po_num") ." ";
        echo 
"" .date("m/d/Y",strtotime(odbc_result($result,"opendate"))) ."";
        echo 
"" .odbc_result($result,"groupname") ."";
        echo 
"" .odbc_result($result,"summary") ."";
        echo 
"" .odbc_result($result,"status") ."";
//        echo "";

        
$firstrow odbc_fetch_row ($result);
    }

echo 
"End of List";

odbc_close($db_connection);
?>


Be sure to use the other required elements for a XOOPS module - xoops_version.php, include XoopsRoot/header.php and footer.php.

14
preachur
Re: Porting an MS-Access database
  • 2006/12/25 17:20

  • preachur

  • Just can't stay away

  • Posts: 525

  • Since: 2006/2/4 4


Wow, thanks! I wrote one to display it all, but it's about 60,000 messages and it crashes some browsers. I just need to figure out how to get it to output multiple pages and only show a certain number of rows on each page from the table now. (I am new at .php)
Magick can never be restrained, but when freely given is thrice regained!

Login

Who's Online

439 user(s) are online (104 user(s) are browsing Support Forums)


Members: 0


Guests: 439


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Oct 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits