mysql_fetch_assoc()期望参数1为资源,给定{Laravel}数组

时间:2015-05-22 09:09:07

标签: laravel highcharts laravel-5 highstock

$result=DB::table('Table_26') ->select('id','data','((unix_timestamp(time) * 1000) as datetime) ->order_by('datetime') ->get();

$rows = array();
while($r = mysql_fetch_assoc($result['sql'])) {
$rows[] = $r; }
print json_encode($rows);

得到

的问题
  

mysql_fetch_assoc()期望参数1是资源,

我希望得到this

我需要这个来处理highstock

1 个答案:

答案 0 :(得分:2)

使用int count=0; @Override protected void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); //all that is below is within oncreate final int[] drawablearray=new int[]{R.drawable.one,R.drawable.two,R.drawable.three,R.drawable.four,R.drawable.five}; gettingBackground(drawablearray); } private void gettingBackground(final int[] drawablearray) { // TODO Auto-generated method stub new Handler().postDelayed(new Runnable() { public void run() { if(count<drawablearray.length){ LoginAct.this.getWindow(). setBackgroundDrawableResource(drawablearray[count]); count++; gettingBackground(drawablearray); } else{ count=0; } } }, 5000); }   - 然后:

$result=DB::table('Table_26') ->select('id','data','((unix_timestamp(time) * 1000) as datetime)->order_by('datetime')->get()->toArray();