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 Sergey Alexandrovich Kryukov 414
1 Arun Vasu 223
2 OriginalGriff 190
3 CPallini 163
4 Aarti Meswania 158
0 Sergey Alexandrovich Kryukov 10,169
1 OriginalGriff 7,749
2 CPallini 4,181
3 Rohan Leuva 3,482
4 Maciej Los 3,089


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