Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/56.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
创建一个HTML/PHP链接_Php_Mysql_Html_Hyperlink - Fatal编程技术网

创建一个HTML/PHP链接

创建一个HTML/PHP链接,php,mysql,html,hyperlink,Php,Mysql,Html,Hyperlink,我的代码如下: $result = mysql_query("SELECT link, notes FROM links WHERE username='will';"); $html .= "<ul>"; while ($row = mysql_fetch_array($result)) { //loop extract($row); $html .= "<li>{$link} - {$notes}</li>"; } $result=mysql

我的代码如下:

$result = mysql_query("SELECT link, notes FROM links WHERE username='will';");
$html .= "<ul>";
while ($row = mysql_fetch_array($result)) { //loop
  extract($row);
  $html .= "<li>{$link} - {$notes}</li>";
  }
$result=mysql\u查询(“选择链接,从username='will';”链接中的注释”);
$html.=“
    ”; 而($row=mysql\u fetch\u array($result)){//loop 摘录(行); $html.=“
  • {$link}-{$notes}
  • ”; }
我需要的位,它说,
{$link}
成为一个可点击的链接,打开一个新窗口。我该怎么做

当我在其周围放置标签时,您会看到以下错误:

错误是:Parse error:syntax error,第18行的/data/www/vhosts/themacsplash.com/httpdocs/ClipBoy/will.php中出现意外的“{”


第18行是
$html.=“
  • {$link}-{$notes}
  • ”;

    通常,您会创建这样的链接:
    。因此在您的情况下:

    $html .= "<li><a href=\"{$link}\" target=\"_blank\">{$link}</a> - {$notes}</li>";
    
    $html.=“
  • -{$notes}
  • ”;
    通常,您会创建这样的链接:
    。因此,在您的情况下:

    $html .= "<li><a href=\"{$link}\" target=\"_blank\">{$link}</a> - {$notes}</li>";
    
    $html.=“
  • -{$notes}
  • ”;
    如果您的$link包含格式为“”的url,请使用以下方法:

    $html .= "<li><a href=\"{$link}\">{$notes}</a></li>";
    
    $html.=“
  • ”;
    如果您的$link包含格式为“”的url,请使用以下方法:

    $html .= "<li><a href=\"{$link}\">{$notes}</a></li>";
    
    $html.=“
  • ”;
    首先创建正确的代码并处理错误,然后在引号外设置变量

    $qry = "SELECT link, notes FROM links WHERE username='will'";
    $mysqlqry = mysql_query($qry);
    if($mysqlqry){
        if(mysql_num_rows($mysqlqry) > 0){
    
            $html .= "<ul>";
            while($row = mysql_fetch_array($result)) { //loop
              extract($row);
              $html .= "<li><a href=". htmlentities($link) .">". $notes ."</a></li>";
            }
        }
    }
    
    $qry=“从username='will'链接中选择链接、注释”;
    $mysqlqry=mysql\u查询($qry);
    如果($mysqlqry){
    如果(mysql_num_rows($mysqlqry)>0){
    $html.=“
      ”; 而($row=mysql\u fetch\u array($result)){//loop 摘录(行); $html.=“
    • ”; } } }
    首先创建正确的代码并处理错误,然后在引号外设置变量

    $qry = "SELECT link, notes FROM links WHERE username='will'";
    $mysqlqry = mysql_query($qry);
    if($mysqlqry){
        if(mysql_num_rows($mysqlqry) > 0){
    
            $html .= "<ul>";
            while($row = mysql_fetch_array($result)) { //loop
              extract($row);
              $html .= "<li><a href=". htmlentities($link) .">". $notes ."</a></li>";
            }
        }
    }
    
    $qry=“从username='will'链接中选择链接、注释”;
    $mysqlqry=mysql\u查询($qry);
    如果($mysqlqry){
    如果(mysql_num_rows($mysqlqry)>0){
    $html.=“
      ”; 而($row=mysql\u fetch\u array($result)){//loop 摘录(行); $html.=“
    • ”; } } }
    是你写的,还是你第一次看到它?你对HTML有基本的理解吗?为什么你不能在这个页面的现有HTML中添加适当的标记?是你写的,还是你第一次看到它?你对HTML有基本的理解吗?为什么你不能在现有HTML中添加适当的标记我在第18行的/data/www/vhosts/themacsplash.com/httpdocs/ClipBoy/will.php中得到了这个错误:解析错误:语法错误,意外的“{”哦,对不起,我没有跳过引号。更新了代码。(不敢相信我没有注意到…)我得到了这个错误:解析错误:语法错误,意外的{'in/data/www/vhosts/themacsplash.com/httpdocs/ClipBoy/will.php第18行哦,对不起,我没有跳过引号。更新了代码。(不敢相信我没有注意到…)不起作用错误解析错误:语法错误,意外'{'在第18行的/data/www/vhosts/themacsplash.com/httpdocs/ClipBoy/will.php中,我刚刚通过转义内部引号修复了我的代码。很抱歉,语法错误不起作用错误解析错误:语法错误,意外'{在第18行的/data/www/vhosts/themacsplash.com/httpdocs/ClipBoy/will.php中,我刚刚通过转义内部引号修复了我的代码。很抱歉出现了语法错误