Page 1 of 1

Cant open access DB in mac

Posted: Sat Aug 27, 2011 3:01 pm
by bishmedia
I will try and make this as simple as possible
I used to run my site on a windows laptop using php & access database.

Have now moved to a macbook pro and setup mamp which is running php fine but l cant
connect to the database. This is the code i used in windows....

I know that 'logisticsnew' was set in windows to link to logistics.mdb universally but how do l set this in mac??

odbc_open.php

Code: Select all

<?php
      $odbc = odbc_connect ('logisticsnew', 'root', '') or die('Could Not Connect to ODBC Database!');
      ?>


index.php

Code: Select all

 <img src="../images/latestnews.jpg" style="width:323px; height:23px" >
           <br />        
                <table> 
                    <?php  require_once('../App_Data/odbc_open.php');
                        $query = odbc_exec($odbc, "SELECT * FROM search WHERE sHeadline='yes' ORDER BY nUrl DESC") or die (odbc_errormsg());
                        while($row = odbc_fetch_array($query))
                        {
                            echo '<tr style="text-align:justify">';
                            echo '<td valign="top">';
                            echo '<img src="../'.$row['sImages'].' "  width="'.$row['sImageWidth'].'" height="'.$row['sImageHeight'].'" alt="'.$row['sAlt'].'"hspace="8" vspace="8" align="right"/>';
                            echo '<div class="latestnews"><a href="news.php?sid='.$row['sId'].'" class="smallLinks" >   '.$row['sHeading'].'</a><br /></div>';
                            echo '<div class="style2" style="text-align:justify">'.$row['sDescription'].'<br /></div>';
                            echo '<div class="smalldate">Date: '.$row['sDate'].'</div>';
                            echo '<br />';
                            echo '</td>';
                            echo '</tr>';
                        }
                        odbc_close($odbc);   ?>
                </table>
It doesnt seem to be connecting to the database, l dont even get an error messsage???

Please forgive me as i am a complete novice at mac :-)

Re: Cant open access DB in mac

Posted: Sat Aug 27, 2011 3:15 pm
by califdon
Most of us probably are, too, but you haven't shown us the pertinent code, which is in the include file ../App_Data/odbc_open.php.