我在$ new面前尝试过sort(),但它不会工作,我应该把它放在哪里?
$new = mysql_query("SHOW COLUMNS FROM Professors");
while($row = mysql_fetch_array($new)) {
$output .= "{$row['Field']}";
echo $output;
}
我也尝试过这样的事情:
$new = "SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'Professors' ORDER BY column_name";
但是,在我的SQL编译器上,它会对它们进行正确排序,它们不会在页面上打印出上面的确切代码。
答案 0 :(得分:0)
试试这个,然后:
public class PlayGifView extends View {
private static final int DEFAULT_MOVIEW_DURATION = 1000;
private int mMovieResourceId;
private Movie mMovie;
private long mMovieStart = 0;
private int mCurrentAnimationTime = 0;
@SuppressLint("NewApi")
public PlayGifView(Context context, AttributeSet attrs) {
super(context, attrs);
/**
* Starting from HONEYCOMB have to turn off HardWare acceleration to draw
* Movie on Canvas.
*/
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
}
public void setImageResource(int mvId){
this.mMovieResourceId = mvId;
mMovie = Movie.decodeStream(getResources().openRawResource(mMovieResourceId));
requestLayout();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if(mMovie != null){
setMeasuredDimension(mMovie.width(), mMovie.height());
}else{
setMeasuredDimension(getSuggestedMinimumWidth(), getSuggestedMinimumHeight());
}
}
@Override
protected void onDraw(Canvas canvas) {
if (mMovie != null){
updateAnimtionTime();
drawGif(canvas);
invalidate();
}else{
drawGif(canvas); //NULLPTR EXCEPTION
}
}
private void updateAnimtionTime() {
long now = android.os.SystemClock.uptimeMillis();
if (mMovieStart == 0) {
mMovieStart = now;
}
int dur = mMovie.duration();
if (dur == 0) {
dur = DEFAULT_MOVIEW_DURATION;
}
mCurrentAnimationTime = (int) ((now - mMovieStart) % dur);
}
private void drawGif(Canvas canvas) {
mMovie.setTime(mCurrentAnimationTime); //NULLPTR EXCEPTION
mMovie.draw(canvas, 0, 0);
canvas.restore();
}
}
您正确地订购并按列名选择,但您没有获得正确的字段名称。