简体   繁体   English

在php页面中将链接显示为启用了mysql的超链接输出,但出现错误

[英]Display link as hyperlink enabled output from mysql in php page but I am getting error

If I execute this I am getting output properly: 如果执行此命令,则输出正确:

echo "<a href="'.$elink.'">'.$elink.'</a>";

but when I want to display my output in a table column format I am not able to insert: 但是当我想以表格列格式显示输出时,我无法插入:

echo "<td width='200'>" <a href="'.$elink.'">'.$elink.'</a>   "</td>";
or
echo "<td width='200'>" "<a href="'.$elink.'">'.$elink.'</a>"   "</td>";
or
echo "<td width='200'>" '<a href="'.$elink.'">'.$elink.'</a>   "</td>";

请更正语法错误。

echo '<td width="200">' .  '<a href="'.$elink.'">'.$elink.'</a></td>';

Looks like you have mismatched quotes. 看起来您的报价不匹配。 But I would use sprintf. 但是我会用sprintf。

echo sprintf("<td width='200'><a href='%1$s'>%1$s</a></td>", $elink);

First off you quotes are messed up. 首先,您的报价被弄乱了。 They should look like this: 它们应如下所示:

echo "<td width='200'> <a href='".$elink."'>".$elink."</a></td>";

Correct your string format 更正您的字符串格式

echo '<td width="200"><a href="'. $elink. '">' . $elink . '</a></td>';

I suggest you to use the attribute style ( style="width:200px;" ) instead the width attribute. 我建议您使用属性样式( style="width:200px;" )代替width属性。 Remember to Url Encode the parameters contained in the href attribute. 记住要对href属性中包含的参数进行Url编码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在另一个php页面(包括包含GET请求的php页面)上显示超链接的GET输出 - How can i display GET output of a hyperlink on another php page (that includes the php page that contains GET request) 即使启用了php_openssl.ext,为什么在PHP中仍会收到SSL错误? - Why am I getting an SSL error in PHP even though I enabled the php_openssl.ext? php a href 显示来自 mysql 数据库的数据并将其链接到新页面 - php a href display data from mysql database and link it to a new page 当我单击超链接时,我正在Laravel中找不到页面 - When I click on hyperlink I am getting page not found in Laravel 我正在从php循环中获取双输出 - I am getting double output from a php loop 为什么我不能从该php文件中获取XML输出? - Why am I not getting XML output from this php file? 我是PHP + MySql的新手,并尝试编写一个简单的脚本从数据库中删除用户,但是我没有摆脱错误 - I am new to PHP+MySql,and trying to write a simple script that will delete a user from the database,,but i am not getting rid of a error 我在cart.php页面中遇到错误 - I am getting error in my cart.php page 将带有表单的PHP变量发送到同一页面,但出现错误 - Sending a variable in PHP with a form to the same page, but I am getting error 通过PHP从MySQL获取数据-我做对了吗? - Getting data from MySQL through PHP - am I doing it right?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM