There is a problem in this code I can not detected
<?php echo "<a href ='$rows['Link']'> .$rows['UploadName']</a> "; ?>
Do you find you have a s开发者_如何学JAVAolution???
Thank you very much.
My guess is that your problem is that it isn't writing out the data in $rows['Link']
... if that is the case, then your solution is to change it to {$rows['Link']}
... actually, you'll probably want to change both, since it looks like you started doing string concatenation and then switched halfway through.
So:
<?php echo "<a href ='$rows['Link']'> .$rows['UploadName']</a> "; ?>
becomes:
<?php echo "<a href ='{$rows['Link']}'>{$rows['UploadName']}</a> "; ?>
See: The PHP Manual on Variable Parsing in strings
It should be:
<?php echo "<a href ='{$rows['Link']}'>{$rows['UploadName']}</a>"; ?>
Or:
<?php echo "<a href ='{$rows['Link']}'>" . $rows['UploadName'] . "</a>"; ?>
There's a problem in parsing variables in the string. Use curl braces:
<?php echo "<a href ='{$rows['Link']}'> .{$rows['UploadName']}</a> "; ?>
Take a look to this php.net page, under "variable parsing".
More alternatives:
<?php echo '<a href ="' . $rows['Link'] . '">' . $rows['UploadName'] . '</a>'; ?>
or
<?=('<a href ="' . $rows['Link'] . '">' . $rows['UploadName'] . '</a>')?>
Another alternative (that I tend to prefer, given I know that both 'Link'
and 'UploadName'
are valid indices of $row
.
<a href="<?=$rows['Link']?>"><?=$rows['UploadName']?></a>
I'm not sure what that does for readability for most people, but on color-coded IDEs, it tends to help, because the HTML isn't just seen as one giant ugly single-colored string.
精彩评论