Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: Styling page doesn't seem to work, plz help

  1. #11
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    I mean that to test this, you need full access to your server: change the PHP code (such as adding echo statements like I did, and then actually fixing the code) and looking at what happens when you run it. Just looking at the PHP code doesn't help because it looks fine, but clearly something in the actual process of generating html is wrong-- so you need to have access to test it.

    I still suggest that you compare your desired output to the real output and take it on step at a time. It's likely that there are a number of problems, but trying to fix them all at once will be confusing. Just do one at a time and figure out specifically what is not happening. PHP doesn't do anything mysterious: it operates line by line. And to debug it, you will need to operate line by line as well-- think like the program and go step by step to find out where it's wrong. Using tricks like "echo" above will help because you can check that at a certain point it's still correct (or incorrect).
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  2. #12
    Join Date
    Dec 2009
    Posts
    48
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Okay great, I am working on it.

    I do have another question...
    I've got the following line to generate the url:

    PHP Code:
    $link="?step=color&sizecat=".urlencode($sizecat)."&finalsize=".urlencode($item[finalsize]); 
    In this case, the sizecat is 'Square XL' and the finalsize is '21 x 21 cm'. When I use only the first part of this link (so only the sizecat), the complete url is working. However, I now need to display the items where the sizecat and the finalsize are chosen.

    It creates the following url:

    Code:
    /Folders_Formaten2.php?step=color&sizecat=Square+XL&finalsize=21+x+21+cm
    The url displays the correct data, but it keeps showing an empty page (though I know there should be results as calling this in the database gives me results).

    Do you know what I am doing wrong or how I can fix this?

  3. #13
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    That is generating the correct URL, right?

    So that means the problem is on the page receiving this information.

    One reason may be the spaces that become plus signs-- spaces aren't good for variables like that, so try removing them and see if it helps.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #14
    Join Date
    Dec 2009
    Posts
    48
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    No difference. still an empty page, eventhough I deleted the spaces. I tried another approach for the styling. That does work, but maybe it messes up the next page?

    Here's my current code. I also added in the next step, since I cannot seem to get the link to that step correctly....


    PHP Code:
    <?php  switch($_GET['step']){
         case 
    "items"
         
    $column=2;
              
    $sizecat=mysql_real_escape_string($_GET['size']);
              echo 
    "<table style='width:100%;'>\n\t\t<tr>";
              
    $itemsQuery=mysql_query("SELECT DISTINCT thumb_sizecat, sizecat, link_size, size, thumb_size, finalsize FROM `Folders` WHERE `sizecat`='{$sizecat}';");
                
              while(
    $item=mysql_fetch_array($itemsQuery)){
                   
    $link="?step=color&sizecat=".urlencode($sizecat)."&finalsize=".urlencode($item['finalsize']);
                  
                  if (
    $column==2) {echo "<tr>";}
                    
    ?>
                    <td width="25%" align="center"><?php echo "<a href='{$link}'><img src='{$item['thumb_size']}'  alt='{$item['thumb_size']}' /><br />{$item['size']}<br />{$item['finalsize']}<br /></a>" ?></td>
                    <?php
                    $column
    ++; if ($column==6) { echo "</tr>"$column=2; }
                      }
              echo 
    "</tr><tr><td align='center' colspan='4'><input type=button value='Back' onClick='history.go(-1)'></td></tr></table>\r\n";
         break;
         case 
    "color":
         
    $column=2;
              
    $finalsize=mysql_real_escape_string($_GET['finalsize']);
              echo 
    "<table style='width:100%;'>\n\t\t<tr>";  
              
    $colorQuery=mysql_query("SELECT DISTINCT thumb_sizecat, sizecat, link_size, size, thumb_size, finalsize, color, link_color, thumb_color FROM `Folders` WHERE `finalsize`='{$finalsize}';");

              while(
    $item=mysql_fetch_array($colorQuery)){
                   
    $link="?step=material&finalsize=".urlencode($finalsize)."&finalsize=".urlencode($item['finalsize']);
                  
                  if (
    $column==2) {echo "<tr>";}
                    
    ?>
                    <td width="25%" align="center"><?php echo "<a href='{$link}'><img src='{$item['thumb_color']}'  alt='{$item['thumb_color']}' /><br />{$item['color']}<br /></a>" ?></td>
                    <?php
                    $column
    ++; if ($column==6) { echo "</tr>"$column=2; }
                      }
              echo 
    "</tr><tr><td align='center' colspan='4'><input type=button value='Back' onClick='history.go(-1)'></td></tr></table>\r\n";
         break;
         default:
              
    $table "<table style='width:100%;'><tr>\n";  
              
    $result mysql_query("SELECT DISTINCT thumb_sizecat, sizecat, link_size FROM Folders ORDER BY id") or die (mysql_error());  
              while(
    $row mysql_fetch_array($result)){  
                   
    $row['price1'] = round ((($row['price1']+5) *1.85),0);
                   
    $base_m=5;
                   
    $row['price11'] = $base_m*(ceil(($row['price1'])/$base_m));
                   
                   
    $table.="\t\t<td align='center' style='width:25%;'>"
                   
    ."<a href='?step=items&size=".urlencode($row['sizecat'])."'><img src='{$row['thumb_sizecat']}' alt='{$row['thumb_sizecat']}' />"
                   
    ."<br />{$row['sizecat']}</a></td>\n"
                   
    $colnum++;if($colnum == 0$table.="\t</tr>\n\t<tr>\n";  
              }  
              
    $table .= "\t</tr>\n</table>\n";
              echo 
    $table
         break;
    }
    ?>
    What do you think?

    edit: and yeah, it's for generating the correct url
    Last edited by Bar2aYunie; 06-21-2010 at 11:09 AM.

  5. #15
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Your missing closing semi colons on 2 of your echos..

    PHP Code:
    if ($column==2) {echo "<tr>";}
                    ?>
                    <td width="25%" align="center"><?php echo
    at the end of those
    Corrections to my coding/thoughts welcome.

  6. #16
    Join Date
    Dec 2009
    Posts
    48
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by bluewalrus View Post
    Your missing closing semi colons on 2 of your echos..

    PHP Code:
    if ($column==2) {echo "<tr>";}
                    ?>
                    <td width="25%" align="center"><?php echo
    at the end of those

    Sorry, what? I'm confused, what do you mean?

  7. #17
    Join Date
    Dec 2009
    Posts
    48
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Well, after hours of puzzling, I figured out the problem. I do have something else I wanna ask you.... (which might save me hours of puzzling, haha)

    Here's my code:

    PHP Code:
    $sizecat=mysql_real_escape_string($_GET['sizecat']);
              
    $finalsize=$_GET['finalsize'];
              
    $thumb_size=$_GET['thumb_size'];
              
    $color=$_GET['color'];
              
    $material=$_GET['material'];
              echo 
    "<table style='width:100%;'>\n\t\t<tr><td align='center' colspan='4'><h1>View Prices</h1></td></tr><tr>";  
              
    $finalQuery=mysql_query("SELECT DISTINCT thumb_size, size, totalsize, Info, material, thumb_material, finalsize, color FROM `Folders` WHERE `sizecat`='{$sizecat}' AND `finalsize`='{$finalsize}' AND `color`='{$color}'  AND `material`='{$material}' AND `thumb_size`='{$thumb_size}';"); 
    The select query works for the whole line except for the thumb_size... Without that last part, the query returns three rows (and I only need it to return one row). The thumb_size and the totalsize are the only two things in the database that have their own unique data, unique for every entry. So, to be able to get only one row returned from the query, I need one of those at the end of the query (the others wouldn't even be needed actually).

    But both of them don't work.... Any idea's??

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •