Results 1 to 2 of 2

Thread: having problems creating columns in PHP and CSS

  1. #1
    Join Date
    Dec 2015
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy having problems creating columns in PHP and CSS

    Hi,

    Hope someone can guide me here. Using PHP and CSS to format dynamic columns. PHP extracts the data correctly into HTML, but cannot get CSS to format the Columns correctly, See uploaded jpg file. The following is the PHP code:

    Thanks for your help

    Mandy

    Code:
    function key_navigation ($products_array, $cpd_array) {		
        $product_set = find_all_products(false);
    	$output = "<table width='100%'>  ";
    
    	while($product = mysqli_fetch_assoc($product_set)) {   		 		 
    	
    	if ($products_array && $product["p_id"] == $products_array["p_id"]) {
    		}
    		$num = $product["p_id"];	
    	    $i = 0;					
    	$output .= "<th bgcolor=\"#993366\" valign=\"middle\" width=\"10%\">  <a href=\"edit_product.php?p_id=";
    	$output .= urlencode($product["p_id"]); 
    	$output .= "\">" ;
    	$output .= htmlentities($product["p_desc"]); 
      	$output .= "</a>";
    	$cpd_set = find_page_for_cpd ($product["p_id"]); 	
     	$output .= "</th>";
    //$output .= "<tr> </tr>";					 
    	while($cpd = mysqli_fetch_assoc($cpd_set)) {
    
    	if ($cpd_array && $cpd["cpd_id"] == $cpd_array["cpd_id"]) {
    }
    
    
    	//$output .= "<tr>";		
        $output .= "<td align='center'>";
    	
    	$output .= "\"<a href=\"edit_cpd.php?cpd_id=";
    	$output .= urlencode($cpd["cpd_id"]); 
    	$output .= "\">"; 
    	$output .= htmlentities($cpd["cpd_title"]); 
    
    	$output .= "</td>";
    }
        }
    	mysqli_free_result($product_set);  
    	$output .= "</table>";
    
    	return $output;				
    }
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	columns.jpg 
Views:	209 
Size:	90.7 KB 
ID:	5766  
    Last edited by Beverleyh; 12-22-2015 at 06:34 AM. Reason: Formatting

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    Unfortunately we can't troubleshoot an image. If you need CSS help, we need to see a sample of the HTML and the CSS that applies to it.

    However, this currently doesn't look to be CSS related at all - rather an issue with the output of the HTML that the PHP is generating. Unfortunately, I don't understand the groupings of the items named in your image and the text in the top image bears no relation to that in the lower image so I don't really want to make a guess. The PHP also looks incomplete.

    Check the source code to see what HTML is being generated and then modify the PHP and check the HTML output again. Repeat. What you're trying to do might work if you start a table right before each purple header, and then close it right after the last product in that grouping. Then you could float the small group tables next to each other. If you want to try that, the HTML output you'd be aiming for would be something like this for each grouping;
    Code:
    <table>
    <tr><th>header</th></tr>
    <tr><td>item 1</td></tr>
    <tr><td>item 2</td></tr>
    <tr><td>item 3</td></tr>
    </table>
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

Similar Threads

  1. How do I set up three columns like this?
    By windbrand in forum CSS
    Replies: 7
    Last Post: 03-06-2013, 07:14 PM
  2. Having problems creating my favicon
    By jus2sho in forum Graphics
    Replies: 5
    Last Post: 08-01-2009, 05:14 PM
  3. Creating Columns?
    By reddiestorm in forum CSS
    Replies: 4
    Last Post: 01-08-2008, 10:52 PM
  4. Columns
    By NADB in forum CSS
    Replies: 1
    Last Post: 07-13-2007, 02:42 PM
  5. Problems creating a page in CSS
    By greasyspoon in forum CSS
    Replies: 1
    Last Post: 10-17-2006, 09:52 PM

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
  •