Hi,
I want to make a block on the left of my site, with the following code:
Only I don not get the right information into this block, I have selected, php block..... The code will show the lsat 10 links out of a database, and people can add a new link...
Can somebody help me with this?
<?
$host = "XXX";
$user = "XXX";
$pass = "XXX";
$database = "XXX";
$conn = @mysql_connect($host, $user, $pass);
if (!$conn) {
echo "Timeout detected.....<BR><BR>Please try again by pressing F5";
exit;
}
@mysql_select_db($database, $conn);
$sql = "SELECT "
. " lnk_name "
. ", lnk_url "
. "FROM "
. " link "
. "ORDER BY "
. " lnk_id DESC "
. "LIMIT 0,10";
$result = mysql_query($sql, $conn);
?>
<SCRIPT LANGUAGE="JavaScript">
function PopUp(URL) {
PopUp = window.open(URL, 'PopUp', 'width=350, height=320, resizable=no, menubar=no, scrollbars=no, status=no, toolbar=no');
}
</SCRIPT>
<html>
<div class="windowbg" >
<?
while($row = mysql_fetch_array($result)) {
?>
<span class="smalltext"><a href="<?=$row['lnk_url']?>" target="_blank"><?=$row['lnk_name']?></a></span><BR>
<?
}
?>
<BR>
<span class="smalltext"><a href="#" onClick="window.open('/linksys/link_new.php', 'PopUp', 'width=350, height=320, resizable=no, menubar=no, scrollbars=no, status=no, toolbar=no')"><font color="red">Link toevoegen</font></a></span>
</div>
</html>
Try it in a Script Block... It seems to work for me, I just get one red link:
Link toevoegen
yeah, that's not correct, you also must see 10 links within that block and at the bottom, Link toevoegen
If you are using it in a php block try removing the <? at the top.
only <?
if have tried doesn't work... :(
Well just give it some time and one of the coders will see and probably have a fix for it. :)
click the link:
http://www.domeen.nl/linksys/links.php
that's the result I want to have in a block
Put all of this in a HTML Block:
<div class="tborder"><span class="smalltext"><a href="http://www.rijnhafen.nl" target="_blank">Rijnhafen.nl</a></span><BR><span class="smalltext"><a href="http://www.leukisanders.com" target="_blank">Leukisanders</a></span><BR><span class="smalltext"><a href="http://www.terra-mode.nl" target="_blank">Terra mode</a></span><BR><span class="smalltext"><a href="http://www.livesex.nl" target="_blank">Live Sex .nl</a></span><BR><span class="smalltext"><a href="http://www.cammiegirls.nl" target="_blank">CammieGirls</a></span><BR><span class="smalltext"><a href="http://www.imagebarn.net" target="_blank">ImageBarn.net</a></span><BR><span class="smalltext"><a href="http://www.tastelikepizza.com" target="_blank">Tastelikepizza</a></span><BR><span class="smalltext"><a href="http://www.vraagnaardevoorwaarden.nl/" target="_blank">vndv.nl</a></span><BR><span class="smalltext"><a href="http://www.domeen.nl/index.php?topic=3985.msg63777;topicseen#msg63777" target="_blank">Tara en Borgje Topic</a></span><BR><span class="smalltext"><a href="http://www.badmofo.nl" target="_blank">Badmofo</a></span><BR><BR>
<span class="smalltext"><a href="#" onClick="window.open('/linksys/link_new.php', 'PopUp', 'width=350, height=320, resizable=no, menubar=no, scrollbars=no, status=no, toolbar=no')"><font color="red">Link toevoegen</font></a></span></div></html></div></html>
I believe that getting the links (the most recent 10) from a database was a consideration.
How about (in script block):
<SCRIPT LANGUAGE="JavaScript">
function PopUp(URL) {
PopUp = window.open(URL, 'PopUp', 'width=350, height=320, resizable=no, menubar=no, scrollbars=no, status=no, toolbar=no');
}
</SCRIPT>
<div class="windowbg" >
<?php
$host = "XXX";
$user = "XXX";
$pass = "XXX";
$database = "XXX";
$conn = @mysql_connect($host, $user, $pass);
if (!$conn) {
echo "Timeout detected.....<BR><BR>Please try again by pressing F5";
exit;
}
@mysql_select_db($database, $conn);
$sql = "SELECT "
. " lnk_name "
. ", lnk_url "
. "FROM "
. " link "
. "ORDER BY "
. " lnk_id DESC "
. "LIMIT 0,10";
$result = mysql_query($sql, $conn);
while($row = mysql_fetch_array($result)) {
echo '<span class="smalltext"><a href="', $row['lnk_url'], '"target="_blank">', $row['lnk_name'], '</a></span><BR>';
}
?>
<BR>
<span class="smalltext"><a href="#" onClick="window.open('/linksys/link_new.php', 'PopUp', 'width=350, height=320, resizable=no, menubar=no, scrollbars=no, status=no, toolbar=no')"><font color="red">Link toevoegen</font></a></span>
</div>
nop :( I don't get the results out of the database....
Does anything show in your forum Error Log?
Am I right in saying the it DOES NOT display the 'Timeout detected...' message?
Does the bottom link 'Link toevoegen' show up?
It show nothing except "link toevoegen"
the forum error log is still empy, no errors
if I delete all the scipt codes, and put it in a php box, then the results are shown in the block, so it's in the script code I think...