Disclaimer: I am very new to Cake
I havn't had much success searching for examples and tutorials using
the query() function, so I tried to stumble through it with the info I
did have at hand. If someone could point out the errors of my ways,
that'd be awesome.
Basically, I'm connecting to the DB used by a desktop app we license
from a vendor, so of course, it's not setup in the way Cake would like
it to be. What I am trying to do is something like this:
Model:
<?
class Book extends AppModel
{
var $name = 'Book';
function getBibNum($isbn)
{
$ret = $this->query("SELECT [bib#] FROM [bib] WHERE [tag] =
'020'
AND [text] LIKE '%" . $isbn . "%'");
$bibNum = $ret[0]['bib#'];
return $bibNum;
}
}
?>
Controller:
<?php
class BooksController extends AppController
{
var $name = 'Books';
function index()
{
//$this->set('posts',$this->Post->findAll());
$this->set('book', $this->Book->getBibNum("0670063622"));
}
}
?>
View:
<h1><?php echo r("\n", "<br/>", $post['Book']['bib#'])?></h1>
Obviously this is a low level sample, to get me going in the right
direction. Again, tips are appreciated.
Cory
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---