Jump to content
Killersites Forums


  • Posts

  • Joined

  • Last visited

altergothen's Achievements


Newbie (1/14)



  1. Ahh! variable variables!!! Thank you very much lwsimon PHP.Net is great if you just know what you are looking for
  2. Hi there Please can someone point me in the right direction, where in the documentation can I read up on the following notation?... I am trying to figure out what the purpose of the braces around the variable are? $this->{$spec} if (is_string($spec)) { $subForm = $this->{$spec}; }
  3. IS there an easier way to get a single result from a PDO query than having to run a foreach when I already know that there should only be a single record or value being returned? I tried using $myresult = $dbh->exec($sql); ...but only returns a 1 $dbh = new PDO("$Driver1:host=$Server1;dbname=$db1", $User1, $Password1); try { $sql = "SELECT FileVersion FROM FileVersion WHERE GroupID = $GroupID ORDER BY FileVersion Desc"; foreach ($dbh->query($sql) as $myrow) { $FileVersion = $myrow['FileVersion']; } $dbh = null; } catch(PDOException $e) { echo $e->getMessage(); }
  4. Variable Variables??? I am used to concatenating variables like this when doing procedural PHP like this .... $i=5; ${"varnumber_$i"} = 'This variable should be called varnumber_5'; How do I make a variable variable in a PHP5 class ? How do I achieve the following without resorting to Case Statements? .... here is my event handler in my class : public function handleAction( $i ){ $this->handleEvent_$i } public function handleEvent_1 () { echo "Handling Event1"; } public function handleEvent_2 () { echo "Handling Event1"; } public function handleEvent_3 () { echo "Handling Event1"; }
  5. Hi there How do I concatenate variable variables from instance vars? Thanks...much appreciated <?php class myClass { var $testme1 = "one"; var $testme2 = "two"; var $testme3 = "Three"; function __construct(){ echo " Concat test "; } } $myInstance = new myClass(); for ( $i=1; $i <= 4; $i++) { $testme = ${"testme"."$i"}; $myVar = ${"testme"."$i"}; echo $this->$myVar; //??????????????????????????????????????????? }
  • Create New...