0

the variable is a string accord to var_dump, how can i pass it? is correct the way i do the query? DB is Msqli

public static function two()
{

    $risultato = modOne::one();
    var_dump($risultato);

    $ident = json_decode($risultato,true);

    $db = JFactory::getDBO();   

    $query=$db->prepare ("SELECT avatar AS memTotal FROM #__comprofiler WHERE id = ?");

    $query->bind_param("s", $ident);    

    $db->setQuery($query);
    $resulto = $db->query();
    return $resulto->fetch_object()->memTotal;

}

these return :

string(3) "751"
Fatal error: Call to a member function bind_param() on a non-object

Passerby
  • 9,715
  • 2
  • 33
  • 50
  • Have you checked `Related`? – u_mulder Feb 25 '14 at 07:53
  • You are using `JFactory` so you need to use query format differently. see this http://docs.joomla.org/J1.5:Accessing_the_database_using_JDatabase – GBD Feb 25 '14 at 08:01
  • Does this answer your question? [mysqli\_fetch\_assoc() expects parameter / Call to a member function bind\_param() errors. How to get the actual mysql error and fix it?](https://stackoverflow.com/questions/22662488/mysqli-fetch-assoc-expects-parameter-call-to-a-member-function-bind-param) – Dharman Jan 20 '20 at 22:06

0 Answers0