Jump to content

phpretard

Members
  • Posts

    821
  • Joined

  • Last visited

    Never

Posts posted by phpretard

  1. After reading the manual (as per the Terms of this site)

     

     

     

    $var="http://www.google.com/search?hl=en&rls=com.microsoft:*&pwst=1&q=tallahassee+web+designer&start=10&sa=N";
    
    $me=substr_replace($var, 'everything between Q and the &'); is the idea.
    
    echo $me;
    
    I would like $me to =tallahassee+web+designer;
    
    
    

  2. I am trying to add 5 rows to a table with one if statement.

     

    The only variable that is different:

     

    $Pname

     

    I know the code below will work...but is there a way to do this without 5 querys? (NO ARRAYS PLEASE)

     

    
    if ($Pname=='5_Item_Package'){
    
    		mysql_query("INSERT INTO projects (id, Cnumber, Pname, date, approved, status, qty, cost, included, description, hourly, locked ) 
    		VALUES ('', '$Cnumber', 'DIFFERENT NAME 1', '$today', '$approved', '$status', '$qty', '$cost', '$included', '$description', '$hr', '$locked' )");
    
    		mysql_query("INSERT INTO projects (id, Cnumber, Pname, date, approved, status, qty, cost, included, description, hourly, locked ) 
    		VALUES ('', '$Cnumber', 'DIFFERENT NAME 2', '$today', '$approved', '$status', '$qty', '$cost', '$included', '$description', '$hr', '$locked' )");
    
    		mysql_query("INSERT INTO projects (id, Cnumber, Pname, date, approved, status, qty, cost, included, description, hourly, locked ) 
    		VALUES ('', '$Cnumber', 'DIFFERENT NAME 3', '$today', '$approved', '$status', '$qty', '$cost', '$included', '$description', '$hr', '$locked' )");
    
    		mysql_query("INSERT INTO projects (id, Cnumber, Pname, date, approved, status, qty, cost, included, description, hourly, locked ) 
    		VALUES ('', '$Cnumber', 'DIFFERENT NAME 4', '$today', '$approved', '$status', '$qty', '$cost', '$included', '$description', '$hr', '$locked' )");
    
    		mysql_query("INSERT INTO projects (id, Cnumber, Pname, date, approved, status, qty, cost, included, description, hourly, locked ) 
    		VALUES ('', '$Cnumber', 'DIFFERENT NAME 5', '$today', '$approved', '$status', '$qty', '$cost', '$included', '$description', '$hr', '$locked' )");
    
    }
    
    else {Just one query}
    
    

  3. The Code Below Printed this:

     

    Monday, May 19, 2008 1211258618

     

    I think  >>>1211258618<<<  that is supposed to be the time.

     

    So what is the time or how the heck do you translate that into human time?

     

     

    $t=time();
    echo($t . "<br />");
    echo(date("D F d Y",$t));

  4. On that note ... I may be approaching this wrong...

     

    I am looking to add all the $cost together.

     

    $result = mysql_query("SELECT * FROM table ");
    
    while($row = mysql_fetch_array($result))
      {
      $cost=$row['cost'];
      }

     

     

    $cost has as many values that are in the DB.  I just want to take the total of all the rows and echo it out.

     

     

  5. I am trying to form an array from thre value of $cost.

     

     

    $result = mysql_query("SELECT * FROM table ");
    
    while($row = mysql_fetch_array($result))
      {
      $cost=$row['cost'];
      }

     

    $a=array(SOMTHING HERE);

     

    any thoughts?

     

     

  6. I don't know if this helps my question become any more clear but this gives me the desired result.

     

    The Query is different each time.  I am sure there is an easier way...but I don't know what it is.

     

     

    $result = mysql_query("SELECT * FROM projects WHERE Cnumber='$Cnumber' AND revise !='' AND approved ='' ORDER by Pname");
    
    while($row = mysql_fetch_array($result))
      {
      $id=$row['id'];
      $Pname=$row['Pname'];
      $pic=$row['pic'];
      $Cnumber=$row['Cnumber'];
      $approved=$row['approved'];
      $revise=$row['revise'];
      $details=$row['details'];
      $qty=$row['qty'];
      
    $status="| Revision Requested";
    
    include 'pages/secure/pages/projects/revise.php';
    
    }
    
    $result = mysql_query("SELECT * FROM projects WHERE Cnumber='$Cnumber' AND revise ='' AND approved ='' ORDER by Pname");
    
    while($row = mysql_fetch_array($result))
      {
      $id=$row['id'];
      $Pname=$row['Pname'];
      $pic=$row['pic'];
      $Cnumber=$row['Cnumber'];
      $approved=$row['approved'];
      $revise=$row['revise'];
      $details=$row['details'];
      $qty=$row['qty'];
      
    $status="| Pending Review";
    
    include 'pages/secure/pages/projects/pending.php';
    
    }
    
    $result = mysql_query("SELECT * FROM projects WHERE Cnumber='$Cnumber' AND approved !='' ORDER by Pname");
    
    while($row = mysql_fetch_array($result))
      {
      $id=$row['id'];
      $Pname=$row['Pname'];
      $pic=$row['pic'];
      $Cnumber=$row['Cnumber'];
      $approved=$row['approved'];
      $revise=$row['revise'];
      $details=$row['details'];
      $qty=$row['qty'];
      
    $status="| Order Completed";  
    
    include 'pages/secure/pages/projects/approved.php';
    
    }

     

    PS Thank you for the operator note

  7. No matter how many $results there are it will only display include one page.

     

    Do I need a foreach or something?

     

    I think I realize that when the first if statement is met the while loop stops, but I don't know any solution.

     

     

     

    $result = mysql_query("SELECT * FROM projects WHERE Cnumber='$Cnumber' ORDER by Pname");
    
    while($row = mysql_fetch_array($result))
      {
      $id=$row['id'];
      $Pname=$row['Pname'];
      $pic=$row['pic'];
      $Cnumber=$row['Cnumber'];
      $approved=$row['approved'];
      $revise=$row['revise'];
    
    if (($approved!=='')&&($revise=='')){include 'approved.php';}
    if (($approved=='')&&($revise!=='')){include 'revise.php';}
    if (($approved=='')&&($revise=='')){include 'pending.php';} 
    
    }

     

    There is one entry that mathes each if statement right now but only one will display.

  8. I have read the manual and it gives way to much information.  If there is no simple trim feature I'll keep reading.  Just let me know either way.

     

     

    Thank Errbody!

  9. I am  trying to add a folder named "TEST" to a folder in my site located here:

     

    www.website.com/pages/secure/proofs

     

    Where in this line of code does TEST go?

     

     

    <?
    mkdir("/pages/secure/proofs/" , 0700);
    ?>

     

    I keep getting errors no matter where i put TEST.

  10. I have read the manual and none of the examples or numbers usa a Zero as a one hundreth.

     

    $Example="1.50549976546"

     

    round($Example, 2) returns 1.5 (notice the Zero missing)

     

    I need the zero to show up.

     

    Can you help?

     

     

     

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