使用PHP的odbc来获取varchar(max)列(Using PHP's odbc to grab a varchar(max) column)
我正在为一个类项目组建一个PHP网站,我们正在使用MS SQL Server 2008数据库填充网站上的字段。 但是,其中一个字段是将垃圾输出到页面上而不是实际存储在数据库中的内容。
有问题的字段称为
description
,是一个varchar(MAX)
字段; 存储过程在数据库中查询元组,并将其表中的值转储到页面上的文本框中;description
字段输出到textarea
控件。以下是处理从数据库中提取信息的PHP:
$res = odbc_exec($dbhandle, "exec dbo.usp_ProgramGet " . $_GET["program"]); $id = $_GET["program"]; $name = odbc_result($res, "title"); $desc = odbc_result($res, "description");
$name
变量按预期工作(在数据库中,它的类型为char(15)
)。 但是,如果(例如)description
字段包含“这是一个测试”,则$desc
将导致“ $ime ”,这是转储到textarea
控件中的内容,而不是存储在数据库。我已经搜遍了所有这个问题并没有找到解决方案,虽然这听起来像PHP本身的一个错误,虽然我不确定。
更新
我正在使用SQL Server查询来更新varchar值。 我尝试输入一个非常长的字符串,我得到了这个:
�,ime�������stringDayToInt��É������à‰,���N={���������������������������������������������
“stringDayToInt”是我写的PHP函数的名称,它存在于一个完全不同的文件中,该文件包含在我正在尝试的页面中。 非常离奇。
I'm putting together a PHP website for a class project, and we are using a MS SQL Server 2008 database to populate fields on the site. However, one of the fields is outputting garbage onto the page instead of what is actually stored in the database.
The field in question, called
description
, is avarchar(MAX)
field; a stored procedure queries the database for a tuple and dumps the values from its table into text boxes on the page; thedescription
field is output to atextarea
control.Here is the PHP that handles pulling the information from the database:
$res = odbc_exec($dbhandle, "exec dbo.usp_ProgramGet " . $_GET["program"]); $id = $_GET["program"]; $name = odbc_result($res, "title"); $desc = odbc_result($res, "description");
The
$name
variable works as expected (in the database, it is of typechar(15)
). However, if (for example) thedescription
field contains "This is a test" then$desc
will result in "�$ime�����", which is what gets dumped into thetextarea
control, instead of what's stored in the database.I've searched all over and found no solutions to this problem yet, although it sounds like a bug in PHP itself although I'm not sure.
Update
I am using SQL Server queries to update the varchar values. I tried putting in a really long string and I got this:
�,ime�������stringDayToInt��É������à‰,���N={���������������������������������������������
"stringDayToInt" is the name of a PHP function I wrote that lives in a totally different file that got included into the page I'm trying out. Very bizarre.
原文:https://stackoverflow.com/questions/4958936
最满意答案
在理想条件下:
users = max_delay * rate * nb_phones
5s * 1 / s * 8个电话= 40个并发用户
1分钟的时间段没有说什么,因为重要的是当用户提出请求时,可以在任何给定时间发生。
这是理论上发送的速度,忽略实际网络请求,服务器排队等所花费的时间。在现实世界中,我希望该值小于该值,因此考虑了误差范围。
这并没有说明客户端接收SMS的速度有多快。
如果您在美国/加拿大/英国,您可以查看短代码 。
来自FAQ:Twilio短代码默认每秒可发送30条消息; 此限额可以提高额外费用。 由于短代码可以发送大量消息,因此无线运营商会单独批准每个短代码以用于其预期用途。 此批准过程通常需要12到16周。
In ideal conditions:
users = max_delay * rate * nb_phones
5s * 1/s * 8 phones = 40 concurrent users
The 1 minute period doesn't say anything since what matters is when the user makes the request, at that can happen at any given time.
That's how fast you can theoretically send ignoring the time taken by the actual network requests, server queuing etc. In the real world I expect the value to be less than that, so account for an error margin.
This doesn't say anything about how fast the client will receive the SMS.
If you are in US/Canada/UK you can look into shortcodes.
From the FAQ: Twilio short codes can send 30 messages per second by default; this limit can be raised for an additional fee. Because short codes can send high volumes of messages, wireless carriers individually approve every short code for its intended use. This approval process typically takes 12 to 16 weeks.
相关问答
更多-
Twilio员工在这里。 你说我们目前在中国不支持双向短信你是对的,但你可以使用Twilio购买中文电话号码并用它向中国移动用户发送短信。 由于我们的中文号码目前是单向的,因此您的邮件收件人将无法回复。 因此,如果您需要从用户那里获取一些信息,您可能希望在邮件中包含一个链接。 请注意,我们的中文号码目前是“alpha”功能,因此您需要联系支持人员购买。 Twilio employee here. You're right that we don't support two-way SMS in China ...
-
首先,我生成一个范围在10000到99999之间的随机数。 Random rNo = new Random(); final int code = rNo.nextInt((99999 - 10000) + 1) + 10000; 接下来,我会显示一个弹出窗口,提醒用户将从手机发送一条消息来验证该号码。 这是使用AlertDialog完成的。 final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); buil ...
-
收到来自Twilio的短信(Receive SMS from Twilio)[2022-03-22]
我担心如果不将您的应用程序暴露给网络,您将无法使用该特定API。 您可以尝试做的是轮询/获取: 当您通过REST API发送SMS或MMS消息时,使用TwiML中的动词,或者有人向您的某个Twilio号码发送消息,Twilio会创建一个Message实例资源 。 消息列表资源表示帐户发送和接收的消息集。 通过查询消息列表资源,可以实现从历史记录中检索已发送和已接收的消息。 这里有一个简短的例子。 I'm afraid that without exposing your applicati ... -
如果延迟可以接受,有多少用户可以在1分钟内收到短信(How many users can receive SMS in 1 minute if delay is acceptable)[2023-09-09]
在理想条件下: users = max_delay * rate * nb_phones 5s * 1 / s * 8个电话= 40个并发用户 1分钟的时间段没有说什么,因为重要的是当用户提出请求时,可以在任何给定时间发生。 这是理论上发送的速度,忽略实际网络请求,服务器排队等所花费的时间。在现实世界中,我希望该值小于该值,因此考虑了误差范围。 这并没有说明客户端接收SMS的速度有多快。 如果您在美国/加拿大/英国,您可以查看短代码 。 来自FAQ:Twilio短代码默认每秒可发送30条消息; 此限额可以提 ... -
使用cronjobs是最好的方法。 如果你不能在你的共享主机上使用cronjob(询问客户支持),你可以在连接到互联网的机器(即你的家用电脑)上运行一个cronjob,它运行一个wget到服务器上的php页面,进行身份验证然后运行php代码发送你的邮件。 对于PHP代码部分,我将使用一个包含所有要发送的电子邮件的数据库表,一个creation_date字段和一个状态字段。 作业调用的PHP代码只会执行(使用伪代码): $batchRecords = takeAbunchOfRecordsWhereStatu ...
-
为大量用户发送短信(Sending SMS for a bulk of users)[2023-05-04]
我建立了一个SMS门户。 你所描述的在我的应用程序的v1.0中也经历过。 解决方案是让我的短信网关通过HTTP为我提供批量短信访问。 我可以将多达1000个目的地放入XML(或逗号分隔)包中并发送到批量短信网关。 因为我在共享主机上运行,所以我将其限制在500个目的地。 我有一个缓存/临时存储/表,我在某些情况下批量处理大型目标(高达1,000,000),并且一个调度程序(基于计时器)每隔几秒发送一批500(通过重复调用脚本),直到发送消息。 像魅力一样工作! 对于个性化消息,我鼓励客户在转发到我的SMS门 ... -
只有当您向我们提供代码,您所做的事情时,才能回答这个问题。 我可以给你一个提示。 尝试发送包含上一个时间戳的邮件,以便运营商服务器首先处理它们。 This question can only be answered if you provide us the code, what you have done. I can give you a tip. Try to send the message with the previous timestamp so that your carrier serve ...
-
每部手机都有不同的功能,因此您应该通过发送来检查每个参数的哪些值对您的手机有效 AT + CNMI =? 例如,我的手机不支持您的示例,因为不支持模式1。 有关+ CNMI的完整语法,您可以参考制造商的AT手册或ETSI标准,或阅读本简要教程http://www.cellular.co.za/at_etsi.htm 无论如何,AT + CNMI仅用于在SMS到达时获得通知,以便读取存储的SMS的内容,您必须使用AT + CMGL =或AT + CMGR =。 简而言之:AT + CMGF = 1;设置文本模 ...
-
如何使用短信网关接收特定号码的短信[关闭](how to receive the sms for a particular number using sms gateway [closed])[2022-12-14]
免责声明,我在Nexmo兼职做开发人员布道工作。 您最好的解决方案可能是使用SMS API。 以下是一些提供商: Nexmo Twilio 对流层 如果您计划获得国际支持,值得注意的是,据我所知,Nexmo支持大多数传入的虚拟号码(您可以购买允许您接收消息的号码的国家/地区)。 此外,由于您将收到消息,Nexmo的定价模式将更适合您。 Twilio / Tropo都收取虚拟号码和每条消息收取短信收费,Nexmo只收取虚拟号码。 所有这三个API都是直接的REST / HTTP API - 因此您只需要一个服 ... -
Twilio开发者传道者在这里。 没有办法延迟SMS statusCallBack。 如果您在发送状态时无法处理statusCallBack,则可以轮询API以检查SMS消息的当前状态。 我可以问你为什么不随时接受回拨服务? Twilio developer evangelist here. There is no way to delay the SMS statusCallBack. If you are unable to deal with a statusCallBack when it is s ...