I am a little out of practice with my php and mysql but this particular issue has me scratching my head.
This function works fine.
public function updateGarmentInUse($garid,$inUse){
$stmt = $this->dbconnect->prepare('UPDATE garments SET garments.inuse = ?,
garments.dateupdated = CURDATE() WHERE garments.garmentid = ?');
$stmt->bind_param("ii",$garInUsePost,$garIdPost);
$garIdPost = $garid;
$garInUsePost = $inUse;
return $stmt->execute();
}
However the following function does not work.
public function getOneGarment($garid){
$stmt = $this->dbconnect->prepare('SELECT garments.garmentid,garments.typeid,garments.sizeid,garments.colorid,garments.timeperiodid,
garments.inuse,DATE_FORMAT(garments.dateentered, "%M %d %Y") AS invdate
FROM garments WHERE garments.garmentid = ? ');
$stmt->bind_param("i",$garIdPost);
$garIdPost = $garid;
return $stmt->execute();
}
I receive Call to a member function fetch_assoc() error on my page which I assume means the query is not properly formed. In order to identify the problem I made the function to read as the following.
public function getOneGarment($garid){
$garIdPost = $garid;
return $this->dbconnect->query('SELECT garments.garmentid,garments.typeid,garments.sizeid,garments.colorid,garments.timeperiodid,
garments.inuse,DATE_FORMAT(garments.dateentered, "%M %d %Y") AS invdate
FROM garments WHERE garments.garmentid ='.$garIdPost.'');
}
Since this works I assume that means the value is being passed to the function correctly so I'm at a lost.
Full error I see in my browser.
PHP Fatal error: Uncaught Error: Call to a member function fetch_assoc() on boolean in C:\inetpub\wwwroot\example1\views\editGarments.php:20 Stack trace: #0 C:\inetpub\wwwroot\example1\index.php(24): include() #1 {main} thrown in C:\inetpub\wwwroot\example1\views\editGarments.php on line 20