#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2011
    Posts
    4
    Rep Power
    0

    Unhappy Instructor says that my script will not run. He was not specific and I cannot find


    anything wrong with the script I have ran the script through a debugger and recieved out put. Below is a description of the entire assignment:

    W6A1: Complete Exercise 10-4 on page 610 of the textbook. Additionally, design a webpage and script that will accept input, process the input, and print out the output of this assignment.
    For this assignment create a single zip archive that contains all the files needed to run the assignment. This includes php scripts, html files, and text files. Include your full name, date, and class number as a comment or annotation on each file. Include remarks on how to run the assignment.

    Create a movies class that determines the cost of a ticket to a cinema, based on the moviegoer's age. Assume that the cost of a full price ticket is $10.00 assign the age to a private data member. Use the public number function to determine the ticket price based on the following schedule.

    Age Price
    Under 5 Free
    5 to 17 Half Price
    18 to 55 Full Price
    Over 55 $2 off

    This is the script that I submitted. The script is based on the chapter of "Using Objects in PHP Scripts". I am running on PHP 5.3.5, Apache 2.2 (HTTP Server) and MySQL version 5.1. The first script that I am posting is the classes that I defined for this assignment:
    PHP Code:
    <?php
    class CentralTexasCinema {
    }

    function 
    _construct(){ 
        
    $DBConnect = new mysql("localhost""root""seether7",
           
    "central_texas_cinema");  
    }

    include(
    "inc_CentralTexasCinemaDB.php");
    $this->DBConnect $DBConnect;

    ?>     
    public function setMovie($Movie) {
        if ($this->Movie != $Movie) {
            $this->Movie = $Movie;
            $SQLstring = "SELECT * FROM admission_prices" .
                      " where Movie = '"
                      $this->Movie . "'";
            $QueryResult = @$this->$DBConnect->
            query($SQLstring);
            if ($QueryResult === FALSE){
                 $this->MOvie = "";
            }
            else{
                $this->admission_prices = array();
                $this->ticketCounter = array();
                while(($Row = $QueryResult->fetch_assoc()))
                         !== NULL) {
                       $this->admission_prices[$ROW['age']] 
                             = array();  
                       $this->admission_prices[$ROW['age']]
                       ['prices_by_age'] 
                             = $Row['prices_by_age'];
                             $this->admission_prices[$Row['age']]      
                                   = $Row['prices_by_age']; 
                                   $this->ticketCounter[$Row['age']]   
                         }               = 0;
            }
        }
    }
    public function getMovieInformation() {
        $retval = FALSE;
        if ($this->Movie != ""){
             $SQLstring = "SELECT * FROM cinema_info " .
                       " where Movie = '"
                       $this->Movie . "'";
             $QueryResult = @$this->$DBConnect-> 
            query($SQLstring);
            if ($QueryResult === FALSE)
                 $retval = $QueryResult->fetch_assoc();   
        }
        return($retval);
    }

    public function getMovies() {
        $retval = FALSE;
        $subtotal = 0;
        if(count($this->admission_prices)> 0){
           echo "<table width='100%'>\n";
           echo "<tr><th>Movie Title</th><th>Age</th>" .
                "<th>Prices</th><th># at Ticket Counter</th>" .
                "<th>Totals</th><th>&nbsp</th></tr>\n";
           foreach ($this->Movies as $ID => $Info) {
               echo "<tr><td>" .
                    htmlentities($Info['age'])
                    . "</td>\n";
               echo "<td>" .
                    htmlentities($Info['prices_by_age']) .
                    "</td>\n";
               printf("<td class = 'currency'>$%.2f
                     </td>\n", $Info['prices']);
               echo "<td class = 'currency'>"
                    $this->ticketCounter[$ID] . 
                    "</td>\n";       
               printf("<td class = 'currency'>$%.2f
                     </td>\n", $Info['prices'] *
                     $this->ticketCounter[$ID]);
               echo "<td><a href= '" .
                    $_SERVER['SCRIPT_NAME'] .
                    "?PHPSESSID=" . session_id() .
                    "&TicketToPurchase=$ID'>Add " .
                    " Ticket</a></td>\n";
               $subtotal += ($Info['prices'] *
                    $this->ticketCounter[$ID]);
             }
             echo "<tr><td colspan='4'>Subtotal</td>\n";
             printf("<td class = 'currency'>$%.2f</td>\n", 
                   $subtotal;
             echo "<td>&nbsp;</td></tr>\n";
             echo "</table>";
             $retval = TRUE;      
           }
           return($retval);
        }
    }

    public function addTicket() {
         $Movie = $_GET['TicketToPurchase'];
         if(array_key_exists($Movie, $this->ticketCounter))
              $this->ticketCounter[$Movie] += 1;
    }

    function _destruct() { 
        $DBConnect->close();
        if (!$this->DBConnect->connect_error)
             $this->DBConnect->close();
    }
    This next script is supposed to use the classes to output an HTML script:
    PHP Code:
    <?php
    session_start
    ();
    require_once(
    "inc_CentralTexasCinemaDB.php");
    require_once(
    "class_CentralTexasCinema.php");

    if (
    class_exists("CentralTexasCinema")) {
         if (isset(
    $_SESSION['currentMovie']))
            
    $Movie unserialize($_SESSION['currentMovie']);
         else {
           
    $Movie = new CentralTexasCinema();
         }
           
    $Movie->setMovie($Movie);
           
    $movieInfo $Movie->getMovieInformation();
    }              
    else {
         
    $ErrorMsgs[] = "The CentralTexasCinema is not available!";
         
    $Movie NULL;
    }
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""(Same as below)">
    <html xmlns="(Supposed to be a URL but forum rules will not allow it)">
    <head>
    <title><?php echo $movieInfo['name_number_cinema']; ?></title>
    <link rel"stylesheet" type="text/css" href="<?php echo
              
    $movieInfo['css_file']; ?>" />
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
    </head>
    <body>
    <h1><?php echo htmlentities($movieInfo['movie_title']); ?></h1>
    <h2><?php echo htmlentities($movieInfo['age']); ?></h2>
    <p><?php echo htmlentities($movieInfo['welcome']); ?></p>

    <?php
         $Movie
    ->getMovie();
         
    $_SESSION['currentMovie'] = serialize($Movie);
         
         if(isset(
    $_GET['TicketToPurchase']))
             
    $Movie->addTicket();
             
         if (
    class_exists("CentralTexasCinema")) {
              if (isset(
    $_SESSION['currentMovie']))
                    
    $Movie unserialize($_SESSION['currentMovie']);
              else {
                   
    $Movie = new CentralTexasCinema();
              }
              
    $Movie->setMovie($Movie);
              
    $movieInfo $Movie->getMovieInformation();
              if  (isset(
    $_GET['TicketToPurchase']))
                    
    $Movie->addTicket();            
         }
    ?>

    </body>
    <?php
    if (count($ErrorMsgs)) {
         foreach (
    $ErrorMsgs as $Msg)
              echo 
    "<p>" $Msg "</p>\n";
    }
    ?>  
    </html>
    <?php
    if(!$DBConnect->connect_error)
        
    $DBConnect->close();
    ?>
    This script is instantiating and closing the Database Object:
    PHP Code:
    <?php
    $ErrorMsgs 
    = array();
    $DBConnect = @new mysqli("localhost""root""seether7",     "central_texas_cinema");
    if(
    $DBConnect->connect_errno)
        
    $ErrorMsgs[] = "Unable to connect to the database server." .
        
    " Error Code " $DBConnect->connect_errno
        
    ": " $DBConnect->connect_error;
    ?>
    The last two are the files that I used to input into the tables in MySQL.

    The database name I used was Central_Texas_Cinema
    The first table name was ctc_age
    The second table was ctc_info

    admission_prices had two fields (age, prices)
    'under 5' , '0.00'
    '5 to 17' , '5.00'
    '18 to 55' , '10.00'
    'Over 55' , '8.00'

    cinema_info had the fields (movies, age, prices, welcome and movie_title)

    "CTC1","Over 18","10","Welcome to Central Texas Cinema","The Rite";
    "CTC1","Over18","10","Welcome to Central Texas Cinema", "Black Swan";
    "CTC1","Over 18","10","Welcome to Central Texas Cinema","The Eagle";
    "CTC1","Over 18","10","Welcome to Central Texas Cinema","I Am Number Four";
    "CTC1","Over 18","10","Welcome to Central Texas Cinema","The Green Hornet";
    "CTC1","Over 18","10","Welcome to Central Texas Cinema","The Roomate";
    "CTC1","Under 18","10","Welcome to Central Texas Cinema","Gnomeo & Juliet";

    I was told if I can fix the script I can resubmit by this Tuesday at midnight. I am really desperate to get a good grade in this class and learn from my mistakes so I would be very greatful if someone could please help me. Thank you in advance for your continued correspondence.
    Last edited by drgroove; February 25th, 2011 at 11:40 PM.
  2. #2
  3. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,128
    Rep Power
    9398
    So what's to fix? What's the problem? What should we look for?
  4. #3
  5. Moderator Emeritus
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2002
    Location
    Austin, TX
    Posts
    7,186
    Rep Power
    2265
    Added [ php ] tags to post.

    First up, Welcome to Devshed, and please read through this: How to Post a Question

    Second, we're not going to re-write your code for you, but hopefully we can point you in the right direction so that you can re-write the code yourself, successfully.

    Third, now that I've added code tags to your post, you should be able to see a giant flashing red light bug with your first block of PHP code. I'll give you a hint: All PHP code has to be contained w/in PHP tags, like:
    PHP Code:
    <?php 
    // your code here 
    ?>
    ... see where your first bug is yet?
    DrGroove, Devshed Moderator | New to Devshed? Read the User Guide | Connect with me on LinkedIn
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2011
    Posts
    4
    Rep Power
    0
    Originally Posted by requinix
    So what's to fix? What's the problem? What should we look for?
    Thats my problem the feedback I recieved was so obtuse I don't even know what to look for. This was the feedback that I recieved from the instructor:

    Instructor Feedback
    Grade : 25 out of 50

    Comments : Incomplete. I could not get the script to run. You can get some extra time to fix any issued if you wish and re-submit for a grade. If you plan to re-submit please do so by the last day of class.

    I ran the script and it seemed to work, so that's why I posted maybe a set of "new eyes" can identify something that I can't.
  8. #5
  9. Moderator Emeritus
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2002
    Location
    Austin, TX
    Posts
    7,186
    Rep Power
    2265
    The script you posted to the forum will definitely not run; at least, not the way you've posted it. Did you copy & paste your code exactly as it was written? What type of environment are you running this code in?

    I just pointed out an issue for you in my first response; did you understand what I was trying to get at? You've got tons of eyes looking at your code right now, and trust me, we know exactly where the problems are... but, we're generally here to teach you to fish, not to fish for you.

    So... either the code you posted is not the code you're running successfully, or the code you posted is exactly as it exists on your machine. If the code you posted isn't what you're running (as I'm not certain how what you posted would run at all, given the glaring issue that I pointed out earlier), then post the code you're able to successfully run. If the code you posted is, in fact, the way you've got it running on your machine, then pick out where your first (major, problematic, glaring) issue is (with your PHP code tags), and we'll move on from there.

    Got it?
    DrGroove, Devshed Moderator | New to Devshed? Read the User Guide | Connect with me on LinkedIn
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2011
    Posts
    4
    Rep Power
    0
    Originally Posted by drgroove
    Added [ php ] tags to post.

    First up, Welcome to Devshed, and please read through this: How to Post a Question

    Second, we're not going to re-write your code for you, but hopefully we can point you in the right direction so that you can re-write the code yourself, successfully.

    Third, now that I've added code tags to your post, you should be able to see a giant flashing red light bug with your first block of PHP code. I'll give you a hint: All PHP code has to be contained w/in PHP tags, like:
    PHP Code:
    <?php 
    // your code here 
    ?>
    ... see where your first bug is yet?
    First off Thank you for the welcome, and yes I did read the posting guidelines, hence the reason I attempted to give as much information as possible.

    Secondly, I find it slightly offensive that you are implying that I would ask any one to re-write my code for me....Isn't there a word for that sort of thing? Oh yeah, PLAGIARISM, just want I would wish to taint my academic record with. Third Yes I did see the missing PHP tags, and that was my error as I was fiddling with the code and strted seeing a "multi attribute line" error that seemed to go away only when I removed the tags and reapplied them, when I found this site I was very tired and exceedingly frustrated so yes that was my bad for failing to remember to reapply them as I was not thinking clearly. So thank you for reapplying the tags. The only reason I attempted to ask for help is because I looked at it for 4 hours prior to posting this message and my eyes were a bit buggy, so hence the reason I used the line "a set of new eyes might help". And way to go, using my response to the initial person whom I was responding to, to say that the missing PHP tags were "glaring" at me. Look I came here to ask for help so if you can point in the right direction great otherwise don't be so pompous in your responses therefore wasting my time and yours. I am pressed for time as I am trying to figure out what's wrong with this code while trying to complete my final. The only thing I want to do is maintaing my GPA, and I have an 86% in this class which is fairly unacceptable to me. I can up my grade if I get a near perfect score on my last two assignments. If anyone wishes to help wonderful, otherwise let me know so I can try an alternate means of figuring this out. Thanks.
  12. #7
  13. Moderator Emeritus
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2002
    Location
    Austin, TX
    Posts
    7,186
    Rep Power
    2265
    Originally Posted by shellee1983
    First off Thank you for the welcome, and yes I did read the posting guidelines, hence the reason I attempted to give as much information as possible.

    Secondly, I find it slightly offensive that you are implying that I would ask any one to re-write my code for me....Isn't there a word for that sort of thing? Oh yeah, PLAGIARISM, just want I would wish to taint my academic record with. Third Yes I did see the missing PHP tags, and that was my error as I was fiddling with the code and strted seeing a "multi attribute line" error that seemed to go away only when I removed the tags and reapplied them, when I found this site I was very tired and exceedingly frustrated so yes that was my bad for failing to remember to reapply them as I was not thinking clearly. So thank you for reapplying the tags. The only reason I attempted to ask for help is because I looked at it for 4 hours prior to posting this message and my eyes were a bit buggy, so hence the reason I used the line "a set of new eyes might help". And way to go, using my response to the initial person whom I was responding to, to say that the missing PHP tags were "glaring" at me. Look I came here to ask for help so if you can point in the right direction great otherwise don't be so pompous in your responses therefore wasting my time and yours. I am pressed for time as I am trying to figure out what's wrong with this code while trying to complete my final. The only thing I want to do is maintaing my GPA, and I have an 86% in this class which is fairly unacceptable to me. I can up my grade if I get a near perfect score on my last two assignments. If anyone wishes to help wonderful, otherwise let me know so I can try an alternate means of figuring this out. Thanks.
    Chill out. Don't get snippy with Forum Moderators; prolly not a good move. We're trying to help, OK? Just... breathe...

    Anyhow. Re-post your code with any bug fixes you've made since your first post, and I'll see if it runs.
    DrGroove, Devshed Moderator | New to Devshed? Read the User Guide | Connect with me on LinkedIn
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2011
    Posts
    4
    Rep Power
    0
    Originally Posted by drgroove
    Chill out. Don't get snippy with Forum Moderators; prolly not a good move. We're trying to help, OK? Just... breathe...

    Anyhow. Re-post your code with any bug fixes you've made since your first post, and I'll see if it runs.
    My apologies for the snippiness and I had assumed you were a moderator or something due to your initial post addressing me and the first post I had read addressing the issue of "posting properly" (yes, I do tend to pay that much attention to detail), but I found your remarks to be a bit uncalled for, I do not take kindly to anyone talking down to me. I generally try to do the right thing, and I am aware that you have no idea who I am or how long I have spent on this project which was about the equivilent of 3 and a half days. I have spent over 14 hours trying to find an issue, I am not the type of person to ask for help unless absolutley necassary. Any rate the code that I had that was working is exactly the same that I had posted previously but here its is yet again:

    PHP Code:
    //php
    <?php
    class CentralTexasCinema {
    }

    function 
    _construct(){ 
        
    $DBConnect = new mysql("localhost""root""seether7",
           
    "central_texas_cinema");  
    }

    include(
    "inc_CentralTexasCinemaDB.php");
    $this->DBConnect $DBConnect;

    ?>  

    <?php   
    public function setMovie($Movie) {
        if (
    $this->Movie != $Movie) {
            
    $this->Movie $Movie;
            
    $SQLstring "SELECT * FROM admission_prices" .
                      
    " where Movie = '"
                      
    $this->Movie "'";
            
    $QueryResult = @$this->$DBConnect->
            
    query($SQLstring);
            if (
    $QueryResult === FALSE){
                 
    $this->MOvie "";
            }
            else{
                
    $this->admission_prices = array();
                
    $this->ticketCounter = array();
                while((
    $Row $QueryResult->fetch_assoc()))
                         !== 
    NULL) {
                       
    $this->admission_prices[$ROW['age']] 
                             = array();  
                       
    $this->admission_prices[$ROW['age']]
                       [
    'prices_by_age'
                             = 
    $Row['prices_by_age'];
                             
    $this->admission_prices[$Row['age']]      
                                   = 
    $Row['prices_by_age']; 
                                   
    $this->ticketCounter[$Row['age']]   
                         }               = 
    0;
            }
        }
    }
    public function 
    getMovieInformation() {
        
    $retval FALSE;
        if (
    $this->Movie != ""){
             
    $SQLstring "SELECT * FROM cinema_info " .
                       
    " where Movie = '"
                       
    $this->Movie "'";
             
    $QueryResult = @$this->$DBConnect-> 
            
    query($SQLstring);
            if (
    $QueryResult === FALSE)
                 
    $retval $QueryResult->fetch_assoc();   
        }
        return(
    $retval);
    }

    public function 
    getMovies() {
        
    $retval FALSE;
        
    $subtotal 0;
        if(
    count($this->admission_prices)> 0){
           echo 
    "<table width='100%'>\n";
           echo 
    "<tr><th>Movie Title</th><th>Age</th>" .
                
    "<th>Prices</th><th># at Ticket Counter</th>" .
                
    "<th>Totals</th><th>&nbsp</th></tr>\n";
           foreach (
    $this->Movies as $ID => $Info) {
               echo 
    "<tr><td>" .
                    
    htmlentities($Info['age'])
                    . 
    "</td>\n";
               echo 
    "<td>" .
                    
    htmlentities($Info['prices_by_age']) .
                    
    "</td>\n";
               
    printf("<td class = 'currency'>$%.2f
                     </td>\n"
    $Info['prices']);
               echo 
    "<td class = 'currency'>"
                    
    $this->ticketCounter[$ID] . 
                    
    "</td>\n";       
               
    printf("<td class = 'currency'>$%.2f
                     </td>\n"
    $Info['prices'] *
                     
    $this->ticketCounter[$ID]);
               echo 
    "<td><a href= '" .
                    
    $_SERVER['SCRIPT_NAME'] .
                    
    "?PHPSESSID=" session_id() .
                    
    "&TicketToPurchase=$ID'>Add " .
                    
    " Ticket</a></td>\n";
               
    $subtotal += ($Info['prices'] *
                    
    $this->ticketCounter[$ID]);
             }
             echo 
    "<tr><td colspan='4'>Subtotal</td>\n";
             
    printf("<td class = 'currency'>$%.2f</td>\n"
                   
    $subtotal;
             echo 
    "<td>&nbsp;</td></tr>\n";
             echo 
    "</table>";
             
    $retval TRUE;      
           }
           return(
    $retval);
        }
    }

    public function 
    addTicket() {
         
    $Movie $_GET['TicketToPurchase'];
         if(
    array_key_exists($Movie$this->ticketCounter))
              
    $this->ticketCounter[$Movie] += 1;
    }

    ?>

    <?php
    function _destruct() { 
        
    $DBConnect->close();
        if (!
    $this->DBConnect->connect_error)
             
    $this->DBConnect->close();
    }
    ?>

    //php
    Last edited by drgroove; February 26th, 2011 at 04:30 PM.
  16. #9
  17. Moderator Emeritus
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2002
    Location
    Austin, TX
    Posts
    7,186
    Rep Power
    2265
    Originally Posted by shellee1983
    My apologies for the snippiness and I had assumed you were a moderator or something due to your initial post addressing me and the first post I had read addressing the issue of "posting properly" (yes, I do tend to pay that much attention to detail), but I found your remarks to be a bit uncalled for, I do not take kindly to anyone talking down to me. I generally try to do the right thing, and I am aware that you have no idea who I am or how long I have spent on this project which was about the equivilent of 3 and a half days. I have spent over 14 hours trying to find an issue, I am not the type of person to ask for help unless absolutley necassary. Any rate the code that I had that was working is exactly the same that I had posted previously but here its is yet again:
    Edited your post to add PHP tags to your code, which improves readability. This is referenced in the "How to Ask a Question" post, btw.

    I've re-read through my earlier posts, and fail to find anything which would cause offense. I understand you're in school, and therefore probably young, so I'll say this as gently as possible: Be less sensitive. In the professional world, people are hard, cutting, sometimes mean, and definitely straight to the point. You won't be coddled, and no one gives a **** about your feelings. Including me.

    Regarding the amount of time you've spent writing this code: It shows. The code is poorly written, wrought with errors and idiomatic issues, and shows all of the signs of being the product of an absolute beginner with little to no attention to detail. Again - this is not a personal attack - this is a professional critique of your work. When (and if) you do start writing code professionally, be prepared to spend 70 to 100 hours per week writing, debugging, and testing software. 14 hours is less than a full day of work for most of us, and whining about it makes no difference to anyone.

    OK - hard life lesson speech over. Back to the Nice Dr. Groove.

    All that being said, I'll take some time out of my day now to run your code, to see what (if any) errors, warnings, etc come up.

    In the meantime, a couple of coding tips:

    1. Unless you're object implements a design pattern which dictates otherwise, such as Factory, AbstractFactory, Decorator, etc; include, include_once, require, and require_once should appear at the top of your class, not at the bottom, and not randomly within your code. This is standard practice across all server-side development languages.

    2. All functions should be contained within classes. Unless you're implementing a GUI which requires the occasional anonymous class, each class should be contained w/in it's own file. Adopt a standard naming convention; for example, a class could be called SomeClassName, while the file it's stored in is called some_class_name.php.

    3. Avoid string checks like (if $this->Movie != ""). Use isset() or empty().

    I'll post back as I find coding issues and/or think of additional idiomatic best practices.
    Last edited by drgroove; February 26th, 2011 at 04:57 PM.
    DrGroove, Devshed Moderator | New to Devshed? Read the User Guide | Connect with me on LinkedIn
  18. #10
  19. Moderator Emeritus
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2002
    Location
    Austin, TX
    Posts
    7,186
    Rep Power
    2265
    PHP Code:
    if ($QueryResult === FALSE){
                 
    $this->MOvie "";
            } 
    Should be $this->Movie, not $this->MOvie

    -----
    PHP Code:
    function _construct(){ 
        
    $DBConnect = new mysql("localhost""root""seether7",
           
    "central_texas_cinema");  
    }

    include(
    "inc_CentralTexasCinemaDB.php");
    $this->DBConnect $DBConnect
    __construct() has 2 leading underscores, not one.

    I have no idea how you're connecting to the database. $DBConnect is a var defined w/in the context of the __construct(), and has not been set as a member of the class, which would allow it to be accessible via $this->DBConnect. Additionally, IIRC, if you're planning on setting DBConnect as a member of the class, you'll have to pass $DBConnect by reference, not by value.

    Put your include() at the top of the class file. Also, either post the code for the include file, or point out what was included in the code you've already posted.

    -----

    PHP Code:
     if ($this->Movie != $Movie) { 
    Where are you setting $this->Movie? I don't see it anywhere in the code.

    -----

    You have 4 public functions listed in their own PHP blocks after your class definition. Are these meant to be functions that are part of the class? Or, are they separate functions?

    -----
    PHP Code:
    $QueryResult = @$this->$DBConnect->
            
    query($SQLstring); 
    Do not suppress database connection or query errors. Use try/catch blocks and manage exceptions and errors appropriately. Otherwise you risk having your application fail, and having little to no recourse for diagnosis and debugging. Essentially, never use @.


    Besides all of the issues/errors pointed out above, and additional questions that I'll ask once you've responded to this initial round, I cannot run your code, either. You have a litany of undefined variables, improper use of scope, a class constructor that will never be executed, and 4 functions whose purpose is not only ambiguous, but which are never actually called anywhere in the code you've posted (eg, you have public function setMovie(); however, nowhere in the code is there a call to setMovie()).

    Fix your code based on this initial analysis, post your revision (and use PHP code tags this time; you've been asked twice to do this already), and then we'll proceed to Round 2.
    Last edited by drgroove; February 26th, 2011 at 04:59 PM.
    DrGroove, Devshed Moderator | New to Devshed? Read the User Guide | Connect with me on LinkedIn

IMN logo majestic logo threadwatch logo seochat tools logo