Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Posts posted by wildteen88

  1. Then you probably need to use the resize function like so

    <div class="thumb">
        <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"> 
          <?php 
            $settings = array("w"=>100,"h"=>100,"crop"=>true);
            $values = get_post_custom_values("thumbs");
          ?>
            <img src="<?php echo resize($values[0], $settings); ?>" alt="<?php the_title(); ?>" />
        </a>
    </div>	

  2. ahhhh

     

    but what if ive made 2 classes in the css to style the cells? as they should have a border bottom and also padding?

    Then change

      echo "<tr style=\"background-color: $bgcolor\">"; // apply the color to the row

    to

      echo "<tr class=\"$bgcolor\">"; // apply the class to the row

     

    Now set the variables $color1 and $color2 to your two classes.

     

    also, how would i display the full line of text including varibles in the one cell? in the code i posted it only is 2 varibles posted into 2 cells.  I need the full sentence like the images i attached

     

    thanks for ur help :)

    Just place the text after your variables.

  3. This is how you alternate colors

    $i = 0; // initiate counter variable
    
    // set the colors
    $color1 = '#e1e1e1'; // first color
    $color2 = '#cccccc'; // secound color
    
    while($row = mysql_fetch_array($result))
      {
          // alternate row colors
          $bgcolor = ($i % 2 == 0) ? $color1 : $color2;
          
      echo "<tr style=\"background-color: $bgcolor\">"; // apply the color to the row
      echo "<td>" . $row['firstname'] . "</td>";
      echo "<td>" . $row['lastname'] . "</td>";
      echo "</tr>";
      
          $i++; // increment counter
      }

  4. im trying to tell u that , that code doesn't work because it gives me a server error on the videos page

    What error? It would be helpful if you tell us the exact error and on what line(s) it is occurring?

  5. You have left off the curly braces

     

    if($state == 'FL') {
        $price = $prices_array[$size]; // Set Price
        $tax = number_format($price * .07,2); // Set tax
        $amount = number_format($price + $tax,2); // Set total amount
    } else {
        $price = $prices_array[$size]; // Set Price
        $tax = number_format($price * .0,2); // Set tax
        $amount = number_format($price + $tax,2); // Set total amount
    }

  6. try jQuery

    Why?

     

    You'd use CSS for this. You wont be able to color certain parts of text within the <option></option> tags. Example CSS

     

    <select>
        <option value="large blue" style="color: blue">Large Blue T-shirt</option>
        <option value="large blue" style="color: Green">Small Green T-shirt</option>
    </select>

     

    I'll move this to CSS help

  7. You could reconstruct attack array so each attack level is holds an array of attacks. Example array structure

    $array (
    // level => array of attacks    
        4  => array('poison', 'tackle'),  
        6  =>  array('sleep powder'),
        44 => array('giga drain'),
        // etc
    )

     

    Then all you need to do to get the all the attacks for level 4 would be

      if (isset($array[4])) {
        $attacks[] = $array[4];
      }

  8. oopsi, i meant:

    <?PHP
    $con = mysqli_connect('localhost', 'virtuala_test', 'password', 'dbname')
    ?>
    

     

    That will work so long as the OP is using the mysqli library functions within their code. The functions for mysql and mysqli are not interchangeable. So if you're using mysqli_connect toconnect to mysql but use mysql_query to run a query it wont work.

  9. The only way to pass both the  $var2['DID'] and $var2['directory'] values would be as marcelobm suggested to you earlier

    you could do something like:

    echo  "<option value='$var2[DID]_$var2[directory]'>$var2[directory]</option>";
    

    and then in the script that receives the value use

    $value_arr = explode("_",$value);
    and that will give you:
    
    $value_arr[0] = id;
    $value_arr[1] = path or directory];
    

    That is the simple solution, the other solution is, when you get the id in the script that process the form, do a query with the id you get to retrieve the directory

     

    To get the id and directory within the script that processes the form you'd use something like this

    list($id, $directory) = explode('_', $_POST['id']);

  10. Your query is selecting all the rows within the dle_mylink table, and ordering the results by the size of the title in descending order (ie largest title to smallest title)

    $SQL = "SELECT * FROM dle_mylinks ORDER BY LENGTH( title ) DESC";

     

    If that table has 83000 rows then it'll return 83000 results. The while loop will iterate over the results 83000 times.

    while ($db_field = mysql_fetch_assoc($result)) {
    $row['full_story'] = str_replace ($db_field['title'],"<a href=\"?newsid=" . $db_field['id'] . "\">" . $db_field['title'] . "</a>" ,$row['full_story']);
    $row['short_story'] = str_replace ($db_field['title'],"<a href=\"?newsid=" . $db_field['id'] . "\">" . $db_field['title'] . "</a>" ,$row['short_story']);
    }

     

    The code within the while loop (between the curly braces { and } ) will be executed for every row the query is returned. So if your query returns 83000 rows then those two lines WILL be executed 83000 times.

     

    After the while loop you have this line

    $mydata =$row['short_story'] .  $row['full_story'];

    Here you are concatenating the $row['short_story'] and  $row['full_story'] variables into one value and assigning that to the $mydata variable. The $mydata variable will only store the result from the very last row returned by your query. You are not doing anything with the previous 82999 rows, as the while loop will keep overwriting the $row['short_story'] and  $row['full_story'] variables each time it processes the next row.

×
×
  • 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.