Jump to content

need some help with php and mysql


taslayer

Recommended Posts

hi guys, first post sorry, but im making a site for my boss and im stuck here, heres what im trying to do.

before i continue im not asking anyone to do it for me, i just learn by example.

also im doing this by modifying a html template to contain php and eventualy have the whole site php :)

 

 

anyway, im making him a site and working on a faw page, here is what it is supposed to look like

LQh9m.gif

here is the orig html template code

http://pastebin.com/RHb2161i

 

heres what it looks like now

G5RTU.gif

here is faq.php

http://pastebin.com/GNNTAcQu

 

also im only going to be a free man for like 2-4 more weeks i go for sentencing. yay prison time :( but i want to get this site done for my boss before i go, because he has always been there for me (insert more sappy stuff here) but yeah, any help would be greatly appreciated

Link to comment
https://forums.phpfreaks.com/topic/259130-need-some-help-with-php-and-mysql/
Share on other sites

update:

managed to get it to display almost correctly, i forgot to fix variables

 

current code

mysql_select_db($database_local, $local);
// sample query, get members 
$query = mysql_query("select name from faq_cat");


// count total number of items to show
$total = mysql_num_rows($query);


// initiate row counter
$counter = 3;

// initiate columns contents
$column_1 = '';
$column_2 = '';
$column_3 = '';
$column_4 = '';
$column_5 = '';
$column_6 = '';
$column_7 = '';
$column_8 = '';
$column_9 = '';
while($row = mysql_fetch_assoc($query)){

    // caluculate column for current element from total items to be showed number of     columns and current item
    $column = get_column($total, 9, $counter);

    if($column == 1){
        $column_1 .= $row['name'];
        }

    if($column == 2){
        $column_2 .= $row['name'];
        }    
if($column == 3){
        $column_3 .= $row['name'];
        }

    if($column == 4){
        $column_4 .= $row['name'];
        }

    if($column == 5){
        $column_5 .= $row['name'];
        }    
if($column == 6){
        $column_6 .= $row['name'];
        }

    if($column == 7){
        $column_7 .= $row['name'];
        }

    if($column == {
        $column_8 .= $row['name'];
        }    
if($column == 9){
        $column_9 .= $row['name'];
        }


    $counter++;
    }

// show content in two table comments
echo "<div id=\"content\">
    <div class=\"row-1\">
      <div class=\"indent\">
        <div class=\"wrapper\">
          <div class=\"box\">
            <div class=\"corner-top-left png\">
              <div class=\"corner-top-right png\">
                <div class=\"border-top png\"><img src=\"images/3page-title1.gif\" alt=\"\" /></div>
              </div>
            </div>
		<div class=\"box-content\">
              <div class=\"row-3\">
                <div class=\"wrapper\">
                  <div class=\"col-1\">
                    <ul class=\"list no-padding\">
                      <li><a href=\"#\">$column_1</a></li>
                      <li><a href=\"#\">$column_2</a></li>
                      <li><a href=\"#\">$column_3</a></li>
                    </ul>
                  </div>
                  <div class=\"col-2\">
                    <ul class=\"list no-padding\">
                      <li><a href=\"#\">$column_4</a></li>
                      <li><a href=\"#\">$column_5</a></li>
                      <li><a href=\"#\">$column_6</a></li>
                    </ul>
                  </div>
                  <div class=\"col-3\">
                    <ul class=\"list no-padding\">
                      <li><a href=\"#\">$column_7</a></li>
                      <li><a href=\"#\">$column_8</a></li>
                      <li><a href=\"#\">$column_9 </a></li>
                    </ul>
                  </div>
                </div>
              </div>
            </div>";

?>

 

for some reason im only getting 1 row in the first column, any ideas?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.