Jump to content

harristweed

Members
  • Posts

    346
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by harristweed

  1. Here is a function I use for replacing new line breaks with p tags.

     

    Perhaps you could expand on this.

     

    function nl2p($text){
    
    // Return if there are no line breaks.
    if (!strstr($text, "\n")) {
    	return $text;
    }
    // put all text into <p> tags
    $text = '<p>'.$text.'</p>';
    // replace all newline characters with paragraph
    // ending and starting tags
    $text = str_replace("\n", "</p>\n<p>", $text);
    // remove empty paragraph tags & any cariage return characters
    $text = str_replace(array('<p></p>', "\r" ,"\n"), '', $text);
    $text = trim($text);
    return $text;
    } // end nl2p

  2. I think you mean something like this:

     

    <?php
      
      function between($price){
           $Maxprice = 200 ;// set maximum
           $Minprice  = 100 ;// set minimum
           
           if($price <= $Maxprice && $price >= $Minprice){
               echo"  In range ";
           }else{
               echo" Out side Limit ";
           }
      }
      
      between(150) ;
      between(500) ;
      
      
    ?>

  3. Like this:

    <?php
      $week=date("W");
    
      switch ($week) {
          
          
          case "20":
          // it's easter
          break;
          
          case "30":
          //summer holiday
          break;
           case "51":
           //Christmas
           break;
           
           default:
           if($week % 2){
               //its week a
           $display = "week a";
           }else{
               //it's week b
            $display = "week b"; 
           }
           
      }
    ?>

  4. try something like this:

    <?php
    
    $query = mysql_query("SELECT tblLodges.strLodgeName, tblOfficers.strFirstName, tblOfficers.strLastName FROM tblLodges LEFT JOIN tblOfficers ON tblLodges.lngLodgeID = tblOfficers.lngLodgeID WHERE $metode LIKE '%$search%' LIMIT 0, 50");
    
    $results=mysql_query($query);
    echo "<table border='1'>
       <tr>
    <th>Officer Lodge Name</th>
    <th>Officer Lodge ID</th>
    <th>Officer City</th>
    <th>Officer zip</th>
    <th>Officer County</th>
    <th>Officer First</th>
    <th>Officer last</th>
    
    
    </tr>";
    while ($row = mysql_fetch_array($query))
    {
    $variable1=$row["strLodgeName"];
    $variable2=$row["strLodgeID"];
    $variable3=$row["strDistrictName"];
    $variable4=$row["strLodgeLocationCity"];
    $variable5=$row["strLodgeLocationZip"];
    $variable6=$row["strLodgeCounty"];
    $variable7=$row["strFirstName"];
    $variable8=$row["strLastName"];
    
    //table layout for results
    
    print ("<tr>");
    echo "<td class=\"td_id\"><h3>$variable1</h3></td>\n";
    
    echo "<td class=\"td_id\">$row[strLodgeID]</td>\n";
    echo "<td class=\"td_id\">$row[strDistrictName]</td>\n";
    print "<td class=\"td_id\">$row[strLodgeLocationCity]</td>\n";
    print "<td class=\"td_id\">$row[strLodgeLocationZip]</td>\n";
    print "<td class=\"td_id\">$row[strLodgeCounty]</td>\n";
    print ("</tr>");
    }
    ?>
    
    <p class="style1">Roster of Officers </p>
                         
                                <hr width=75% align=center size=4>
                                <p>
    
    <?php
    echo "<table border='1'>
    <tr>
    <th>Officer First Name</th>
    <th>Officer Last Name</th>
    <th>Officer Business Phone</th>
    <th>Officer Email</th>
    </tr>";
    
    while ($row = mysql_fetch_array($query))  
      {
      echo "<tr>";
      echo "<td>" . $row['strFirstName'] . "</td>";
      echo "<td>" . $row['strLastName'] . "</td>";
      echo "<td>" . $row['BusinessPhone'] . "</td>";
      echo "<td>" . $row['PersEmail'] . "</td>";
      echo "</tr>";
      }
    echo "</table>";
    ?>

  5. I don't know if this will help but i've had issues with code working on one server and not on another; quotes causing the problem. The reason was 'magic quotes' was set on one and not the other. The good news is that this sillyness will disappear with PHP6

  6. This won't work because:

    <input type="hidden" name="return" value="http://192.168.1.38/lennoxhillsitedemo/index.php?option=com_pricecal&task=payment_success">

    references your local server, not available from the internet

  7. Export from excel as a csv file.

    Upload the csv file to your server

    Read the file and update the database as necessary

    This is how you read the file

    <?php
    $filename = "your_file.csv";
    $handle = fopen($filename, "rb");
    $data = fread($handle, filesize($filename));
    //each row will be in array called $data
    $rows=explode("\r", $data);
    $count=count($rows);
    for ($i=0;$i<$count;$i++)
    {
    //set $number_columns= columns in spread sheet
    $sub_data=explode(",", $rows[$i]);
    for($x=0;$x<=$number_columns;$x++)
    {
    	// update datbase here
    //data in column one = $sub_data[$x];
    //data in column two = $sub_data[$x];
    //data in column three = $sub_data[$x];
    }
    
    }
    
    ?>
    

     

  8. Have a link from each row in the display page that has the id of the data that will be displayed on the new page...

     

    <a href="new_page.php?item_id=432">new page</a>

     

    In the new page have the code:

     

    $data_key=$_GET['item_id'];

     

    Then the sql query, something like:

    $select ="select * from table name where id_field = '$data_key' ";

     

    Display results!

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