首页 \ 问答 \ 使用PHP的odbc来获取varchar(max)列(Using PHP's odbc to grab a varchar(max) column)

使用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 a varchar(MAX) field; a stored procedure queries the database for a tuple and dumps the values from its table into text boxes on the page; the description field is output to a textarea 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 type char(15)). However, if (for example) the description field contains "This is a test" then $desc will result in "�$ime�����", which is what gets dumped into the textarea 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
更新时间:2022-01-02 06:01

最满意答案

在理想条件下:

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 ...
  • 我担心如果不将您的应用程序暴露给网络,您将无法使用该特定API。 您可以尝试做的是轮询/获取: 当您通过REST API发送SMS或MMS消息时,使用TwiML中的动词,或者有人向您的某个Twilio号码发送消息,Twilio会创建一个Message实例资源 。 消息列表资源表示帐户发送和接收的消息集。 通过查询消息列表资源,可以实现从历史记录中检索已发送和已接收的消息。 这里有一个简短的例子。 I'm afraid that without exposing your applicati ...
  • 在理想条件下: 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 ...
  • 我建立了一个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;设置文本模 ...
  • 免责声明,我在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 ...

相关文章

更多

最新问答

更多
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)
  • 是否可以嵌套hazelcast IMaps?(Is it possible to nest hazelcast IMaps? And whick side effects can I expect? Is it a good Idea anyway?)
  • UIViewAnimationOptionRepeat在两个动画之间暂停(UIViewAnimationOptionRepeat pausing in between two animations)
  • 在x-kendo-template中使用Razor查询(Using Razor query within x-kendo-template)
  • 在BeautifulSoup中替换文本而不转义(Replace text without escaping in BeautifulSoup)
  • 如何在存根或模拟不存在的方法时配置Rspec以引发错误?(How can I configure Rspec to raise error when stubbing or mocking non-existing methods?)
  • asp用javascript(asp with javascript)
  • “%()s”在sql查询中的含义是什么?(What does “%()s” means in sql query?)
  • 如何为其编辑的内容提供自定义UITableViewCell上下文?(How to give a custom UITableViewCell context of what it is editing?)
  • c ++十进制到二进制,然后使用操作,然后回到十进制(c++ Decimal to binary, then use operation, then back to decimal)
  • 以编程方式创建视频?(Create videos programmatically?)
  • 无法在BeautifulSoup中正确解析数据(Unable to parse data correctly in BeautifulSoup)
  • webform和mvc的区别 知乎
  • 如何使用wadl2java生成REST服务模板,其中POST / PUT方法具有参数?(How do you generate REST service template with wadl2java where POST/PUT methods have parameters?)
  • 我无法理解我的travis构建有什么问题(I am having trouble understanding what is wrong with my travis build)
  • iOS9 Scope Bar出现在Search Bar后面或旁边(iOS9 Scope Bar appears either behind or beside Search Bar)
  • 为什么开机慢上面还显示;Inetrnet,Explorer
  • 有关调用远程WCF服务的超时问题(Timeout Question about Invoking a Remote WCF Service)