求助preg split_split() expects parameter 2 to be string, array given in app/setup/check.php on line 116

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in D:\www\Apache2\_百度知道
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in D:\www\Apache2\
]=$if(($$_SESSION['$sql=&session_start();stuname';];&script&gt!'&#47!$row))出错时什么原因&gname')&$result=mysql_query($sql)!$row)) echo&alert('没有该学生的信息;;;$row=mysql_fetch_array($result);$gname'$gname=@$_POST[&#39.php 数据库文件没问题 提示if(($gname!==NULL)&&(;select * from stdent where name=&#39!==NULL)&&(;&&;;script&gt.php&quot?php require &quot?&gt
提问者采纳
$gname变量在mysql查询中数据类型有误。先校验提交的stuname是不是有效的再进行查询吧。不然会有很多类似报错。
提问者评价
那如果是char类型的要怎么写查询语句,谢谢
其他类似问题
boolean的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁How to Split a String Into Two Variables in PowerShell | eHow
Microsoft PowerShell is a framework for running scripts and automating tasks using the Microsoft Windows operating system. PowerShell v2.0 is available for Windows 7 and can also be used with Windows XP if Service Pack 3 has been installed. Using the PowerShell "Split" function, a string can be broken up into parts using a custom delimiter. The result is returned in the form of an array, with each array element containing a part of the original string.
Start Windows PowerShell by clicking the Windows "Start" button and typing "powershell" into the "Search programs and files" text box. This will open the Windows PowerShell console.
Type "notepad split.ps1" in the PowerShell console to open Microsoft Notepad and create a new script called "split.ps1." Click "Yes" when prompted by Notepad to allow the new file to be created.
Type the following commands into the new file, then save the file:
$text = "Windows PowerShell - Hello world!"
$split = $text.split("-")
echo $split[0]
echo $split[1]
First, a string is created named "$text" which holds the text to be split. The string is then split using the PowerShell "Split" function, passing in the character the string is to be split by. In the code above, the string is split at the location of the hyphen. This creates an array in "$split" with two elements. The first element contains all the text up to the hyphen and the second element contains all the text after the hyphen. The contents of the two elements are then displayed to verify the command has worked.
Run the script in PowerShell by typing ".\split.ps1" and the display will show the output below, indicating the command was successful:
Windows PowerShell
Hello World!WordPress › Support & Warning message &Warning: in_array() expects parameter 2 to be array, null given
Ready to get started?
Warning message &Warning: in_array() expects parameter 2 to be array, null given (9 posts)
Posted 2 years ago
The site I am working on has many pages with many menus. I currently have the parent pages and their ancestors showing the pertinent menu according to code in the sidebar.php and the following function:
// Check if page is an ancestor
function is_ancestor($post_id) {
global $wp_
$ancestors = $wp_query-&post-&
if ( in_array($post_id, $ancestors) ) {
My news page (where posts are displayed) is a child of About. When I try to call the About Menu as per the rest of the site I get the following warning:
Warning: in_array() expects parameter 2 to be array, null given in /Users/..../functions.php on line 138
I am working locally so unfortunately I cannot provide a link to the site.
Posted 2 years ago
Check that $ancestors is an array before trying to use it:
if ( is_array($ancestors) && in_array($post_id, $ancestors) ) {
Posted 2 years ago
Sorry for my ignorance. I am learning pHp as I go.
Where should I put this statement? In functions.php or within the sidebar.php where I am trying to call the menu? How would I specifically check the news page? The above function works perfectly for the rest of the site. It is only the posts page (news) that I get the warning on.
Posted 2 years ago
You prepend your current if condition to consider checking for an array,
E.g your code should be
// Check if page is an ancestor
function is_ancestor($post_id) {
global $wp_
$ancestors = $wp_query-&post-&
if ( is_array($ancestors) && in_array($post_id, $ancestors) ) {
Posted 2 years ago
Yes, what I gave you was a rewrite of one of the lines of code that you provided.
Posted 2 years ago
Okay gotcha. I amended the code and the warning disappeared. Great!
Now knowing this what would be the recommended way to call the About Menu? This page is still, for all intents and purposes, a child page of About. I still need to call the About Menu but have to do it differently than the current mechanism used for all other pages.
Posted 2 years ago
How did you make your blog index a 'child' of your about page?
Posted 2 years ago
I say it's a child page because it is not a link on the main nav but rather you have to first go to About. Then there is a sub-nav with a News link.
I have the respective menus showing on the rest of the site by using the following code:
if ( is_page( 'solutions' )) {
wp_nav_menu(array('menu'=&'solutions-menu' ));
elseif ( is_page( 'webcasts' ) || is_ancestor( '17' ) ) {
wp_nav_menu(array('menu'=&'webcasts-menu' ));
This doesn't seem to be working with the posts page. I also tried naming it directly e.g.
if ( is_page( 'solutions' )) {
wp_nav_menu(array('menu'=&'solutions-menu' ));
elseif ( is_page( 'news' )) {
wp_nav_menu(array('menu'=&'about-menu' ));
This also doesn't seem to work. I am getting a menu but not the correct one. Instead I am getting a menu consisting of News and Press Releases. Press Releases is the other post page I have on this site. I use categories to post each to it's own page.
Posted 2 years ago
Ok. You are talking about how you have your links setup, about how your front end user interface is constructed. I need to know how the pages and posts are setup in the backend. I need to know how it looks to the software and how it looks to the server, not how you lead users to it.
Topic Closed
This topic has been closed to new replies.
About this Topic
Started 2 years ago by AdreaUI
from s_ha_dum
This topic is not resolved
WordPress version: 3.4
Code is Poetry

我要回帖

更多关于 php preg split 的文章

 

随机推荐