|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
|
|
#1
|
|||||
|
|||||
|
Matt Wade tutorial help - results over 2 columns
I have been trying out Matt Wade's script from this site that spreads the results from a query over two columns.
The following code works except that I get too many result rows. What should happen is the following: result1 result4 result2 result5 result3 result6 What I get is: result1 result4 result2 result5 result3 result6 result4 result5 result6 Note that there are 6 rows in the database. I guess this script is returning 6 rows but I am not sure where it is going wrong....tired brain! php Code:
|
|
#2
|
|||
|
|||
|
RE: Matt Wade tutorial help - results over 2 columns
This
for($i = 0; $i < $num_rows; $i++) { should probably be for($i = 0; $i < $rows; $i++) { |
|
#3
|
|||
|
|||
|
RE: Matt Wade tutorial help - results over 2 columns
Thank you! That fixed it nicely http://codewalkers.com/forum/art/msgicons/icon6.gif
|
|
#4
|
|||
|
|||
|
RE: Matt Wade tutorial help - results over 2 columns
One more question: The above script displays the results in vertical order like so:
1 4 2 5 3 6 Anyone have an idea how I can adjust this to a horizontal order? 1 2 2 4 5 6 I can't figure this one out....help appreciated! |
|
#5
|
|||
|
|||
|
results in 2 colmns rather than in rows
hi
at the moment with the following code i get 1 result per row cat 1 cat2 cat3 etc i want the results like catogary 1 catogray 2 catogay 3 catogary 4 etc this is my code please help function list_pages() { global $prefix, $db, $sitename, $admin, $multilingual, $module_name, $admin_file; include("header.php"); title("$sitename: "._PAGESLIST.""); OpenTable(); echo "<center><font class=\"content\">"._LISTOFCONTENT." $sitename:</center><br><br>"; $result = $db->sql_query("SELECT * FROM ".$prefix."_pages_categories ORDER BY title"); $numrows = $db->sql_numrows($result); $numrows2 = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_pages WHERE cid!='0' AND active='1'")); if ($numrows > 0 AND $numrows2 > 0) { echo "<center>"._CONTENTCATEGORIES."</center><br><br>" ."<table border=\"3\" align=\"center\" width=\"95%\">"; while ($row = $db->sql_fetchrow($result)) { $cid = intval($row['cid']); $title = filter($row['title'], "nohtml"); $description = filter($row['description']); $numrows3 = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_pages WHERE cid='$cid'")); if ($numrows3 > 0) { echo "<tr><td valign=\"top\"> <a href=\"modules.php?name=$module_name&pa=list_pages_categories&cid=$cid\">$title</a> </td>"; } } echo "</td></tr></table><br><br>" ."<center>"._NONCLASSCONT."</center><br><br>"; } $result4 = $db->sql_query("SELECT pid, title, subtitle, clanguage FROM ".$prefix."_pages WHERE active='1' AND cid='0' ORDER BY date"); echo "<blockquote>"; while ($row4 = $db->sql_fetchrow($result4)) { $pid = intval($row4['pid']); $title = filter($row4['title'], "nohtml"); $subtitle = filter($row4['subtitle'], "nohtml"); $clanguage = $row4['clanguage']; if ($multilingual == 1) { $the_lang = "<img src=\"images/language/flag-".$clanguage.".png\" hspace=\"3\" border=\"0\" height=\"10\" width=\"20\">"; } else { $the_lang = ""; } if (!empty($subtitle)) { $subtitle = " ($subtitle)"; } else { $subtitle = ""; } if (is_admin($admin)) { echo "<strong><big>·</big></strong> $the_lang <a href=\"modules.php?name=$module_name&pa=showpage&pid=$pid\">$title</a> $subtitle [ <a href=\"".$admin_file.".php?op=content_edit&pid=$pid\">"._EDIT."</a> | <a href=\"".$admin_file.".php?op=content_change_status&pid=$pid&active=1\">"._DEACTIVATE."</a> | <a href=\"".$admin_file.".php?op=content_delete&pid=$pid\">"._DELETE."</a> ]<br>"; } else { echo "<strong><big>·</big></strong> $the_lang <a href=\"modules.php?name=$module_name&pa=showpage&pid=$pid\">$title</a> $subtitle<br>"; } } echo "</blockquote>"; if (is_admin($admin)) { $result5 = $db->sql_query("SELECT pid, cid, title, subtitle, clanguage FROM ".$prefix."_pages WHERE active='0' ORDER BY date"); echo "<br><br><center><b>"._YOURADMINLIST."</b></center><br><br>"; echo "<blockquote>"; while ($row5 = $db->sql_fetchrow($result5)) { $pid = intval($row5['pid']); $cid = intval($row5['cid']); $title = filter($row5['title'], "nohtml"); $subtitle = filter($row5['subtitle'], "nohtml"); $clanguage = $row5['clanguage']; if ($multilingual == 1) { $the_lang = "<img src=\"images/language/flag-".$clanguage.".png\" hspace=\"3\" border=\"0\" height=\"10\" width=\"20\">"; } else { $the_lang = ""; } if (!empty($subtitle)) { $subtitle = " ($subtitle) "; } else { $subtitle = " "; } echo "<strong><big>·</big></strong> $the_lang <a href=\"modules.php?name=$module_name&pa=showpage&pid=$pid\">$title</a> $subtitle [ <a href=\"".$admin_file.".php?op=content_edit&pid=$pid\">"._EDIT."</a> | <a href=\"".$admin_file.".php?op=content_change_status&pid=$pid&active=0\">"._ACTIVATE."</a> | <a href=\"".$admin_file.".php?op=content_delete&pid=$pid\">"._DELETE."</a> ]<br>"; } echo "</blockquote>"; } CloseTable(); include("footer.php"); } |
![]() |
| Viewing: Codewalkers Forums > Other > Tutorials > Matt Wade tutorial help - results over 2 columns |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|