Click here to Skip to main content
15,920,633 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRe: How Do I Place Google Translate Correctly Pin
xiecsuk20-Jan-17 0:01
xiecsuk20-Jan-17 0:01 
QuestionWhy my fetch row method just repeats the first record multiple times (same count as my number of fields in the table) Pin
ELMAGLAYA17-Jan-17 17:07
ELMAGLAYA17-Jan-17 17:07 
I've tried code this below but it gives me one record and it repeats 7 times. Wrong output. Can anyone has a good heart to figure it out please. Please see my complete code below. I'm just a newbie in programming. Sorry. Thank you.
===================================
OUTPUT: 1111111
===================================
_conn=new PDO("mysql:host=$this->_hostdb;dbname=$this->_namedb",$this->_userdb,$this-_passdb);
$this->_conn- >setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
if($this->_conn){
echo "Connected Successfully!
";
}

} catch (Exception $ex) {
echo ("Connection Failed!")."
".$ex->getMessage();
}
}

public static function getInstance(){
if(!isset(self::$_instance))
{
return self::$_instance=new DB();
}
}

public function processQuery($sql){
try{

$q=$this->_conn->prepare($sql);
$q->execute();
$q->setFetchMode(PDO::FETCH_ASSOC);
return $this->rowResult=$q->fetch();

} catch (Exception $ex) {
return ("Failed!")."
".$ex->getMessage();
}
}

public function getResultSet(){
return $this->rowResult;
}

//MAIN PROGRAM
$dbUser=DB::getInstance();
$user=$dbUser->processQuery("SELECT * FROM users");

for($i=0;$i<count($dbuser->rowResult);$i++){
echo $user['id'];
}

?>

modified 17-Jan-17 23:17pm.

AnswerRe: Why my fetch row method just repeats the first record multiple times (same count as my number of fields in the table) Pin
Ashwin. Shetty17-Jan-17 17:39
Ashwin. Shetty17-Jan-17 17:39 
GeneralRe: Why my fetch row method just repeats the first record multiple times (same count as my number of fields in the table) Pin
ELMAGLAYA17-Jan-17 17:41
ELMAGLAYA17-Jan-17 17:41 
GeneralRe: Why my fetch row method just repeats the first record multiple times (same count as my number of fields in the table) Pin
Ashwin. Shetty17-Jan-17 18:32
Ashwin. Shetty17-Jan-17 18:32 
GeneralRe: Why my fetch row method just repeats the first record multiple times (same count as my number of fields in the table) Pin
ELMAGLAYA17-Jan-17 19:33
ELMAGLAYA17-Jan-17 19:33 
AnswerRe: Why my fetch row method just repeats the first record multiple times (same count as my number of fields in the table) Pin
COBOLdinosaur27-Feb-17 8:33
COBOLdinosaur27-Feb-17 8:33 
QuestionI do not know why after entering the second number for the second time, it always gives the same result Pin
Member 1294604611-Jan-17 17:35
Member 1294604611-Jan-17 17:35 
AnswerRe: I do not know why after entering the second number for the second time, it always gives the same result Pin
ZurdoDev13-Jan-17 6:08
professionalZurdoDev13-Jan-17 6:08 
QuestionI do not know why after entering the second number for the second time, it always gives the same result Pin
Member 1294604611-Jan-17 17:35
Member 1294604611-Jan-17 17:35 
AnswerRe: I do not know why after entering the second number for the second time, it always gives the same result Pin
ZurdoDev13-Jan-17 6:08
professionalZurdoDev13-Jan-17 6:08 
QuestionHTML fo uploading image file Pin
FilippoCSM10-Jan-17 3:51
FilippoCSM10-Jan-17 3:51 
AnswerRe: HTML fo uploading image file Pin
Nathan Minier10-Jan-17 6:43
professionalNathan Minier10-Jan-17 6:43 
GeneralRe: HTML fo uploading image file Pin
FilippoCSM10-Jan-17 9:20
FilippoCSM10-Jan-17 9:20 
QuestionWCF Service consumed through browser but NOT with WCFClient Pin
MrKBA5-Jan-17 20:17
MrKBA5-Jan-17 20:17 
AnswerRe: WCF Service consumed through browser but NOT with WCFClient Pin
Nathan Minier6-Jan-17 1:25
professionalNathan Minier6-Jan-17 1:25 
GeneralRe: WCF Service consumed through browser but NOT with WCFClient Pin
MrKBA6-Jan-17 1:57
MrKBA6-Jan-17 1:57 
GeneralRe: WCF Service consumed through browser but NOT with WCFClient Pin
Nathan Minier6-Jan-17 3:50
professionalNathan Minier6-Jan-17 3:50 
GeneralRe: WCF Service consumed through browser but NOT with WCFClient Pin
MrKBA6-Jan-17 4:45
MrKBA6-Jan-17 4:45 
QuestionSignalR on IIS Not Working Pin
Kevin Marois5-Jan-17 13:08
professionalKevin Marois5-Jan-17 13:08 
AnswerRe: SignalR on IIS Not Working Pin
ZurdoDev6-Jan-17 5:50
professionalZurdoDev6-Jan-17 5:50 
GeneralRe: SignalR on IIS Not Working Pin
Kevin Marois6-Jan-17 5:51
professionalKevin Marois6-Jan-17 5:51 
GeneralRe: SignalR on IIS Not Working Pin
ZurdoDev6-Jan-17 5:54
professionalZurdoDev6-Jan-17 5:54 
GeneralRe: SignalR on IIS Not Working Pin
Kevin Marois6-Jan-17 6:04
professionalKevin Marois6-Jan-17 6:04 
GeneralRe: SignalR on IIS Not Working Pin
ZurdoDev6-Jan-17 6:57
professionalZurdoDev6-Jan-17 6:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.