Click here to Skip to main content
Sign Up to vote bad
good
See more: PHPMySQL
 
<?php
 
class article{
	
private $row;
 
public function __construct(){
 
require_once('connection.php'); 
mysql_select_db($db, $test);	
 
$query = "SELECT * FROM articles WHERE path = $_SESSION['path']";
$result = mysql_query($query, $test) or die(mysql_error());
$this->row = mysql_fetch_array($result);
 

}
 
public function process($field) {
 
if($field == 'tool'){
echo $this->row['path'];
}
else if($field == 'test'){
echo $this->row['title'];
}
 
 
}
 

}
 
$obj = new article();
$obj->process('tool');
$obj = new article();
$obj1->process('test');
 
?>
 
 
How to run the process method twice in this scenario? It just run once and execution stops.
Posted 17 Jan '13 - 7:14
AndyInUK2.7K


1 solution

Check
$obj = new article();
$obj->process('tool');
$obj = new article();
$obj1->process('test');
 
$obj1 not initialized. Hope this helps.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 OriginalGriff 335
1 Sergey Alexandrovich Kryukov 318
2 Arun Vasu 315
3 Maciej Los 208
4 Aarti Meswania 180
0 Sergey Alexandrovich Kryukov 9,680
1 OriginalGriff 7,539
2 CPallini 4,018
3 Rohan Leuva 3,362
4 Maciej Los 2,951


Advertise | Privacy | Mobile
Web03 | 2.6.130523.1 | Last Updated 17 Jan 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid