Why can't I use MYSQLI's prepared statement in PHP to query the data in the database (binding parameters or binding results), the project urgently! What to do with it

Source: Internet
Author: User
Why can't I use MYSQLI's prepared statement in PHP to query the data in the database (binding parameters or binding results), the project urgently!
The code is as follows:
PHP Code
  
   
  
   Stmt_init ();    Prepares statements for execution    $stmt->prepare ($query);    Execute statement    $stmt->execute ();    Binding result Parameters    $stmt->bind_result ($name, $pwd);    Loop through the results and output the data while    ($stmt->fetch ()) {        
", $name, $pwd); } Recovery Statement Resource $stmt->close (); Close connection $mysqli->close ();? >
What's the problem with this statement? I directly do the additions and deletions can be, but whether it is the use of mysqli binding results or the method of binding parameters are not, for the hero guidance Ah, the company will soon use it to do the project, emergency emergencies!!

------Solution--------------------
printf ("%s,%s,%s
", $name, $pwd);???

One parameter is missing.
or one more format character,
------Solution--------------------
One more placeholder. Don't you only have two parameters?
------Solution--------------------
One line of code is missing, and the query results can be stored temporarily for use.
For reference only:
PHP Code
function Selectlink ($oid) {$sql = "Select O.oid,l.lid,c.cid,comname,comprice,ordtime from Mis_order        O,mis_link l,mis_commodity C where O.oid=l.lid and C.cid=l.cid and o.oid=? ";        $stmt = $this->mysqli->prepare ($sql);        $stmt->bind_param ("i", $oid);        $stmt->execute ();        $stmt->store_result ();        $stmt->bind_result ($oid, $lid, $cid, $comName, $comPrice, Time);        $rows = $stmt->affected_rows;            if ($rows > 0) {$arrLink = array (); while ($stmt->fetch ()) {$arr = Array ("oid" = = $oid, "lid" =&gt ; $lid, "cid" = $cid, "Comname" and "$comName," Comprice "=&gt ;                $comPrice, "ordtime" = Time);            Array_push ($arrLink, $arr);        } return $arrLink; }else{echo "Query Order Details failed!
"; } }
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.