Jump to content

cluelessnoob

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Posts posted by cluelessnoob

  1. Sorry I've been at this for too long. I'm using Cakephp. I have a database called comicdb and a tables called comics and artist. I have a model and controller for called comic and comics_controller respectively. As well as similarly named models and controllers for my six tables. the comics table has a foreign key for each table here is the code for the model:

    <?
    class Comic extends AppModel {
    var $name = 'Comic';
    var $belongsTo = array('User');
    var $hasOne = array(
            'Artist',
            'Author',
            'Rating',
            'Publisher'
    ); 
    }
    ?>

     

    and the controller:

    <?
    class ComicsController extends AppController {
    var $name = 'Comics';
    var $scaffold;
    }
    ?>
    

     

    I'm not sure what other information might be necessary.

  2. I get this error when I try to load the scaffold view.

    I have tables called artists and comics in the comic database and models

    call artist.php and comic.php. i have no idea what I'm doing wrong.

     

    Missing Database Table

     

    Error: Database table artists_comics for model ArtistsComic was not found.

  3. I'm trying to create a page for organizing comic books. One table needs to have multiple hasone relations and I can't figure out how to do it. Any help would be appreciated. Here's what I have so far:

     

    <?

    class Comic extends AppModel {

    var $name = 'Comic';

    var $belongsTo = array('User');

    var $hasOne = array('Artist'),

    array('Author'),

    array('Rating'),

    array('Publisher');

    }

    ?>

  4. I'm trying to create a view, but whenever I load it. I get an undefined index error. My code and debug information below:

     

    <? debug($posts);?>
    
    <?=$html->link('<h1>'.$posts['Post']['name'].'</h1>','/posts/read/'.$posts['Post']['id'],null,null,false);?> 
    <p>Author: <?=$posts['User']['name'];?>
    <p>Date Published: <?=$time->nice($posts['date']);?></p>
    <hr/> 

     

    Array
    (
        [0] => Array
            (
                [Post] => Array
                    (
                        [id] => 1
                        [name] => How to Skateboard
                        [date] => 2009-06-28 23:01:00
                        [content] => A simple detailed how to tutorial for skateboarding.
                        [user_id] => 1
                    )
    
                [user] => Array
                    (
                        [id] => 1
                        [name] => Bartman
                        [email] => bsimpson@fox.com
                        [firstname] => Bart
                        [lastname] => Simpson
                    )
    
                [comment] => Array
                    (
                        [0] => Array
                            (
                                [id] => 1
                                [name] => Great Article
                                [content] => I learned alot
                                [post_id] => 1
                            )
    
                        [1] => Array
                            (
                                [id] => 2
                                [name] => Good for begginers
                                [content] => OK for beginners, but lacking for more advanced people
                                [post_id] => 1
                            )
    
                    )
    
            )
    
        [1] => Array
            (
                [Post] => Array
                    (
                        [id] => 2
                        [name] => How to make beer
                        [date] => 2009-06-28 23:31:00
                        [content] => This is a detailed article on how to make beer
                        [user_id] => 2
                    )
    
                [user] => Array
                    (
                        [id] => 2
                        [name] => Duffman
                        [email] => hsimpson@fox.com
                        [firstname] => Homer
                        [lastname] => Simpson
                    )
    
                [comment] => Array
                    (
                        [0] => Array
                            (
                                [id] => 3
                                [name] => Glughhhhh Beer
                                [content] => No beer and no TV make me something, something
                                [post_id] => 2
                            )
    
                    )
    
            )
    
    )
    

     

    Here's the errors:

     

    Notice (8): Undefined index:  Post [APP\views\posts\read.ctp, line 4]

     

     

    Notice (8): Undefined index:  User [APP\views\posts\read.ctp, line 5]

     

    Notice (8): Undefined index:  date [APP\views\posts\read.ctp, line 6]

     

  5. I just started experimenting with Cake, and I was going through the examples in the Beginning CakePHP book. In the fifth chaper it covers baking. It has me bake one controller and view. Now none of my cake apps are working. I get 404 errors on them all. When I go to the root page that tells you if everything is working, it comes up without formatting. Could someone help?

  6. I need help with this join. Any ideas what I'm doing wrong.

     

    SELECT facName.facility,facAddress.facility, CONCAT(facCity.facility, ', ', facState.facility) AS loc, facZip.facility,refRateID.Urating,refFID.Urating,RateID.Ratetype,RateType.RateType FROM facility,Urating,Ratetype WHERE (facZip.facility = '$zip' AND refFID.Urating = FID.facility AND refRateID.Urating = RateID.RateType) LIMIT $start, $display";

  7. I have been through the tutorial on this site, and while I have not figured out a fix. I believe I have isolated the problem. In this script I am using a value passed be an HTML form as a WHERE clause when querying the database. However this value is not passed on to subsequent pages. I am fairly certain this is the problem but I have no idea how to fix it. Any help would be appreciated. The value is called $zip in the code.

  8. I am new to PHP and was work on paginating results, I've got it working to a point where it displays the additional pages, but it doesn't print the results on the new page and if you go back to the first page the results disappear. I'd appreciate any help. I've attached my code.

     

     

    [attachment deleted by admin]

×
×
  • 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.