Jump to content

akufen

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

akufen's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. So this is how you do it... <?php class myCar { var $color = "silver"; var $make = "Mazda"; var $model = "Protege5"; } $car = new myCar(); $car -> color = "red"; $car -> make = "Porsche"; $car -> model = "Boxter"; echo "I drive a: ".$car -> color." ".$car -> make." ".$car -> model; ?> My mistake was that I was using something like $car -> $color = 'some color'; when the correct way to assign a field value to an object is $car -> color 'some color'; (with the $ removed from the field name).
  2. yeah I typed the wrong thing, I am of course using echo($cssTemplate->$id); I also tried echo($cssTemplate->id); but no success
  3. Hi all! I get a 'Fatal error: Cannot access empty property' message when I try to print out the value of the $id field of the returned $someObject. The odd thing is that the $id field is populated when I try to echo the value in the method which returns $someObject! class someClass { public somefunction { $someObject = new SomeObject; while ($stmt->fetch()) { $someObject->$id = $id; } $stmt->close(); echo (someObject->$id); //This works! return $someObject; } } $clazz = new SomeClass; $someObject = $clazz->somefunction(); $echo someObject->$id; //This doesn't work! Thanks in advance!
  4. Hi I have two tables, person and rating. person contains only an id while rating contains id, person_id, value, and movie_id. Now what I want to do is to query for all the people who have rated two diffferent movies, say with id's 45 and 56. I know how to do this for a single movie at a time with the following query: SELECT person.id AS personId FROM person, rating WHERE person.id = rating.person_id AND rating.value = 5 AND rating.movie_id = 45. But how do I in a single query search for people who have rated both movies 45 and 56 with the value 5? Thanks!
  5. Hi I have a association table - rel_movie_rating - which has the columns movie_id and rating_id. How can I form a query which returns the most frequent movie_id's in the table? Thanks!
×
×
  • 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.