php莫名奇妙的中断问题,反正是if语句之后的全都没了
 <?php
$success = 0;
$user = $passwd = "admin1";
$mysql_server_name = "localhost";
$mysql_user = "root";
$mysql_passwd = "A135426ad";
$mysql_database = "test";
$con = mysqli_connect($mysql_server_name, $mysql_user, $mysql_passwd, $mysql_database);
if (!$con) {
    die('Could not connect:' . mysqli_error($con));
}
$mysql_sql = "select count(id) from test.user where id=\"" . $user . "\" and passwd=\"" .
    $passwd . "\"";
echo $mysql_sql;
$result = mysqli_query($con, $mysql_sql);
echo 1;
if ($result["count(id)"] == 1) {
    echo 2;
    $success = 1;
    echo 3;
}
echo 4;
mysqli_close($con);
?>

0

4个回答

$result那是对象,不是数组,自己打印看一下吧,用->调用。

1

在连接数据库的时候可以改成这样
mysqli_connect('www.form.com','root','root') or die('链接失败');

0

应该是PHP语言 写到了SQL语言中,SQL语言认识正则表达式和PHP语言吗,把$user和$passwd改成{$user}和{$passwd}放里面试一下
$mysql_sql = "select count(id) from test.user where id={$user} and passwd={$passwd}" ;

0

你想用的是mysql_query()吧;
误打成mysqli_query()了,
$result好像是布尔值吧,true FALSE

0
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
奇怪的问题:网卡莫名奇妙地没了?
Win2000,前几天还正常使用,后来发现网卡被停用,后来整个网卡就失效了,驱动也装不上,也卸在不了(说是启动时需要该设备)。使用ipconfig/all 发现node type是broadcast,是什么问题呢,是不是中毒了?
自己创建的存储过程莫名奇妙的没了。
在一个库里我创建了三个存储过程,两个先创建的,后创建的一个会丢失rn[数据库名称].[架构].[存储过程名称] rnCREATE PROCEDURE 然后在查询分析器里跑的rn这个存储过程我已经创建了四次了,昨天丢了三次,今天丢了一次。rn存储过程丢失之后,页面再提交就会堵满应用程序池的所有连接。
莫名奇妙的图片问题
图片上传后显示为一个红xx,下载后用ie也是显示红xx,但可以预览。在editplus中打开文件后,尾部为如下内容,使用acdsee转换格式,从新打开后正常。尾部没有了如下内容。rnrnrnrnrn rn 4294967295rn 120rn 47rn rnrn rn rnrn rn rn rnrn rn 1rn 300/1rn 300/1rn 2rn rnrn rn 2007-02-05T11:33:46+08:00rn 2007-02-13T09:49:51+08:00rn 2007-02-13T09:49:51+08:00rn Adobe Photoshop CS Windowsrn rnrn rn adobe:docid:photoshop:a2dd65ac-b4c9-11db-a3c9-cdf6d67cad34rn rnrn rn image/jpegrn rnrnrnrnrn
一个莫名奇妙的问题
我运行一个基于对话框的程序,主对话框为IDD_TALK_DIALOG.但联结时错误提示该对话框没有定义,请高手指教错在何处?
莫名奇妙问题
.h文件中#include "AlarmHostInfoTreeDlg.h"rnrnCAlarmHostInfoTreeDlg *m_AlarmHostInfoTree;rnrnrnrn提示错误:Error 4 error C2143: syntax error : missing ';' before '*'rn
莫名奇妙的问题
我机器上安装了2000 advance server和xp双系统,在2000下安装了office sql2000 vb6.0,但是现在有个问题.rndim cn as adodb.connectionrnset cn=new adodb.connection -->这句出现"自动话错误",是sql2000还是2k的问题?rn同样是这个简单的程序我编译后在xp下就没有问题.
莫名奇妙的问题。。
我用ADO做了个 连接数据库的 程序。。rn为了单机实现 我把 SQL数据库转换成了Access 用ODBC转接。。rn可是在程序运行 执行添加的时候 会出现 rnmicrosoft odbc microsoft Access SQL语句的结束位置缺少分号(;)rn换做SQL服务器 就不会出现这个问题。。。rn请高手指点,。
莫名奇妙的mysql_connect的问题
在php中:rnmysql_connect("localhost","aa","aa");失败rnmysql_connect("localhost","root","");成功rn在命令行:rnmysql -h localhost -u root 成功rnmysql -h localhost -u aa -paa 成功rn说明我的mysql用户建立是成功的阿,但在php中就是连不上去。。。。rn请问这是怎么回事啊???请高手 们指点rn使用的版本分别是:rnmysql-5.0.1-alpha-snapshot-winrnphp-5.0.1-Win32rnapache_2.0.50-win32-x86-no_ssl
莫名奇妙的问题。
怎么我感觉莫名奇妙了啊。。rn下面的一段代码,它为什么只执行了一部分啊.IF语句中它只执行到Nkey的赋值,后面的设置断点好像一点效果也没有根本不执行。高手帮忙看看吧。。rnSqlConnection conn=DB.createCon();rnconn.Open();rnSqlCommand cmd=new SqlCommand();rncmd.CommandText="sp_selAritclebyid";rncmd.CommandType=CommandType.StoredProcedure;rncmd.Connection=conn;rnSqlParameter articleid=new SqlParameter("@articleid",System.Data.SqlDbType.BigInt);rnarticleid.Value=Request.QueryString["articleid"];rncmd.Parameters.Add(articleid);rnSqlDataReader sdr=cmd.ExecuteReader();rn rnif(sdr.Read()==true)rnrnaid=sdr.GetInt64(0);rntitle=sdr.GetString(2);rncontent=sdr.GetString(1);rnclassname=sdr.GetString(3);rnNkey=sdr.GetString(8);rnsource=sdr.GetString(10);rnde=sdr.GetDateTime(12);rnhints=sdr.GetInt64(11);rnwriters=sdr.GetString(9);rnsdr.Close(); rn rnrnelsernrnResponse.Redirect("../error.aspx");rnrnconn.Close();
TADOQuery莫名奇妙的问题
在TADOQuery定义了一个参数ftSmallint:Node=13000rnrnSQL = "SELECT * FROM Meter WHERE Node <:Node" 没有返回结果rnSQL = "SELECT * FROM Meter WHERE Node <10000" 有返回结果rnSQL = "SELECT * FROM Meter WHERE 1000 <:Node" 没有返回结果rnSQL = "SELECT * FROM Meter WHERE 11 = :Node" 有返回结果rn以上是怎么回事???
莫名奇妙的问题,soft.....
我用pb7.0开发一个进销存软件,数据库是sql7.0。是多用户使用。但有时数据保存时总死机.我察看数据库管理中的进程信息,发现死机的机器的软件该进程(假设该进程是54)最后tql语句是(insert....),它堵塞另一个进程55(最后语句是select...)但并不是死索,如果把55进程kill,那么rn死机的机器虽恢复正常,但保存的数据不完整(保存时我是最后才全部提交的或全部回滚)我在所有select语句后加commit;以避免堵塞。但有时还会出现上述情况。如何解决:请各位大拿执教rn我是用数据窗口更新的 属性也没有问题但在数据窗口更新前还用sql语句更新过其他表,但也是最后提交的,更新的两个表中都有触发器,检查过没有问题,不存在嵌套和递归问题,sql服务器配置属性已设置rn
GetNextDlgGroupItem莫名奇妙的问题?
我在OnInitDialog()测试批处理控件,如下:rnrnfor (int i=0;i<7;i++)rn rn GetNextDlgGroupItem(GetDlgItem(IDC_SLIDERX))->EnableWindow(FALSE); //首先Group组内全无效rn rn for (int i=0;i<7;i++)rn rn GetNextDlgGroupItem(GetDlgItem(IDC_SLIDERX))->EnableWindow(TRUE); //接着立马组内全有效rnrn rnrnrn前一个for循环后,全部控件都无效了,这个达到了预想效果,但是接着后一个for循环后,本来控件应该变为全有效的,但是却只有Group中开头的那个控件有效,其它依旧无效,不知道什么原因,真奇怪?
莫名奇妙的问题?
我编了一个asp.net 的程序,在win2000 server上运行是一片空白,什么都没有,但是在win2000 professioner上运行正常.请问这到底是乍回事啊.
莫名奇妙的问题?
表结构如下:rncreate table OUTLN.T_TESTrn(rn A VARCHAR2(10),rn B VARCHAR2(10),rn C VARCHAR2(10)rn)rn下面是表中的三条记录rnA B Crn--------------------rna1 b1 c1rna2 b2 c2 rna3 b3 c3rn当我select * from OUTLN.T_TEST where A = 'a1';时就不返回记录,提示未选定行rn当我select * from OUTLN.T_TEST where B = 'b1';或者select * from OUTLN.T_TEST where C = 'c1';就返回记录,为什么用A字段查询就不返回记录呢?数据表明明有哇!我试了用A='a2'或者A='a3'一样查不出!!!rnrn望高手指点一二,谢谢!rn我用的是oracle816
struts2莫名奇妙的问题
[color=#FF0000]java.lang.reflect.InvocationTargetException[/color]rn sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn java.lang.reflect.Method.invoke(Method.java:585)rn com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:434)rn com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:273)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:235) com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:141)rn 。。。。。。。。。。。。。部分省略com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)rn com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)rn com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)rn com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:456)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)rn org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)rn org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:477)rn org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:467)rnrnrn环境:rnstruts2:[color=#FF0000]struts2-core-2.1.2.jar[/color]+[color=#FF0000]xwork-2.1.1.jar[/color]+[color=#FF0000]ognl-2.6.11.jar[/color]rnJDK:jdk1.5.0_06rnTOMCAT:tomcat-5.5.23rneclipse:用的是myeclipse 6.5.1 自带的3.3
安装莫名奇妙的问题
我安装2000p(光盘启动),开始光盘启动安装,进入安装,后系统提示重起,出现 rnsearching for boot record from cdrom ...okrnpress any key to boot from cd....rn但我按键没反映,不知道为什么
一个,莫名奇妙的问题!
代码贴上:rn[code=C/C++]includernint main()rnrn int i;rn int *p;rn p=&i;rn static int *q=NULL;rn return 0;rn[/code]rn[color=#FF0000]问题陈述:[/color]rn*.我用的是VC6.0的编译器rn*.[color=#0000FF]报错信息:[/color]G[color=#FF0000]:\测试\test.c(7) : error C2143: syntax error : missing ';' before 'type'[/color]rnPS:大家不要拍我,这个问题可能对大家很简单,但是我缺百思不得其解rn 另外:编译器没有问题,可以顺利运行Hello world!,说笑了!rn 最后:小C在这里谢谢各位,在CSDN中我们这些菜鸟得到很多大哥大姐和前辈们的帮助,使我们受益匪浅!rn
莫名奇妙的系统托盘问题
[color=Red]下面是我修改的一段托盘菜单模块,现在问题是,在一个新的工程里(只放一个按钮设置托盘)可以在托盘的图标上响应到form_mousemove事件(用断点检测),但是在我的程序里却检测不到mousemove事件[/color]rnrn[code]Option Explicitrnrn'**Originally published by Ryan Heldt (rheldt@vb-online.com)rn'**Modified by Donovan Parks (donopark@awinc.com)rnrn'Win32 API declarationrnDeclare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Booleanrnrn' Constants used to detect clicking on the iconrnPublic Const WM_LBUTTONDOWN = &H201rnPublic Const WM_RBUTTONUP = &H205rnrn' Constants used to control the iconrnPublic Const NIM_ADD = &H0rnPublic Const NIM_MODIFY = &H1rnPublic Const NIF_MESSAGE = &H1rnPublic Const NIM_DELETE = &H2rnPublic Const NIF_ICON = &H2rnPublic Const NIF_TIP = &H4rnrn' Used as the ID of the call back messagernPublic Const WM_MOUSEMOVE = &H200rnrn' Used by Shell_NotifyIconrnPublic Type NOTIFYICONDATArn cbSize As Longrn hwnd As Longrn uId As Longrn uFlags As Longrn ucallbackMessage As Longrn hIcon As Longrn szTip As String * 64rnEnd Typernrn'create variable of type NOTIFYICONDATArnPublic TrayIcon As NOTIFYICONDATArnrnPublic Sub SetToTray(FormToTray As Form, TrayIconA As Picture, WndHide As Boolean, TrayTips As String)rn '记录TrayIcon(NOTIFYICONDATA类型)的长度rn TrayIcon.cbSize = Len(TrayIcon)rn ' Handle of the window used to handle messages - which is the this formrn TrayIcon.hwnd = FormToTray.hwndrn ' ID code of the iconrn TrayIcon.uId = vbNullrn ' Flagsrn TrayIcon.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGErn ' ID of the call back messagern TrayIcon.ucallbackMessage = WM_MOUSEMOVErn ' The icon - sets the icon that should be usedrn TrayIcon.hIcon = TrayIconArn ' The Tooltip for the icon - sets the Tooltip that will be displayedrn TrayIcon.szTip = TrayTips & Chr$(0)rn rn ' Add icon to the tray by calling the Shell_NotifyIcon APIrn 'NIM_ADD is a Constant - add icon to trayrn Call Shell_NotifyIcon(NIM_ADD, TrayIcon)rn rn ' Don't let application appear in the Windows task listrn If WndHide Then FormToTray.Hide: App.TaskVisible = FalsernEnd SubrnrnPublic Sub ModifyTray(FormToTray As Form, TrayIconA As Picture, WndHide As Boolean, Optional TrayTips As String)rn '记录TrayIcon(NOTIFYICONDATA类型)的长度rn TrayIcon.cbSize = Len(TrayIcon)rn ' Handle of the window used to handle messages - which is the this formrn TrayIcon.hwnd = FormToTray.hwndrn ' ID code of the iconrn TrayIcon.uId = vbNullrn ' Flagsrn TrayIcon.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGErn ' ID of the call back messagern TrayIcon.ucallbackMessage = WM_MOUSEMOVErn ' The icon - sets the icon that should be usedrn TrayIcon.hIcon = TrayIconArn ' The Tooltip for the icon - sets the Tooltip that will be displayedrn If Not IsMissing(TrayTips) Then TrayIcon.szTip = TrayTips & Chr$(0)rn rn ' Add icon to the tray by calling the Shell_NotifyIcon APIrn 'NIM_ADD is a Constant - add icon to trayrn Call Shell_NotifyIcon(NIM_MODIFY, TrayIcon)rn rn ' Don't let application appear in the Windows task listrn If WndHide Then FormToTray.Hide: App.TaskVisible = FalsernEnd SubrnrnPublic Sub DeleteFromTray(FormToTray As Form)rn FormToTray.WindowState = vbNormalrn FormToTray.Showrn TrayIcon.cbSize = Len(TrayIcon)rn TrayIcon.hwnd = FormToTray.hwndrn TrayIcon.uId = vbNullrn 'Remove icon for Trayrn Call Shell_NotifyIcon(NIM_DELETE, TrayIcon)rnEnd Sub[/code]rnrn[color=Red]下面是新建工程里的mousemove代码,用来测试的,在我的程序里也是用同样的代码,但是现在不是里面代码的问题,现在是检测不到mousemove事件![/color]rnrn[code]Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)rn Static Message As Longrn Static RR As Booleanrn rn 'x is the current mouse location along the x-axisrn Message = X / Screen.TwipsPerPixelXrn rn If RR = False Thenrn RR = Truern Select Case Messagern ' Left double click (This should bring up a dialog box)rn Case WM_LBUTTONDOWNrn Me.WindowState = vbNormalrn Me.Showrn ' Right button up (This should bring up a menu)rn Case WM_RBUTTONUPrn Endrn 'SendMessage Form1.hwnd, WM_SYSCOMMAND, SC_CLOSE, ByVal 0&rn 'Me.PopupMenu mnuPopUprn End Selectrn RR = Falsern End IfrnEnd Sub[/code]
一个莫名奇妙的问题!
所有的client登陆到server中,登陆时发送client的信息,包括用户名和ip和port!rnm_pDoc->UserInfo[i].Name = RecvMess[i].Name;rnm_pDoc->UserInfo[i].IPAddr = RecvMess[i].IPAddr;rnm_pDoc->UserInfo[i].Port = RecvMess[i].Port;rnm_pDoc->UpdateAllViews(NULL, 0L, 0);rnrnRecvMess[i] 是接收到的信息,UserInfo[i]是server端保存的用户信息,保存在mfc的doc类中!rnrn然后server想把这些信息发给某一个clientrnrnfor (int j = 0; j < MAXClient; j++)rnrn if(m_aClientSocket[j] != INVALID_SOCKET)rn rn m_pDoc = GetDocument();rn RecvMess[j].Name = m_pDoc->UserInfo[j].Name;rn RecvMess[j].IPAddr = m_pDoc->UserInfo[j].IPAddr; rn RecvMess[j].Port = m_pDoc->UserInfo[j].Port;rnrn int iErrorCode = send ( m_aClientSocket[i], (char *)&RecvMess[j], // 发给客户端irn sizeof(RecvMess[j]), NO_FLAGS);rn if (iErrorCode == SOCKET_ERROR)rn ReportWinsockErr("客户端没有响应");rn rnrnrn问题来了,当只有一个客户端登陆时,完全ok!rn但是当两个客户端登陆时,就总是说内存无法访问?(对于不同的客户端用不同的socket连接tcp)rn断点调试 rnRecvMess[j].Name = m_pDoc->UserInfo[j].Name;rn此句总是通不过,为什么啊,急!rnrn是不是涉及到进程之间通信的问题呢?rnrn
加载图片出现的莫名奇妙问题
player = new Sprite(BitmapFactory.decodeResource(res, R.drawable.player1),16,16);rn explodes[i] = new Sprite(BitmapFactory.decodeResource(res, R.drawable.explode2),25,25);rnrn同样的两条语句,前一句没有问题,后一句就运行不过去,唯一的不同是,player1这个图片是一张126*64的图,explode2是一张75*25的图。sprite应该没有问题,不然player应该也不能初始化。把第二条语句explode2换成player1,16,16,就能够正常运行过去了。rnrn是到底是肿么了!!!???
高手进,莫名奇妙的问题?!
private void button1_Click(object sender, System.EventArgs e)rn rn rn OleDbCommand olecmd = new OleDbCommand("select * from tab_pers_info where pers_no =@pers_no,oleDbConnection1);rn oleDbConnection1.Close();rn oleDbConnection1.Open();rn rn olecmd.Parameters.Add("@pers_no",OleDbType.VarChar,30);rn olecmd.Parameters["@pers_no"].Value = "343";rn tryrn rn OleDbDataReader dr = olecmd.ExecuteReader();rn //没有纪录rn if (dr.Read() == false) rn rn return ;rn rn catch(OleDbException mye)rn rn MessageBox.Show(mye.ToString());rn rn finallyrn rn rn rn
eclipse出现莫名奇妙的问题
解决方案: eclipse->project->clean
vc2005代码区莫名奇妙的问题
VC2005代码区老是莫名其妙的出现一些文字,rnrn选中这些文字时,文字又会消失了。。rnrn特别是在浏览代码时候,鼠标放到某行代码后,有时就会在左边出现方框或者些莫名其妙的文字。。。rnrnrn大家有没有遇到这样的问题啊,rnrn有的话,给解决下。谢谢先了。。
struts2的一个莫名奇妙的问题
在struts.xml中rn rn list.action?[color=#FF0000]messageType=$messageType[/color]rn editmes.jsprn rnrn带一个参数,TOMCAT启动正常,并且能完成预期功能,但是,一旦再添加一个参数,如下所示rn rn list.action?[color=#FF0000]messageType=$messageType&pages.cpage=$pages.cpage[/color]rn editmes.jsprn rnrn这时,xml文件会提示错误,并且TOMCAT启动也会报错!如下:
跪求呀,莫名奇妙的问题
在SQL查询分析器中rnrnexec ARAP_GetNewDayDetail1128 N'2008-12-29', N'2008-12-29', N'PoPlanPay', N'109', N''rn这个存储过程,显示里面数值字段都是有五位小数(存储过程里本来设置就是5位),但是在前台程序中ADOStoredProc1和adoquery数据集中显示只有4位小数,数据集都没有设置,都是按默认的,为什么会这样呀。以前存储过程是4位的,后来因为上面的需要而改成了5位。rnrn大虾们救救我吧!!!
内存地址莫名奇妙改变的问题
最近在解一个驱动蓝屏的问题,分析DUMP文件后,发现有一个函数调用的参数地址莫名奇妙产生了变化。Windbg看到的dump里栈信息部分如下:rnStrMatch(unsigned short * Pattern = 0x85d7b5bc, unsigned long dwPattern = 0x1e, unsigned short * Name = 0x8aa08000, unsigned long dwName = 0x8014abe6) //这里出错rnStrMatch(unsigned short * Pattern = 0x85d7b5ba, unsigned long dwPattern = 0x1e, unsigned short * Name = 0x8aa08000, unsigned long dwName = 0x8014abe6)rnPatternMatch(unsigned short * Ptr = 0x85d7b5b8, unsigned long dwPtr = 0x20, unsigned short * Proc = 0x855a960a/*AFP_Protected里的Process*/, unsigned long dwProc = 0x855a95dc)rnAFP_Protected(unsigned short * Process = 0x85d14d00/*指向一个字符串*/, unsigned long dwProcess = 0x1e, ....rn其中在AFP_Protected中传入的process是PWCHAR, dwProcess是size,这个函数会调用PatternMatch,把process及dwProcess当成Proc和dwProc传入。但这里发现process的地址变了,用da查看AFP_Protected里process可以查到正确的字符串,但用da查PatternMatch中的Proc却返回空,而且参数size也变化了。在AFP_Protected里根本没对Proc和dwProc有做过操作,怎么会发生这种情况?
被莫名奇妙的问题困扰
set conn = server.createobject("adodb.connection")rnconn.ConnectionString = "driver=sql server;server=127.0.0.1;uid=news;pwd=news;database=news"rnconn.openrnrn总是指出conn.open 一行有错误Microsoft OLE DB Provider for ODBC Drivers (0x80040E4D)rnrn我用WINDOWS 2000 SERVER中文版 + SQL SERVER 2000中文版rn
莫名奇妙的问题,帮帮忙啊!
下面是求s=1!+2!+......+n!的问题,怎么我用win-tc工具运行,输入10,的处的结果为-25319,晕了,rn怎恶魔可能为负数啊rn#include"stdio.h"rnchen(int n)rnint i,s=1;rnfor(i=n;i>=1;i--)rns*=i;rnreturn s;rnrnvoid main()rnint i,n;rnlong sum=0;rnprintf("Please input the number n:");rnscanf("%d",&n);rnfor(i=n;i>=1;i--)rnsum+=chen(i);rnprintf("%ld",sum);rngetch();rn
莫名奇妙字符串问题,求救~!
为一个莫名其妙的问题已经折腾2天了,项目时间紧张,快崩溃了,求救啊~rnrn最开始代码如下:rnfunction utf8Substr($str, $len, $from=0 , $dot='..')rnrn $strNew = preg_replace('#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+)0,'.$from.''.rn '((?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+)0,'.$len.').*#s',rn '$1',$str); rn return ($str!=$strNew)?$strNew.$dot:$str;rnrn可返回被截取的中英文字符串rn参数为原字符串、要截取的长度、起始长度、当字符串截取后后面要增加的字符rn后经过测试,发现不能成功截图带有HTML的字符串rnrn后修改如下:rnfunction utf8Substr($str, $len, $from=0 , $dot='..')rnrn $str = strip_tags($str);rn $strNew = preg_replace('#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+)0,'.$from.''.rn '((?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+)0,'.$len.').*#s',rn '$1',$str); rn return ($str!=$strNew)?$strNew.$dot:$str;rnrn这个函数基本都能正常工作了,但最近发现一个问题,就是用ewebeditor编辑后存入数据库的内容,带有链接的就不能成功截取了,查看了一下,编辑器把链接都写为:这样,怀疑是strip_tags没处理干净,所有就又写了一行$str = str_replace('
[求助]莫名奇妙的锁问题
rn我的应用程序已经在十几家公司都正常运行了,昨天又有一家公司rnrn在用我的应用程序的时候不知道什么原因,一运行就产生了锁,不管rnrn做什么事,只要和数据库交互都会有锁的存在,我想要是程序上要是有rnrn问题那其他的公司都能很好的运行,就是这家公司不管运行什么都产生rnrn一大堆的锁。请问可能是数据库服务器有问题吗!应该怎么样解决!rn
莫名奇妙的错误
今天在eclipse导入项目时,发现了一大堆的错误,觉得有点奇怪,这个项目之前调试得好好的,怎么又爆出一大堆的错误.随便打开一个文件一看,中文全是乱码.这时想到项目是用UTF-8编码的,而Eclipse用GBK解码了,我马上把eclipse的text file encoding改为UTF-8,果然中文能正确显示,先前的错误也不翼而飞了,然来编解码方式的不一致也会导致编译错误,...
莫名奇妙的参数传递?
下面的程序输入1.5,2.5rn跟踪发现传递到参数中的值为x=0,y = 1.9375rn为什么?《谭浩强 C程序设计(第二版)》P148-149rnrn奇怪之一:max应该在编译时确认为库函数或者宏,但链接时显然成了自定义函数; rn奇怪之二:将第一行改为max(float, float);运行结果为2。而不改时为1 rn奇怪之三:为什么会有跟踪的实参是0,1.9375(windows98, tc2.0) rnrn/*float max(float, float);*/rnrnmain()rnrn float a,b;rn int c;rnrn scanf("%f,%f", &a, &b);rn c = max(a, b);rnrn printf("%d\n", c);rnrnrnmax(float x, float y)rnrn float z;rnrn z = x > y ? x : y;rn return(z);rn
操作系统莫名奇妙地删除文件。。。。
怪怪怪!!!rnrn新装的系统 Windows 2000 Profressional,安装了瑞星杀毒软件最新版本,杀不到毒。rnrn安装了利信财务软件。rnrn没有使用U盘等外接设备。rnrn一段时间(小于30分钟)后,利信财务软件被删除,利信安装程序被删除(有时出现),一些其他文件或文件夹被删除(随机出现)。rnrn网上也找不到相关的信息,特郁闷。rnrn各位大大,提供点信息啊。rnrn随便给各位拜个早年,祝大家在新的一年里万事如意。
ie莫名奇妙的退出
ie莫名奇妙的退出,提示explore错误,系统为win2000+sp3 IE5.0,想在线升级,但是提示错误,不能进行,有时上网时,突然机器蓝屏,然后重新启动
session莫名奇妙结束
环境sun one application server 7rnrn我的web app部署在7007端口,访问本应用下的也面都没问题,始终保持一个session,但只要有连接链到同一个服务器下的4477端口下的页面,当前session马上就被结束掉,不知为何?链到其他的服务器也正常,也是始终保持一个session
莫名奇妙的sql异常
[code=C#] private void Bind()rn rn con = db.CreateConnection("Simple_bbs");rn con.Open();rn commandText = "select title_name,u_photo,r_body,r_master,r_createtime from user_information,user_reply,user_title where (r_master=u_name and (user_reply.title_id=user_title.title_id))and (user_reply.title_id=@user_reply.title_id)";rn cmd = new SqlCommand(commandText, con);rn cmd.Parameters.Add("@user_reply.title_id", SqlDbType.Int, 10);rn cmd.Parameters["@user_reply.title_id"].Value = Int16.Parse(Request.QueryString["title_id"]);rn rn ds = new DataSet();rn da = new SqlDataAdapter(cmd);rn da.Fill(ds, user_control.PageSize * (user_control.CurrentPageIndex - 1), user_control.PageSize, "revw_tab");//关键一步,分页之后提取出了当前页,成为table1表rn DataList1.DataSource = ds.Tables["revw_tab"];rn DataList1.DataBind();rn con.Close();rn user_control.CustomInfoText = " 共有留言" + user_control.RecordCount.ToString() + "条";rn user_control.CustomInfoText += " 共有" + user_control.PageCount.ToString() + "页";rn user_control.CustomInfoText += " 当前为第" + user_control.CurrentPageIndex.ToString() + "页";rnrnrn [/code]rnSqlExceptionrn'.' 附近有语法错误。rn必须声明标量变量 "@user_reply"rn
莫名奇妙的错误!!!
void Button1_Click(object sender, EventArgs e)rn rnOleDbConnection MyCn = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source=" +Server.MapPath("database/info.mdb"));rn // string strSQL = "insert into member(memberID,name,sex,password,question,answer,email,phone,address,postcode) Values(@member,@name,@sex,@password,@question,@answer,@email,@phone,@address,@postcode)";rn // OleDbCommand MyCmd = new OleDbCommand(strSQL,MyCn);rn OleDbCommand MyCmd = new OleDbCommand("insert into member(memberID,name,sex,password,question,answer,email,phone,address,postcode) Values(@memberID,@name,@sex,@password,@question,@answer,@email,@phone,@address,@postcode)",MyCn);rn MyCmd.Parameters.Add("@memberID",TextBox1.Text);rn MyCmd.Parameters.Add("@name",TextBox2.Text);rn MyCmd.Parameters.Add("@sex",RadioButtonList1.SelectedItem.Text);rn MyCmd.Parameters.Add("@password",TextBox4.Text);rn MyCmd.Parameters.Add("@question",TextBox6.Text);rn MyCmd.Parameters.Add("@answer",TextBox7.Text);rn MyCmd.Parameters.Add("@email",TextBox8.Text);rn MyCmd.Parameters.Add("@phone",TextBox9.Text);rn MyCmd.Parameters.Add("@address",TextBox10.Text);rn MyCmd.Parameters.Add("@postcode",TextBox11.Text);rn rn MyCn.Open();rn MyCmd.ExecuteNonQuery();rn MyCn.Close();rnrn老是报错说:INSERT INTO 语句的语法错误。晕死了,看不出哪里出错了!大家帮忙看看哪里的问题?rn
一个莫名奇妙的小问题
今天在写拉格朗日插值算法时,始终有点问题,经反复调试。。。先附上代码rn[code=c]#include rn//#includern#include rnusing namespace std;rn/* run this program using the console pauser or add your own getch, system("pause") or input loop */rntypedef structrn int x;rn int y;rnPOINT; rnint Largrange(vector &vp, int x);rnrnint main(int argc, char** argv) rn vector vp;rn POINT p1,p2;rn p1.x = 100;p1.y = 10;rn p2.x = 121,p2.y = 11;rn vp.push_back(p1);rn vp.push_back(p2);rn cout << Largrange(vp,115) << endl; rn return 0;rnrn//拉格朗日插值函数rn//参数:取点,xrn//返回:yrnint Largrange(vector &vp, int x)rnrn float fL, fP = 0;rn for (size_t k = 0; k < vp.size(); k++)rn rn fL = 1;rn for (size_t j = 0; j < vp.size(); j++)rn rn if (j != k)rn fL *=((x - vp[j].x) / (vp[k].x - vp[j].x));//问题点在这rn rn fP += fL*vp[k].y;rn rn return (int)fP;rn[/code]rn调试时fL为0;求解释
遇到莫名奇妙的错误
2005-10-29 09:37:06,453 ERROR [org.apache.catalina.session.ManagerBase] IOException while loading persisted sessions: java.io.EOFExceptionrnjava.io.EOFExceptionrn at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2165)rn at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2631)rn at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:734)rn at java.io.ObjectInputStream.(ObjectInputStream.java:253)rn at org.apache.catalina.util.CustomObjectInputStream.(CustomObjectInputStream.java:56)rn at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:384)rn at org.apache.catalina.session.StandardManager.load(StandardManager.java:343)rn at org.apache.catalina.session.StandardManager.start(StandardManager.java:657)rn at org.apache.catalina.core.ContainerBase.setManager(ContainerBase.java:499)rn at org.apache.catalina.startup.ContextConfig.managerConfig(ContextConfig.java:315)rn at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:635)rn at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:216)rn at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4290)rn at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)rn at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)rn at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:324)rn at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)rn at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:150)rn at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)rn at org.apache.catalina.core.StandardContext.init(StandardContext.java:5441)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:324)rn at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)rn at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:150)rn at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)rn at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeployInternal(TomcatDeployer.java:289)rn at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeploy(TomcatDeployer.java:92)rn at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:374)rn at org.jboss.web.WebModule.startModule(WebModule.java:62)rn at org.jboss.web.WebModule.startService(WebModule.java:40)rn at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:272)rn at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:222)rn at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:324)rn at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)rn at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)rn at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)rn at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)rn at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)rn at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:891)rn at $Proxy0.start(Unknown Source)rn at org.jboss.system.ServiceController.start(ServiceController.java:416)rn at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:324)rn at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)rn at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)rn at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)rn at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)rn at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)rn at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)rn at $Proxy28.start(Unknown Source)rn at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:360)rn at org.jboss.deployment.MainDeployer.start(MainDeployer.java:964)rn at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:775)rn at org.jboss.deployment.MainDeployer.addDeployer(MainDeployer.java:360)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:324)rn at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)rn at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)rn at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:122)rn at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)rn at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:131)rn at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)rn at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)rn at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)rn at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)rn at $Proxy26.addDeployer(Unknown Source)rn at org.jboss.deployment.SubDeployerSupport.startService(SubDeployerSupport.java:112)rn at org.jboss.web.AbstractWebContainer.startService(AbstractWebContainer.java:566)rn at org.jboss.web.tomcat.tc5.Tomcat5.startService(Tomcat5.java:399)rn at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:272)rn at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:222)rn at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:324)rn at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)rn at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)rn at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)rn at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)rn at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)rn at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:891)rn at $Proxy0.start(Unknown Source)rn at org.jboss.system.ServiceController.start(ServiceController.java:416)rn at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:324)rn at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:1
数据库连接莫名奇妙丢失
jsp页面中的一段程序:rnString sql="select TPAYER_ID,Password from ZHFM_TPAYER where TPAYER_ID='"+name1+"'";rnconfirm confirm1=new confirm();rnconfirm1.connect(zsjgDm);rnResultSet rs=confirm1.executeQuery(sql);rnif(rs.next())rn String password="";rn if(rs.getString("Password")!=null)password=rs.getString("Password").trim();rn if(password.equals(pwd1))rn rn session.setAttribute("TPAYER_ID",name1);rn session.setAttribute("password",pwd1);rn session.setAttribute("zsjgDm",zsjgDm);rn rs.close();rn System.out.println("pass");rn confirm1.disconnect();rn}rn数据可以取出来,但执行confirm1.disconnect();这句时,测试信息显示连接为空,莫名奇妙rn下面是confirm 类的定义(部分)rnrnpublic class confirm rn private Connection con = null;rnrn private ResultSet rs = null;rnrn private Statement stmt = null;rnrnpublic void disconnect() rn try rn System.out.println("DBAcess disconnect");rn if (stmt!= null) stmt.close(); stmt.close();rn System.out.println("(conn!= null)="+(con!= null));rn if ((con!= null) && (!con.isClosed()))rn con.close();rnrnrn rnrn// 连接数据库rn public void connect(String zsjg)rn rn String DBCPName = "jdbc/ytds" + zsjg;rn System.out.println("DBCPName="+DBCPName);rnrn tryrn rn Context ctx=null;rn Hashtable ht =new Hashtable();rn ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");rn ht.put(Context.PROVIDER_URL,"t3://127.0.0.1:7001");rn ctx=new InitialContext();rn DataSource db = (DataSource) ctx.lookup(DBCPName); // rn Connection conn = db.getConnection();rn System.out.println("connect to databasepool:OK!");rn stmt=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);rn rn rn /*抛出异常SQLException的处理*/rn catch(SQLException e)rn while(e!=null)rn System.out.println("SQLState:"+e.getSQLState());rn System.out.println("Message:"+e.getMessage());rn System.out.println("Vendor:"+e.getErrorCode());rn e=e.getNextException();rn rn catch(NamingException ne)rn rn ne.printStackTrace();rn rn rn rnrnrn是用的连接池连接的,莫名奇妙的丢失连接后,那些连接好像没有放回到连接池中,所有很快就耗尽了连接池,不得其解,请高手赐教rn
相关热词 c#异步发送kafka c#窗体编号 c# 操作二进制文件 c# 反射 机制 c#线程 窗体失去响应 c#角度转弧度 c# 解析gps数据 c# vs设置 语法版本 c# json含回车 c#多线程demo