Forum Moderators: coopster
I have another example on my config.php
$books_table = "books";
but how to define 'Persistent'? is muddling me up after 6 hrs.
--------
<code>
$newBook = new Book;//Book replaces new Book?
$newBook->title = $_POST['title'];//['Hunting']for['title']
$newBook->PersistNew();
$newAuthor = new Author;
$newAuthor->firstname = $_POST['firstname'];
$newAuthor->lastname = $_POST['lastname'];
$newAuthor->PersistNew();
$newBookAuthorLink = new BookAuthorLink;
$newBookAuthorLink->author = $newAuthor->id;
$newBookAuthorLink->book = $newBook->id;
$newBookAuthorLink->PersistNew();
</code>
I hope you get the drift of this newbie request
code from a codewalker tutorial.
Is there a similar more powerful code anywhere.
this seems to be a step up from ez_sql.php
sorry to say but i don't understand your problem. it seems to me that your code or scenario is incomplete. for a better insight it would be good you can post the url of the tutorial or describe a bit more the classes you use (what they do, what they are for).
if you're looking for persistent database connection you can find more info about this in the php docs. for example, the mysql_pconnect() [php.net] function.
in your scenario this has to be handled by the class. but my question is: why do you need a persistent connection at all. doesn't this class has to store it in the database only?
Tutorial:
[2]
Framework for Persisting Data Relationships by Jake Huffman
[url]
[codewalkers.com...]
[/url]
I am trying to figure out how to define a theoretical situation and the simple entry of the syntax into the following ...and I insert the code to keep it handy...
---
What has to be altered for say a TableName 'Books'
BookName 'Hunting'
Author 'Russell James'?
I have another example on my config.php
$books_table = "books";
but how to define 'Persistent'? is muddling me up after 6 hrs.
--------
I hope you will edit this to reflect the example above.
<code>
$newBook = new Book;//Book replaces new Book?
$newBook->title = $_POST['title'];//['Hunting']for['title']
$newBook->PersistNew();
$newAuthor = new Author;
$newAuthor->firstname = $_POST['firstname'];
$newAuthor->lastname = $_POST['lastname'];
$newAuthor->PersistNew();
$newBookAuthorLink = new BookAuthorLink;
$newBookAuthorLink->author = $newAuthor->id;
$newBookAuthorLink->book = $newBook->id;
$newBookAuthorLink->PersistNew();
</code>