1
talunceford
Help with some code here.....

I am having a tad bit of trouble with some code that I am working on. The problem is, is that when I array the data, it doesn't show all of the queried results. For example. If I have 3 links stored, it will only show two, but if I have 4 it will only show 3.

I need someone to look over the code and see what I could be doing wrong.

<?php
function myxlinks(){
global 
$xoopsUser, $HTTP_COOKIE_VARS, $xoopsConfig,$xoopsTheme;
global 
$xoopsDB;
include_once(
XOOPS_ROOT_PATH."/class/module.errorhandler.php");
include_once(
XOOPS_ROOT_PATH."/include/xoopscodes.php");
$uid = $xoopsUser->getVar("uid");
$q = "SELECT lid, url, title, type FROM ".$xoopsDB->prefix("myxlinks_favorites")." WHERE uid = '$uid'";
$result = $xoopsDB->query($q) or die("");
$row_xoops_myxlinks_favs = mysql_fetch_assoc($result);
$totalRows_xoops_myxlinks_favs = mysql_num_rows($result);
if (
$totalRows_xoops_myxlinks_favs > 0) {
                
$block = array();
                
$block['title'] = "Personal Links";        
                
$block['content'].=  "<table width=100%>";
                
$block['content'].=  "<tr>";
                
$block['content'].=  "<td id=mainmenu>";
                while (
$myrow = $xoopsDB->fetchArray($result)){
                
$type = $myrow['type'];
                
$url = $myrow['url'];
                
$title = $myrow['title'];
                
$block['content'].=  "<a href=$type$url target=_blank>$title</a>";
                }
                
$block['content'].=  "</td></tr></table>";
                
$block['content'].=  "<hr><a href='".XOOPS_URL."/modules/myxlinks/showlinks.php'>Edit Links</a>";
                }else{
                
$block['content'].=  "You do not have any<br>";
                
$block['content'].=  "links setup, would you<br>";
                
$block['content'].=  "like to set up some<br>";
                
$block['content'].=  "personal Links? <b>>><a href='".XOOPS_URL."/modules/myxlinks/showlinks.php'>Yes</a><<</b>";
                
                }
                return 
$block;
}
?>

It is throwing a curve ball at me.....

Thanks for the help,

2
talunceford
Re: Help with some code here.....

Never Mind.... I got it figured out....