Home   Help Login Register  
Welcome, Guest. Please login or register.

Login with username, password and session length

Search
Free Website WooThemes - Quality Themes, Great Support
Pages: [1]   Go Down
Print
Topic: UPDATE MS ACCESS USING PHP  (Read 2969 times)
« on: January 25, 2008, 06:10:25 AM »
crusty Offline
Newbie

View Profile
*

iTrader: 0
Posts: 2



Not sure if this is the correct place to post this question but here goes.
I've managed to read a record and insert a record but can't do an update using the following code.
Code:
<?php
$connect 
odbc_connect&#40;'Ah123', '', ''&#41;;
if &#40;!$connect&#41;
  
&#123;exit&#40;"Connection Failed&#58; " &#46; $connect&#41;;&#125;
$sql="SELECT * FROM Data";
$rs=odbc_exec&#40;$connect,$sql&#41;;
if &#40;!$rs&#41;
  
&#123;exit&#40;"Error in SQL"&#41;;&#125;
$id1;
$Header "New Entry";
$query1 "UPDATE data SET Header = $Header WHERE ID1= $id";
echo 
$query1;

$cr1=odbc_exec&#40;$connect,$query1&#41;; 

odbc_close&#40;$connect&#41;;
?>

The odbc_exec produces an error.

Please help an old struggling crusty
[/code]

Share this topic on AskShare this topic on BlinkbitsShare this topic on BlinklistShare this topic on BloglinesShare this topic on BmarksShare this topic on Del.icio.usShare this topic on DiggShare this topic on DzoneShare this topic on FacebookShare this topic on Feed Me LinksShare this topic on FurlShare this topic on GoogleShare this topic on LiveShare this topic on MagnoliaShare this topic on MySpaceShare this topic on NetvouzShare this topic on NewsvineShare this topic on OneviewShare this topic on RedditShare this topic on RojoShare this topic on ScuttleShare this topic on ShadowsShare this topic on SlashdotShare this topic on SpurlShare this topic on SquidooShare this topic on StumbleUponShare this topic on TechnoratiShare this topic on TwitterShare this topic on TipdShare this topic on YahooShare this topic on Google buzz
« Last Edit: December 31, 1969, 05:00:00 PM by crusty » Logged
« Reply #1 on: January 28, 2008, 10:34:41 PM »
Kailash Offline
Administrator
Newbie

View Profile WWW
*****

iTrader: 50
Posts: 286



Hi Crusty,

If Header value is varchar data type then you will need to use Header = '$Header' in your update query. Your code should be as below:

Code:
<?php
$connect 
odbc_connect&#40;'Ah123', '', ''&#41;;
if &#40;!$connect&#41;
  
&#123;exit&#40;"Connection Failed&#58; " &#46; $connect&#41;;&#125;
$sql="SELECT * FROM Data";
$rs=odbc_exec&#40;$connect,$sql&#41;;
if &#40;!$rs&#41;
  
&#123;exit&#40;"Error in SQL"&#41;;&#125;
$id1;
$Header "New Entry";
$query1 "UPDATE data SET Header = '$Header' WHERE ID1= $id";
echo 
$query1;

$cr1=odbc_exec&#40;$connect,$query1&#41;;

odbc_close&#40;$connect&#41;;
?>


Regards,
« Last Edit: December 31, 1969, 05:00:00 PM by Kailash » Logged

« Reply #2 on: January 29, 2008, 04:19:34 AM »
crusty Offline
Newbie

View Profile
*

iTrader: 0
Posts: 2



Thanks for that.
Brilliant. Thanks a lot.
alec
« Last Edit: December 31, 1969, 05:00:00 PM by crusty » Logged
Pages: [1]   Go Up
Print
Jump to:  

Untitled Document
(c) 2012 HELM, WHM, cPanel, ASP, .Net development, PHP, MySQL, MSSQL Server, SEO support forum
Powered by SMF 1.1.16 | SMF © 2011, Simple Machines | Forum style designed by PixelSlot
Google - Sitemap - XML Sitemap