Access/PHP

  • tommya
  • Graduate
  • Graduate
  • tommya
  • Posts: 221
  • Loc: United Kingdom

Post 3+ Months Ago

I have a small database that I've used PHP to talk to.
But I'm trying to pull the revision date into a variable and print it on screen, code is

Code: [ Select ]
$revision1 = "SELECT * FROM tblLastRevisionDate";
$revision2 = $conn->Execute($revision1);

Database Last Amended = <? print $revision2 ?>
  1. $revision1 = "SELECT * FROM tblLastRevisionDate";
  2. $revision2 = $conn->Execute($revision1);
  3. Database Last Amended = <? print $revision2 ?>


However, what it prints is

Quote:
Database Last Amended = Object


What it should be is a date?

Any ideas?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Rabid Dog
  • Web Master
  • Web Master
  • User avatar
  • Posts: 3245
  • Loc: South Africa

Post 3+ Months Ago

the reason you are getting the output object is because $revision2 is the result set.

try something like this
PHP Code: [ Select ]
 
$result = mysql_query($revision1);
 
if ($row = mysql_fetch_array($result)){
 
 $revision2 = $row['revision row name'];
 
}else{
 
 $revision2 = "No revision info";
 
}
 
 
  1.  
  2. $result = mysql_query($revision1);
  3.  
  4. if ($row = mysql_fetch_array($result)){
  5.  
  6.  $revision2 = $row['revision row name'];
  7.  
  8. }else{
  9.  
  10.  $revision2 = "No revision info";
  11.  
  12. }
  13.  
  14.  


If you are trying to return the result set via a function, don't. I have tried this main time and it is just a pain in the rear end.
Rather execute the query and have return the values or set the public properties of the class containing the function

Okay now I feel weird - I hope this is PHP you are using otherwise I got egg on my face :oops:
  • tommya
  • Graduate
  • Graduate
  • tommya
  • Posts: 221
  • Loc: United Kingdom

Post 3+ Months Ago

i am using PHP, yes, but talking to an Access database
not ideal but my hand has been forced due to remote staffing reasons

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 94 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.