SixTimesEight

msg:3421234 | 11:21 pm on Aug 13, 2007 (gmt 0) |
I don't know anything about Dreamweaver, but you definitely need to declare $directory as blank before you start appending to it with the .= operator. Add the blank declaration before your while loop like so: $i=0; $directory = ''; while ($i < $num) {
|
Habtom

msg:3421427 | 4:55 am on Aug 14, 2007 (gmt 0) |
First try comment out the mysql_close(), you still haven't finished using the connection. //mysql_close(); If that doesn't solve it, please post the error it displays (if any).
|
amwd07

msg:3421573 | 9:59 am on Aug 14, 2007 (gmt 0) |
Sorry I think your not understanding what I'm trying to do here, here is what is already happening I just need them in to columns the directory should not be blank as it contains the layout and varibles for the directory all I need is an extra column I have seen several tutorials to do this but none of which works inside this varible $directory .="layout & vars go here"; it seems to work the one colunn but I need to columns anyone any idea's please I should of had a demo done for today. 12 34 56 78
|
amwd07

msg:3421574 | 10:03 am on Aug 14, 2007 (gmt 0) |
here is th elink to the directory just need a quick sollution here for 2 columns inside the varible or inside file_get_contents includes <snip> [edited by: dreamcatcher at 10:49 am (utc) on Aug. 14, 2007] [edit reason] no urls as per T.O.S [webmasterworld.com].Thanks [/edit]
|
Habtom

msg:3421585 | 10:34 am on Aug 14, 2007 (gmt 0) |
I am completely lost on what you want to achieve, or what the specific problem is. Can you describe it a bit better, what you want to achieve, how you have tried it already and what your problem is. And the TOS states no URLs are allowed on the threads.
|
amwd07

msg:3421592 | 10:42 am on Aug 14, 2007 (gmt 0) |
sorry I thought that ment the code for urls all I am trying to do is have 2 column layout 1 column works with this loop code I just need the code for 2 columns $i=0; while ($i < $num) { $directory .=" // layout & code here "; $i++; }
|
Habtom

msg:3421599 | 10:52 am on Aug 14, 2007 (gmt 0) |
$i=0; $switch = 0; $directory .= "<table> while ($i < $num) { if ($switch == 0) { $directory .= "<tr><td>$data</td>"; } else { $directory .= "<td>$data</td></tr>"; } $switch == 0?$switch = 1:$switch = 0; $i++; } $directory .= "</table> Though I know this approach is ok, I want to know how this can be done differently.
|
amwd07

msg:3421621 | 11:06 am on Aug 14, 2007 (gmt 0) |
I have tried using your code inserting my layout but there seems to be a problem somewhere as I get a blank screen $user_id=mysql_result($makers,$i,"user_id"); $company=mysql_result($makers,$i,"company"); $town=mysql_result($makers,$i,"town"); $telephone=mysql_result($makers,$i,"telephone"); $profile_image=mysql_result($makers,$i,"profile_image"); $i=0; $switch = 0; $directory .= "<table>" while ($i < $num) { if ($switch == 0) { $directory .= "<table border=0 cellspacing=0 cellpadding=0> <tr> <td> </td> </tr> <tr> <td width=260 height=178 valign=top background=images/layout_r2_c1.gif><table width=100% border=0 cellspacing=0 cellpadding=0> <tr> <td height=35><div align=center>$company</div></td> </tr> <tr> <td height=21><div align=center>$town ¦ $telephone</div></td> </tr> <tr> <td height=100><div align=center>$profile_image</div></td> </tr> </table></td> </tr> </table>"; } else { $directory .= "<table border=0 cellspacing=0 cellpadding=0> <tr> <td> </td> </tr> <tr> <td width=260 height=178 valign=top background=images/layout_r2_c1.gif><table width=100% border=0 cellspacing=0 cellpadding=0> <tr> <td height=35><div align=center>$company</div></td> </tr> <tr> <td height=21><div align=center>$town ¦ $telephone</div></td> </tr> <tr> <td height=100><div align=center>$profile_image</div></td> </tr> </table></td> </tr> </table>"; } $switch == 0?$switch = 1:$switch = 0; $i++; } $directory .= "</table>" include('include/template_includes.php');?>
|
amwd07

msg:3421623 | 11:08 am on Aug 14, 2007 (gmt 0) |
ahhhh I missed out the ; on the end of tables works but only shows up 1 column?
|
Habtom

msg:3421625 | 11:13 am on Aug 14, 2007 (gmt 0) |
I know I have altered your code to the output may be you didn't want to have, but take a backup of what your code, test the following, and improve it to achieve what is required. $i=0; $switch = 0; $directory = "<table border=0 cellspacing=0 cellpadding=0> <tr> <td> </td> </tr> <tr> <td width=260 height=178 valign=top background=images/layout_r2_c1.gif> <table width=100% border=0 cellspacing=0 cellpadding=0> " while ($i < $num) { if ($switch == 0) { $directory .= " <tr><td height=35><div align=center>$company</div><div align=center>$town ¦ $telephone</div><div align=center>$profile_image</div></td>"; } else { $directory .= " <td height=35> <div align=center>$company</div><div align=center>$town ¦ $telephone</div><div align=center>$profile_image</div></td> </tr>"; } $switch == 0?$switch = 1:$switch = 0; $i++; } $directory .= "</table> </td> </tr> </table>" ; echo $directory; [edited by: Habtom at 11:15 am (utc) on Aug. 14, 2007]
|
amwd07

msg:3421642 | 11:29 am on Aug 14, 2007 (gmt 0) |
hard to expalin without showing you on this one but now I have 2 columns which is only using the first entry out of the DB and repeating on every entry also the background for the layout image is straight across the 2 columns I need the layout image for each entry in 2 columns for example if there our 12 entires that would be 6 in each column each entry must have the same layout $i=0; $switch = 0; $user_id=mysql_result($makers,$i,"user_id"); $company=mysql_result($makers,$i,"company"); $town=mysql_result($makers,$i,"town"); $telephone=mysql_result($makers,$i,"telephone"); $profile_image=mysql_result($makers,$i,"profile_image"); $directory .= "<table width=260 height=178 valign=top background=images/layout_r2_c1.gif> <tr> <td> </td> </tr> <tr> <td> <table width=100% border=0 cellspacing=0 cellpadding=0>"; while ($i < $num) { if ($switch == 0) { $directory .= " <tr><td height=35><div align=center>$company</div><div align=center>$town ¦ $telephone</div><div align=center>$profile_image</div></td>"; } else { $directory .= " <td height=35> <div align=center>$company</div><div align=center>$town ¦ $telephone</div><div align=center>$profile_image</div></td> </tr>"; } $switch == 0?$switch = 1:$switch = 0; $i++; } $directory .= "</table> </td> </tr> </table>"; echo $directory;
|
Habtom

msg:3421649 | 11:38 am on Aug 14, 2007 (gmt 0) |
I missed a very important point there. I concentrated much on showing you how the table rows can be looped. On the following code, you need to make sure the right $makers database resource is passed. With this code, you don't need the variable assigning you have in the first few lines of the previous code. Here it is: $i=0; $switch = 0; $directory .= "<table width=260 height=178 valign=top background=images/layout_r2_c1.gif> <tr> <td> </td> </tr> <tr> <td> <table width=100% border=0 cellspacing=0 cellpadding=0>"; while ($row = mysql_fetch_array($makers)) { if ($switch == 0) { $directory .= " <tr><td height=35><div align=center>$row['company']</div><div align=center>$row['town'] ¦ $row['telephone']</div><div align=center>$row['profile_image']</div></td>"; } else { $directory .= " <td height=35> <div align=center>$row['company']</div><div align=center>$row['town'] ¦ $row['telephone']</div><div align=center>$row['profile_image']</div></td> </tr>"; } $switch == 0?$switch = 1:$switch = 0; $i++; } $directory .= "</table> </td> </tr> </table>"; echo $directory; Habtom
|
amwd07

msg:3421669 | 11:51 am on Aug 14, 2007 (gmt 0) |
this now returns a blank page $query="SELECT * FROM members"; $makers=mysql_query($query); $num=mysql_numrows($makers); ///////////////////////////////////////////////////////// $i=0; $switch = 0; $directory .= "<table width=260 height=178 valign=top background=images/layout_r2_c1.gif> <tr> <td> </td> </tr> <tr> <td> <table width=100% border=0 cellspacing=0 cellpadding=0>"; while ($row = mysql_fetch_array($makers)) { if ($switch == 0) { $directory .= " <tr><td height=35><div align=center>$row['company']</div><div align=center>$row['town'] $row['telephone']</div><div align=center>$row['profile_image']</div></td>"; } else { $directory .= " <td height=35> <div align=center>$row['company']</div><div align=center>$row['town'] $row['telephone']</div><div align=center>$row['profile_image']</div></td> </tr>"; } $switch == 0?$switch = 1:$switch = 0; $i++; } $directory .= "</table> </td> </tr> </table>"; echo $directory; mysql_close(); include('include/template_includes.php');?>
|
amwd07

msg:3421778 | 1:45 pm on Aug 14, 2007 (gmt 0) |
I have been looking for semi colon speech marks for the past hour now can't find anything wrong but still show a blank could there be an error in your code somewhere?
|
Habtom

msg:3421787 | 1:53 pm on Aug 14, 2007 (gmt 0) |
$query = "SELECT company, town, telephone, profile_image FROM members"; $makers=mysql_query($query); $switch = 0; $directory = "<table width=260 height=178 valign=top background=images/layout_r2_c1.gif> <tr> <td> </td> </tr> <tr> <td> <table width=100% border=0 cellspacing=0 cellpadding=0>"; while ($row = mysql_fetch_array($makers)) { if ($switch == 0) { $directory .= "<tr><td height=35><div align=center>". $row['company'] ."</div><div align=center>". $row['town'] ." ". $row['telephone'] ."</div><div align=center>". $row['profile_image'] ."</div></td>"; } else { $directory .= " <td height=35><div align=center>". $row['company'] ."/div><div align=center>". $row['town'] ." ". $row['telephone'] ."</div><div align=center>". $row['profile_image'] ."</div></td> </tr>"; } $switch == 0?$switch = 1:$switch = 0; } $directory .= "</table></td> </tr> </table>"; echo $directory;
|
amwd07

msg:3421811 | 2:27 pm on Aug 14, 2007 (gmt 0) |
this seems to show 2 columns but the layout image is behind them all I need this to make it work <table border=0 cellspacing=0 cellpadding=0> <tr> <td><div align="center" class="style5"><span class="style6">Website: <strong><u>here ...</u></strong></span></div></td> </tr> <tr> <td width=260 height=178 valign=top background=images/layout_r2_c1.gif><table width=100% border=0 cellspacing=0 cellpadding=0> <tr> <td height=35><div align=center class="style1"><?php echo $row_makers['company'];?></div></td> </tr> <tr> <td height=21><div align=center><span class="style4"><?php echo $row_makers['town'];?></span> ¦ <span class="style4"><?php echo $row_makers['telephone'];?></span></div></td> </tr> <tr> <td height=100><div align=center><a href="directory-details.php?mis_id=<?php echo $row_makers['mis_id'];?>"><img src="images/makers/tn/<?php echo $row_makers['profile_image'];?>" border="0"></a></div></td> </tr> </table></td> </tr> </table> but how do I get the above to work inbetween the $directory .=" {CODE HERE ...} "'
|
amwd07

msg:3421858 | 3:02 pm on Aug 14, 2007 (gmt 0) |
although I am not allowed to send you a link to my page here is html output via view source of what I need to achieve for the page layout <table border="0" align="center" cellpadding="12"> <tr> <td><table border=0 cellspacing=0 cellpadding=0> <tr> <td><div align="center" class="style5"><span class="style6">Website: <strong><u>here ...</u></strong></span></div></td> </tr> <tr> <td width=260 height=178 valign=top background=images/layout_r2_c1.gif><table width=100% border=0 cellspacing=0 cellpadding=0> <tr> <td height=35><div align=center class="style1">Stevie Walker</div></td> </tr> <tr> <td height=21><div align=center><span class="style4">Church Stretton</span> ¦ <span class="style4">01743 860012</span></div></td> </tr> <tr> <td height=100><div align=center><a href="directory-details.php?mis_id=8"><img src="images/makers/tn/steave_walker.jpg" border="0"></a></div></td> </tr> </table></td> </tr> </table></td> <td><table border=0 cellspacing=0 cellpadding=0> <tr> <td><div align="center" class="style5"><span class="style6">Website: <strong><u>here ...</u></strong></span></div></td> </tr> <tr> <td width=260 height=178 valign=top background=images/layout_r2_c1.gif><table width=100% border=0 cellspacing=0 cellpadding=0> <tr> <td height=35><div align=center class="style1">Niki Guy</div></td> </tr> <tr> <td height=21><div align=center><span class="style4">Shrewsbury</span> ¦ <span class="style4">01743 280961</span></div></td> </tr> <tr> <td height=100><div align=center><a href="directory-details.php?mis_id=15"><img src="images/makers/tn/niki_guy.jpg" border="0"></a></div></td> </tr> </table></td> </tr> </table></td> </tr><tr> <td><table border=0 cellspacing=0 cellpadding=0> <tr> <td><div align="center" class="style5"><span class="style6">Website: <strong><u>here ...</u></strong></span></div></td> </tr> <tr> <td width=260 height=178 valign=top background=images/layout_r2_c1.gif><table width=100% border=0 cellspacing=0 cellpadding=0> <tr> <td height=35><div align=center class="style1">Sarah Hill Contemporary Glass</div></td> </tr> <tr> <td height=21><div align=center><span class="style4">Wem</span> ¦ <span class="style4"></span></div></td> </tr> <tr> <td height=100><div align=center><a href="directory-details.php?mis_id=14"><img src="images/makers/tn/sarah_hill_contemporary_glass.jpg" border="0"></a></div></td> </tr> </table></td> </tr> </table></td> <td><table border=0 cellspacing=0 cellpadding=0> <tr> <td><div align="center" class="style5"><span class="style6">Website: <strong><u>here ...</u></strong></span></div></td> </tr> <tr> <td width=260 height=178 valign=top background=images/layout_r2_c1.gif><table width=100% border=0 cellspacing=0 cellpadding=0> <tr> <td height=35><div align=center class="style1">Dragon Alchemy</div></td> </tr> <tr> <td height=21><div align=center><span class="style4">Montgomery</span> ¦ <span class="style4">01743 860012</span></div></td> </tr> <tr> <td height=100><div align=center><a href="directory-details.php?mis_id=10"><img src="images/makers/tn/dragon_alchemy.jpg" border="0"></a></div></td> </tr> </table></td> </tr> </table></td> </tr><tr> <td><table border=0 cellspacing=0 cellpadding=0> <tr> <td><div align="center" class="style5"><span class="style6">Website: <strong><u>here ...</u></strong></span></div></td> </tr> <tr> <td width=260 height=178 valign=top background=images/layout_r2_c1.gif><table width=100% border=0 cellspacing=0 cellpadding=0> <tr> <td height=35><div align=center class="style1">Rose Knits</div></td> </tr> <tr> <td height=21><div align=center><span class="style4">Telford</span> ¦ <span class="style4">01952 590120</span></div></td> </tr> <tr> <td height=100><div align=center><a href="directory-details.php?mis_id=13"><img src="images/makers/tn/rose_knits.jpg" border="0"></a></div></td> </tr> </table></td> </tr> </table></td> <td><table border=0 cellspacing=0 cellpadding=0> <tr> <td><div align="center" class="style5"><span class="style6">Website: <strong><u>here ...</u></strong></span></div></td> </tr> <tr> <td width=260 height=178 valign=top background=images/layout_r2_c1.gif><table width=100% border=0 cellspacing=0 cellpadding=0> <tr> <td height=35><div align=center class="style1">Clanbrook Crafts</div></td> </tr> <tr> <td height=21><div align=center><span class="style4">Shrewsbury</span> ¦ <span class="style4">01743 860012</span></div></td> </tr> <tr> <td height=100><div align=center><a href="directory-details.php?mis_id=6"><img src="images/makers/tn/clanbrook_crafts.jpg" border="0"></a></div></td> </tr> </table></td> </tr> </table></td> </tr><tr> <td><table border=0 cellspacing=0 cellpadding=0> <tr> <td><div align="center" class="style5"><span class="style6">Website: <strong><u>here ...</u></strong></span></div></td> </tr> <tr> <td width=260 height=178 valign=top background=images/layout_r2_c1.gif><table width=100% border=0 cellspacing=0 cellpadding=0> <tr> <td height=35><div align=center class="style1">Maple Glass</div></td> </tr> <tr> <td height=21><div align=center><span class="style4">Shrewsbury</span> ¦ <span class="style4">01743 860012</span></div></td> </tr> <tr> <td height=100><div align=center><a href="directory-details.php?mis_id=9"><img src="images/makers/tn/maple_glass.jpg" border="0"></a></div></td> </tr> </table></td> </tr> </table></td> <td><table border=0 cellspacing=0 cellpadding=0> <tr> <td><div align="center" class="style5"><span class="style6">Website: <strong><u>here ...</u></strong></span></div></td> </tr> <tr> <td width=260 height=178 valign=top background=images/layout_r2_c1.gif><table width=100% border=0 cellspacing=0 cellpadding=0> <tr> <td height=35><div align=center class="style1">I Love Knitting</div></td> </tr> <tr> <td height=21><div align=center><span class="style4">Shrewsbury</span> ¦ <span class="style4">0781 703 6359</span></div></td> </tr> <tr> <td height=100><div align=center><a href="directory-details.php?mis_id=3"><img src="images/makers/tn/iloveknitting.jpg" border="0"></a></div></td> </tr> </table></td> </tr> </table></td> </tr><tr> <td><table border=0 cellspacing=0 cellpadding=0> <tr> <td><div align="center" class="style5"><span class="style6">Website: <strong><u>here ...</u></strong></span></div></td> </tr> <tr> <td width=260 height=178 valign=top background=images/layout_r2_c1.gif><table width=100% border=0 cellspacing=0 cellpadding=0> <tr> <td height=35><div align=center class="style1">The Gingham Chicken</div></td> </tr> <tr> <td height=21><div align=center><span class="style4"></span> ¦ <span class="style4"></span></div></td> </tr> <tr> <td height=100><div align=center><a href="directory-details.php?mis_id=17"><img src="images/makers/tn/the_gingham_chicken.jpg" border="0"></a></div></td> </tr> </table></td> </tr> </table></td> <td><table border=0 cellspacing=0 cellpadding=0> <tr> <td><div align="center" class="style5"><span class="style6">Website: <strong><u>here ...</u></strong></span></div></td> </tr> <tr> <td width=260 height=178 valign=top background=images/layout_r2_c1.gif><table width=100% border=0 cellspacing=0 cellpadding=0> <tr> <td height=35><div align=center class="style1">Carol Angela Design</div></td> </tr> <tr> <td height=21><div align=center><span class="style4">Shrewsbury</span> ¦ <span class="style4">0781 703 6359</span></div></td> </tr> <tr> <td height=100><div align=center><a href="directory-details.php?mis_id=5"><img src="images/makers/tn/carol_angela_design.jpg" border="0"></a></div></td> </tr> </table></td> </tr> </table></td> </tr><tr> <td><table border=0 cellspacing=0 cellpadding=0> <tr> <td><div align="center" class="style5"><span class="style6">Website: <strong><u>here ...</u></strong></span></div></td> </tr> <tr> <td width=260 height=178 valign=top background=images/layout_r2_c1.gif><table width=100% border=0 cellspacing=0 cellpadding=0> <tr> <td height=35><div align=center class="style1">Anthologia</div></td> </tr> <tr> <td height=21><div align=center><span class="style4">Telford</span> ¦ <span class="style4">01952 541988</span></div></td> </tr> <tr> <td height=100><div align=center><a href="directory-details.php?mis_id=16"><img src="images/makers/tn/anthologia.jpg" border="0"></a></div></td> </tr> </table></td> </tr> </table></td> <td><table border=0 cellspacing=0 cellpadding=0> <tr> <td><div align="center" class="style5"><span class="style6">Website: <strong><u>here ...</u></strong></span></div></td> </tr> <tr> <td width=260 height=178 valign=top background=images/layout_r2_c1.gif><table width=100% border=0 cellspacing=0 cellpadding=0> <tr> <td height=35><div align=center class="style1">Shrewsbury Makers</div></td> </tr> <tr> <td height=21><div align=center><span class="style4">Shrewsbury</span> ¦ <span class="style4">01743 289946</span></div></td> </tr> <tr> <td height=100><div align=center><a href="directory-details.php?mis_id=12"><img src="images/makers/tn/shrewsbury_makers.jpg" border="0"></a></div></td> </tr> </table></td> </tr> </table></td> </tr><tr> <td><table border=0 cellspacing=0 cellpadding=0> <tr> <td><div align="center" class="style5"><span class="style6">Website: <strong><u>here ...</u></strong></span></div></td> </tr> <tr> <td width=260 height=178 valign=top background=images/layout_r2_c1.gif><table width=100% border=0 cellspacing=0 cellpadding=0> <tr> <td height=35><div align=center class="style1">The Whistling Cowgirl</div></td> </tr> <tr> <td height=21><div align=center><span class="style4">Shrewsbury</span> ¦ <span class="style4">01743 860012</span></div></td> </tr> <tr> <td height=100><div align=center><a href="directory-details.php?mis_id=7"><img src="images/makers/tn/the_whistling_cowgirl.jpg" border="0"></a></div></td> </tr> </table></td> </tr> </table></td> <td><table border=0 cellspacing=0 cellpadding=0> <tr> <td><div align="center" class="style5"><span class="style6">Website: <strong><u>here ...</u></strong></span></div></td> </tr> <tr> <td width=260 height=178 valign=top background=images/layout_r2_c1.gif><table width=100% border=0 cellspacing=0 cellpadding=0> <tr> <td height=35><div align=center class="style1">Kilnwood Studio</div></td> </tr> <tr> <td height=21><div align=center><span class="style4">Shifnal</span> ¦ <span class="style4">01952 606265</span></div></td> </tr> <tr> <td height=100><div align=center><a href="directory-details.php?mis_id=11"><img src="images/makers/tn/kilnwood_studio.jpg" border="0"></a></div></td> </tr> </table></td> </tr> </table></td> </tr> </table>
|
amwd07

msg:3423085 | 6:06 pm on Aug 15, 2007 (gmt 0) |
please I still having problems with this one
|
|