I am urgently seeking assistance with the following error:
Commands out of sync; you can't run this command now

here's the code:

$sql="select pr1.".$_SESSION['lang'].", pr1.id, pr2.".$_SESSION['lang'].", pr2.id from `project` as pr2 join project as `pr1` on(pr1.id=pr2.parent_project) where pr2.id=?";
        $stmt = $mysqli->stmt_init();   
        $stmt->prepare($sql) or die ("Error preparing statement: ".$mysqli->error);
        $stmt->bind_param('i',$_GET['id']); 
        $stmt->execute() or die("Error, error, error!");
    $stmt->bind_result($group,$group_id,$project,$project_id);

I have tied non prepared statements (they work...) and have even changed the sql to something simple without binding parameters, but as soon as I get to the ececute statement the error is triggered.

Thanks in advance!

http://php.net/manual/en/mysqli.init.php

"Any subsequent calls to any mysqli function (except mysqli_options()) will fail until mysqli_real_connect() was called."

Remove line 2.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.