Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.1k views
in Technique[技术] by (71.8m points)

在wordpress中怎么使用sql?

先上代码

<?php
    global $wpdb;
    $str="hello";
    $nodesPHP = $wpdb -> get_results("select * from $wpdb->nodes;", OBJECT);
?>

原本这是html文件因为要使用d3.js的library,但是又要用到wordpress的数据库,于是我把html后缀改成了php然后想从wordpress数据库中拿数据。

“$str="hello";” 这一行可以完美运行,但是加上了取数据的代码之后d3.js的部分就渲染不出来了。浏览器控制台也没有任何报错,尝试过了将"$wpdb->nodes"改为"nodes"也没有任何作用,请问是代码错了吗?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...