Jump to content

contraboybish

Members
  • Posts

    42
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

contraboybish's Achievements

Member

Member (2/5)

0

Reputation

  1. 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 <?php $odbc = odbc_connect ('logisticsnew', 'root', '') or die('Could Not Connect to ODBC Database!'); ?> index.php <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 :-)
  2. Yes that it, it was numeric, must be the new year drink :-) Many Thanks
  3. oops, ok l added FROM but l now get the following error...... :-( Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression., SQL state 22005 in SQLExecDirect in C:\xampp\htdocs\lbm\search\news.php on line 36 [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
  4. I'm getting the following error..... <div id="mainContent"> <?php require_once('../App_Data/odbc_open.php'); [b]query = odbc_exec($odbc, "SELECT * Search WHERE sId='$_GET[sid]'") or die (odbc_errormsg());[/b] while($row = odbc_fetch_array($query)) { echo '<tr style="text-align:justify">'; echo '<td valign="top" colspan="2">'; echo '<div style="padding-right:7px"><i><a href="'.$row['nUrl'].'" class="style2" > '.$row['sHeading'].'</a> </i><br /></div>'; echo '</td>'; echo '</tr>'; } odbc_close($odbc); ?> </div> I think there is something wrong with the select command.... query = odbc_exec($odbc, "SELECT * Search WHERE sId='$_GET[sid]'") or die (odbc_errormsg()); Any thoughts anyone :-(
  5. It worked, l replaced it with <a href="news.php?sid='.$row['sId'].'"> and the news page came up with the 'sId' record using $_GET[sid] Many many thanks :-)
  6. mapleleaf You are on the right road l think <a href="news.php?sid='.$row['sId'].'"> This would open the news.php page and select the 'sId' record assigned to the string 'sid' by using $_GET or $_POST .... I'm gonna try it now!!!!
  7. There must be away of doing this? Just getting the 'sId' data to the 'News' page would help :-( Anyone
  8. On the site you search for a word and that brings up a list of different news reviews, at the moment, when you click on a link it brings up that news page. http://www.logisticsbusiness.com/Magazine/search.aspx I currently have thousands of News pages and all l want now is to open one e.g. 'NEWS.PHP' and have the data in the MS Access instead...... Hope this makes sense!!!!
  9. OK l have a page called 'SEARCH', someone enters a word and a list of news items appear as below. What l would like to do is click on one of the links and have it open in a new page called 'NEWS' Somehow i need to build a simple form in the code below and have the 'sId' as the link name and on the 'NEWS' page use the '$_POST' again to 'SELECT' the correct record. Here is my code........ <?php require_once('../App_Data/odbc_open.php'); $result = odbc_exec($odbc, "SELECT * FROM Search WHERE (sKeyword1 LIKE '%$_POST[item_search]%')"); echo "Results For <b>$_POST[item_search]</b>"; echo "<table width='910' border='0' align='center'>"; while($row = odbc_fetch_array($result)) { 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><a href="'.$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>'; } echo "</table>"; ?> Any thoughts anyone.... Many Thanks
  10. It works fine on localhost but now that i have downloaded it to my server i get this error....... Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query., SQL state S1000 in SQLExecDirect in d:\inetpub\....com\web\content\searchupdate.php on line 9 Any thoughts :-(
  11. Thankyou so much, it worked :-) Many Thanks
  12. I'm trying to INSERT a new record into an ACCESS DB using PHP from a form, this is the code l have so far........ $heading = $_POST['heading']; $story = $_POST['story']; $odbc = odbc_connect ('logisticsdb', 'root', '') or die('Could Not Connect to ODBC Database!'); $sql = "INSERT INTO Search (sHeading, sDescription) VALUES ('$heading', '$story')"; odbc_exec($odbc_connection, $sql) or die(); odbc_close($odbc); But i'm getting the following error....... Warning: odbc_exec() expects parameter 1 to be resource, null given in C:\xampp\htdocs\lbm\searchupdate.php on line 8 What a l missing?
  13. I sussed it!!! I installed xampp instead added a new website on the IIS manager, changed the DNS location....... BINGO!!! :-)
  14. Ok i have now got wampserver 2 working, Apache2 and MySQL services appear to be online... when l click 'localhost' on the wampserver it shows me a list of the website files which it didn't earlier :-) If l click on the default 'index.php' i get the following error........... Error Summary HTTP Error 404.3 - Not Found The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map. but if l browse the same file within Dreamweaver either on 'Live View' or 'IE' l get google page!! :-( I seem to have messed with many things that i'm starting to get confused!!! HELP!!!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.