4 Replies - 430 Views - Last Post: 14 January 2012 - 03:54 PM Rate Topic: -----

#1 mattrmclaren  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 109
  • Joined: 10-September 11

Syntax error, inefficient but

Posted 13 January 2012 - 07:43 PM

I went through this piece by piece making sure every line worked. Now, I can't get it to work at all. It's a structural issue I just can't see it. The values of these properties are Facebook Graph API user attributes which can vary depending on the user. Any help on a solution would be appreciated.

        function newData () {
        $explode_start_date = explode("-", $this->employer_start_date);
        $explode_end_date = explode("-", $this->employer_end_date);
        if (isset($this->employer_position)) {
            if (isset($this->employer_location)) {
                if ($explode_start_date[0] != '0000' || $explode_start_date[1] != '00') {
                        if ($explode_end_date[0] != '0000' || $explode_end_date[1] != '00') {
                            echo "Location, Position, Start Date and End Date are set.";
                    }
                } elseif ($explode_start_date[0] == '0000' || $explode_start_date[1] == '00') {
                        if ($explode_end_date[0] != '0000' || $explode_end_date[1] != '00') {
                            echo "Location, Position and End Date are set.";
                    }
                }
            } elseif (!isset($this->employer_location)) {
                if ($explode_start_date[0] != '0000' || $explode_start_date[1] != '00') {
                        if ($explode_end_date[0] != '0000' || $explode_end_date[1] != '00') {
                            echo "Position, Start Date and End Date are set.";
                    }
                } elseif ($explode_start_date[0] == '0000' || $explode_start_date[1] == '00') {
                        if ($explode_end_date[0] != '0000' || $explode_end_date[1] != '00') {
                            echo "Position and End Date are set.";
                    }
                } elseif ($explode_start_date[0] != '0000' || $explode_start_date[1] != '00') {
                        if ($explode_end_date[0] == '0000' || $explode_end_date[1] == '00') {
                            echo "Position and Start Date are set.";
                    
                }
            }
        } else {
            if (isset($this->employer_location)) {
                if ($explode_start_date[0] != '0000' || $explode_start_date[1] != '00') {
                        if ($explode_end_date[0] != '0000' || $explode_end_date[1] != '00') {
                            echo "Location, Start Date and End Date are set.";
                        }
                } elseif ($explode_start_date[0] == '0000' || $explode_start_date[1] == '00') {
                    if ($explode_end_date[0] != '0000' || $explode_end_date[1] != '00') {
                            echo "Location, End Date are set.";
                    }
                } elseif ($explode_start_date[0] != '0000' || $explode_start_date[1] != '00') {
                    if ($explode_end_date[0] == '0000' || $explode_end_date[1] == '00') {
                            echo "Location, Start Date are set.";
                    }    
                } else {
                            echo "Only location is set";
                }
            } else {
                if ($explode_start_date[0] != '0000' || $explode_start_date[1] != '00') {
                        if ($explode_end_date[0] != '0000' || $explode_end_date[1] != '00') {
                            echo "Start Date and End Date are set.";
                        } elseif ($explode_end_date[0] == '0000' || $explode_end_date[1] == '00') {
                            if ($explode_start_date[0] != '0000' || $explode_start_date[1] != '00') {
                                    echo "Start Date only.";
                                }
                            }
                        } elseif ($explode_end_date[0] != '0000' || $explode_end_date[1] != '00') {
                            if ($explode_start_date[0] == '0000' || $explode_start_date[1] == '00') {
                                    echo "End Date only.";
                                }   
                            }
                        }
                    }
                }
            }

This post has been edited by mattrmclaren: 13 January 2012 - 07:44 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Syntax error, inefficient but

#2 creativecoding  Icon User is offline

  • Hash != Encryption
  • member icon


Reputation: 926
  • View blog
  • Posts: 3,204
  • Joined: 19-January 10

Re: Syntax error, inefficient but

Posted 13 January 2012 - 08:51 PM

Can we see the error?
Was This Post Helpful? 0
  • +
  • -

#3 izrafel  Icon User is offline

  • D.I.C Head

Reputation: 11
  • View blog
  • Posts: 95
  • Joined: 24-July 09

Re: Syntax error, inefficient but

Posted 14 January 2012 - 02:49 AM

what is the error is gives? (not only errors but also warnings, if any).
and the second question is what should this piece of code do?i mean what should the input and output be?

This post has been edited by izrafel: 14 January 2012 - 02:49 AM

Was This Post Helpful? 0
  • +
  • -

#4 mattrmclaren  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 109
  • Joined: 10-September 11

Re: Syntax error, inefficient but

Posted 14 January 2012 - 07:13 AM

There are no error messages, it just shoots nothing back. The point is to find which values are set and call separate functions accordingly.
Was This Post Helpful? 0
  • +
  • -

#5 JBrace1990  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 110
  • View blog
  • Posts: 760
  • Joined: 09-March 08

Re: Syntax error, inefficient but

Posted 14 January 2012 - 03:54 PM

Hey mattrmclaren, I've worked with the Facebook APi before and do it for a job. What exactly are you trying to accomplish? Maybe I'll be able to help you better then, but your code is very inefficient and I have trouble finding out what you want it to do.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1