我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

PHP - in_array问题

I wrote the following, but its saying that its the 'wrong datatype'.

Could someone tell me where im going wrong.

$newQuery = mysql_query("SELECT * FROM table WHERE left_id='$authId'");
$catid = mysql_fetch_array($newQuery);

if(in_array("99", $catId)){
    // A Director
} else {
    // A Researcher
}

Cheers,

You are assigning the row to $catid and later using $catId. Notice the capital "I". You also need to make sure $catId is an array because mysql_fetch_array will return FALSE if there are no rows.

近期文章

  • 求各位看看项目业务流程
  • 连续子数组的最大和(C语言实现)
  • 请问为什么if的顺序会影响打印的结果呢
  • IDEA中web项目运行问题
  • 安装好虚拟机之后重启页面一直加载不出来
  • 如何添加tqdm进度条
  • 大一新生一枚 求强人讲解一下
  • Keilstm32编译出现的错误
  • 创建虚荣URL
  • iPad code app 程序没问题用着用着就报错了有没有哪位哥看看咋回事-c语言
  • 安装visio2007时一直卡在安装进度界面是怎么回事?
  • 用virtualbox创建Ubuntu
  • 右循环整数如何实现呢
  • 请问为什么我这个代码出不来想要的结果,我想得到excel中所有符合条件的行
  • 运行结果及报错内容,如何解决?
  • IGBT的栅极和源极的稳压二极管和电阻电容什么作用
  • 用js轮播图片动不了
  • Magento控制器应该被宣布为FINAL吗?
  • sql serve 下载出错
  • 刚开始学c,有些问题如下,

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华