如何使用pdo prepare语句实现此目的

时间:2017-12-27 06:34:53

标签: php mysqli pdo output prepared-statement

在mysqli服务器中,我使用下面的代码来选择url代码指定的列:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<Button
    android:id="@+id/power"
    android:layout_weight="1"
    android:text="@string/power"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>
<Button
    android:id="@+id/volume_up"
    android:text="@string/volume"
    android:layout_weight="1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>
<Button
    android:layout_weight="1"
    android:id="@+id/scroll"
    android:text="@string/scroll"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>
<Button
    android:id="@+id/swipe"
    android:text="@string/swipe"
    android:layout_weight="1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

我尝试在我的pdo服务器中使用它,如代码:

@Override
protected void onServiceConnected() {
    // Create an overlay and display the action bar
    WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);
    mLayout = new FrameLayout(this);
    WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
    lp.type = WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY;
    lp.format = PixelFormat.TRANSLUCENT;
    lp.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
    lp.width = WindowManager.LayoutParams.WRAP_CONTENT;
    lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
    lp.gravity = Gravity.TOP;
    LayoutInflater inflater = LayoutInflater.from(this);
    inflater.inflate(R.layout.action_bar, mLayout);
    wm.addView(mLayout, lp);  
}

但它没有输出更好的结果请我如何使用pdo提前实现

1 个答案:

答案 0 :(得分:0)

两个代码清单都不安全。使用白名单获取$ get。

你应该循环fetchAll的结果

$rows = $sql->fetchAll();
foreach ($rows as $row)

{

   $id = $row["id"];

   $jjode = $row["code"];

   $product_name = $row["network"];

   $details = $row["details"];

   $logo = $row["logo"];

   $price = $row["price"];

}