";
        }
        $title             = $data[0];
        $description     = $data[1];
        $image             = $data[2];
        $html .= "
                   
        ";
        $c++;
       
        if ($c==3)
        {
            $html .= "";
            $c = 0;
        }
    } Any suggestions on a good way of doing this? 

Edited I came up with a solution of my own: http://community.livejournal.com/php/612044.html?thread=4427980#t4427980

Source: http://community.livejournal.com/php/612044.html

  • exec() question

    Date: 02/06/08     Keywords: php, database

    Has anyone had any luck running exec() in the background?

    I'm using php to initiate a perl script using exec with the following...

    exec('cd /usr/local/www/data/site/parse; perl parse_dbf.pl "'.$var1.'" "'.$var2.'" "'.$var3.'"');

    now that parse dbf.pl is doing a lot of various database updates and takes several minutes to run, and since the php page that's running it is waiting for it to finish, it dies before completion.
    I also don't want to do something like set_time_limit(), because that's just messy and hangs the page.

    Looking at the php docs for exec, I see "If you start a program using this function and want to leave it running in the background, you have to make sure that the output of that program is redirected to a file or some other output stream or else PHP will hang until the execution of the program ends."

    This sounds like exactly what I want it to do, but I'm not having any luck getting it to run.

    I've been googling for ideas, but nothing has worked yet. My most recent attempt (and there have been many variations) looks like:

    exec('cd /usr/local/www/data/site/parse; perl parse_dbf.pl "'.$var1.'" "'.$var2.'" "'.$var3.'" > holdfile.txt 2>&1');

    It quickly executes the php page, but doesn't actually run the perl.

    I'm stuck. Has anyone had luck with this? Any ideas?

    Thanks

    _________

    edit: This seems to work (although for some reason without changing the set_time_limit(), it only changes 70 of the 1657 records it's suppose to edit. Anyway, I'll figure that out. Thanks.

    exec('cd /usr/local/www/data/site/parse; perl parse_dbf.pl "'.$var1.'" "'.$var2.'" "'.$var3.'" > /dev/null 2> /dev/null & echo $!');

    Source: http://community.livejournal.com/php/611669.html

  • php/linux permissions

    Date: 02/02/08     Keywords: php, apache

    In an Ubuntu distribution, I believe PHP runs as user www-data (inheriting the user name of apache).

    All of the files I create have my user name and my group name.

    I have a script that requires write access to some files and folders.

    Is it better to add www-data to my group, or is it better to make these files and folders world writable (ie 0777)? Or is there another approach I am missing?

    Source: http://community.livejournal.com/php/611462.html

  • Calendar issue

    Date: 01/30/08     Keywords: php

    Hello,

    Very glad to find this community, why it hadn't occurred to me to search for one on LJ before now is beyond me. I'm trying to transition out of a user/network support position and into a more backend/developer role. As such I've been working on various projects that I've either suggested and implemented or I've been asked to work on in addition to my normal duties. I've ran into a snag with one of the projects, and I'm hoping someone here can offer some insight. :)


    I'm working with WordPress MU and trying to get a calendar plugin that was written for the standalone WordPress to work. I have a modified copy that another MU user has working on his site and it is working somewhat on mine, but with a problem. I think the problem is in the PHP script. I have asked about this over on the WPMU boards but so far no responses, hoping maybe someone here will be able to point me in the right direction. You can see a properly working version of this calendar here. My installation is on an intranet so I can't share it.

    The problem is that the calendar isn't rewriting properly. I go to the calendar page at
    http://URL/calendar
    and it is fine.

    I can click PREV or NEXT and it properly navigates to the Dec 2007 or Feb 2008 page. But then when I click "Previous" to go back to January, it adds an extraneous 2008 both to the URL and the calendar display.
    http://URL/calendar/2008/2008/jan

    And, any events I had posted to the Jan 2008 calendar are missing because that is not the Jan 2008 calendar, it is the Jan 2008/2008 calendar.

    Clicking Previous again brings up the Dec 2008/2008/2007 calendar page with the URL
    http://URL/calendar/2008/2008/2007/dec

    It just keeps tacking on extraneous years with each subsequent PREV or NEXT movement.

    The calendar.php script is large so rather than include it in this post here's a link to it . I am not sure which function I should be focusing on, next_link, prev_link, or calendar. Or perhaps I'm completely wrong in looking there at all.

    I do have rewrite rules in the .htaccess:

    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /wpmu/

    RewriteRule ^.*/calendar/(.*)/(.*) wp-calendar.php?year=$1&month=$2 [QSA,L]
    RewriteRule ^.*/calendar wp-calendar.php [QSA,L]

    #uploaded files
    RewriteRule ^(.*/)?files/$ index.php [L]
    RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]


    If you can offer me some pointers on where I should be making changes to the script, if any, I would really appreciate it. :) Thanks!

    Source: http://community.livejournal.com/php/611113.html

  • PHP + mail server

    Date: 01/29/08     Keywords: no keywords

    Hi all. I need to check mail and if where some new messages I need to get attached file. What you could advice?

    Source: http://community.livejournal.com/php/611046.html

  • How to improve captcha.php

    Date: 01/27/08     Keywords: php, html


    
    



    A couple of things:

    1) Every so often captcha.php results in a blank image with no text. It occurs very rarely and randomly. How can I prevent this?

    2) I will have multiple programs using this very same PHP to produce what should be different captcha images. Like you will have emailalert.php calling an HTML img src tag pointing to captcha.php, but so will guestbook.php, trivia,php, profile.php, etc. How can I accomplish this?

    Thanks

    Source: http://community.livejournal.com/php/610773.html

  • Zend Platform 3.0.3 Help

    Date: 01/25/08     Keywords: mysql, database, sql

    Hey Guys, I'm new to this community so if this is the wrong place to post please let me know.

    I decided tonight to focus on my development environment. Has any one successfully gotten Zend Platform 3.0.3 to run on OS X Leopard 10.5? I was determined to get in running tonight and after about 4 hours I was able to get in installed but keep getting this error after logging in. Im sure there is another error around the corner but this is the current one. :)

    Cannot parse database connection data from '', probably the connection data, zend_monitor.events_db directive in the zend.ini file, is invalid.

    Specs:
    Macbook Pro
    MAMP Pro
    Zend Platform 3.0.3
    Zend Studio 5.5

    From what I read Zend Platform installs its own mysql to monitor the local mysql server. Not 100% sure why but at the moment that is my hang up.

    Any advise or links would be greatly appreciated.

    Source: http://community.livejournal.com/php/610534.html

  • One more thing! Need help with a timestamp

    Date: 01/15/08     Keywords: no keywords

    I just need to have a timestamp when someone posts on my husband's football site. (Like how a guestbook has one.) Here's the code I am using for the site where all results are posted, but the time posts the same for every submission.



    mysql_connect("server", "username", "pw") or die("Error: ".mysql_error());
    mysql_select_db("eric") or die("Error: ".mysql_error());
    extract($_POST); 
    $query = "
    INSERT INTO 
       `zones`
    (name, email, game_one)
        VALUES
    ('$name', '$email', '$game_one')";
     
    $insert = mysql_query($query) or die(mysql_error());
    ?>
    mysql_connect("server", "username", "pw") or die("Error: ".mysql_error());
    mysql_select_db("eric") or die("Error: ".mysql_error()); 
    $query = "SELECT * FROM `zones`";
    $result = mysql_query($query);
    while($__row = mysql_fetch_assoc($result)){
        
        echo $__row['name']."
    ";
        echo $__row['email']."
    ";    
        echo $__row['game_one']."
    ";
        echo $today = "Submitted on" ."
    ".date("D M j G:i:s T Y")."

    ";
    }
    ?>



    What do I need to do to change that? Put it on the form before the Submit button?

    Source: http://community.livejournal.com/php/610054.html

  • double posting

    Date: 01/15/08     Keywords: browser

    What is the best way to prevent double posting when submitting a form.

    I have a form, and when someone clicks the submit button then refreshes the browser it double posts.
    I don't like throwing the post to another page, then a "Thanks for posting" as output. I like to keep it clean and simple and in one script.



    Thanks,

    Source: http://community.livejournal.com/php/610000.html

  • Newbie here needs help with having everyone's form answers on one page.

    Date: 01/14/08     Keywords: php

    Hi there!
    I am really new to php, but I want to help my husband have a site where his football friends fill out a form and that form posts all their results on one page. I have the form and the results page, but I can't get each person's results on the same page. Here's the site:

    http://twilight-angel.net/vikings
    Click on NFL Pool Picks to see what I'm talking about. Here's the code I am using for the top part:


    Name:

    Email:

    Week One Game One:






    And here is my results page:


    Name:

    Email:

    Game One Pick:







    Someone tried to help me by having me make a table to put the info in, so I did. But now the coding is all messed up and nothing works! He told me to make a file called createTable.php with this coding:


    And then add this to it to insert the data to the table:
    ";
    }


    If someone could just post exactly what I need on each page and let me know what to title it, it would make my life so much easier. I get confused so easily.

    I'd really appreciate any help! Thank you.

    Source: http://community.livejournal.com/php/609420.html

    1. The Future Of Social Networking

      Date: 02/22/08     Keywords: no keywords

      THE FUTURE OF SOCIAL NETWORKING

      0. Introduction.

      Almost three years ago, I started the Appleseed Project as a way to start experimenting with the idea of distributed social networking. Armed with enough hubris and naivete to think I could build it alone, I coded and coded until I got to the point I am now: With a project that stands at around 75% complete, it functions as a sort of proof-of-concept for distributed social networking in general. I've learned a lot, however, about the technological hurdles and impact that a truly open and distributed social networking platform could provide.

      I'm writing this as a way to present my ideas and what I've learned in the hopes that an open and distributed solution becomes the direction that social networking takes. Although I would be happiest to see Appleseed succeed, I'd be excited to see any open and distributed social networking solution be adopted and replace the walled gardens that currently dot the internet landscape.

      Read More

      (note: please digg this up if you have a digg.com account!)

      Source: http://community.livejournal.com/php/614891.html

    2. hosting question

      Date: 02/21/08     Keywords: php, mysql, database, sql, hosting

      i have a new client that moved their site from a good but expensive hosting company to a not so good but inexpensive one. the reason was just price. the expensive one was $300 a month, the inexpensive $100 a year. their site is written in php with a mysql database. they are using about 7.5 megs of their database. the problem, of course, is performance: response is ridiculously slow, they are having form problems, et al. now my question. does anyone here know of any decently good hosting companies that i could recommend to my client? they need a switch, but i don't think they want to go back to the one that is $300 a month. usually i deal with very small sites, so i don't know any myself that can manage all this data. thanks for any help you guys can provide, this community is great :o)

      Source: http://community.livejournal.com/php/614413.html

    3. Comparing Data

      Date: 02/17/08     Keywords: database

      I have two arrays. one is data from a database, one is data from a form. If the data in the two arrays are the same, meaning no changes were made to the form, then I want to know so that a database update is not needed. If the data are different, then I want to not only update the database, but mark the time and date of the new update.

      Here's what I've come up with:
      $difference=array_diff($formdata, $dbdata);
      $num_diff=count($difference);
      if ($num_diff!=0){ update Database & set new date_updated }

      Might there be a more elegant way to do this?

      Source: http://community.livejournal.com/php/614320.html

    4. Freelancing

      Date: 02/17/08     Keywords: php, programming

      What sites do you recommend when looking for freelance programming jobs, especially php jobs?

      Source: http://community.livejournal.com/php/613901.html

    5. PHP Categories?

      Date: 02/16/08     Keywords: php, web

      Question. I'm trying to make a website. I already have the PHP for the header, footer, etc. I'm trying to find the script that involves making like categories for the pages. An example is THIS SITE. When you click on her links in the center, the URL becomes:

      http://sawyoucry.net/you-download.php?page=brush

      How do I go about of doing this? I hope this makes sense.

      Source: http://community.livejournal.com/php/613706.html

    6. breadcrumbs

      Date: 02/14/08     Keywords: browser, web, yahoo

      Hi.. I have to add breadcrumbs to my company's... My first thought is to write a script that will create the links dynamically.

      Do you guys have any experience or input regarding implementing a breadcrumb script/solution before I get started?

      Thanks

      For reference: Breadcrumbs

      "There are 3 types: path, attribute, and location. The location breadcrumb is the one most commonly seen. It is a visual display or a page's location within a site. For example, Yahoo! uses location breadcrumbs when it shows you that the page you are on is categorized:

      Health>Children>Bed Wetting>Treatment>Cleaning Up

      With this, users can see where the page they are on is located in the hierarchy of the site. A 2003 study by Rogers and Chaparro reported is Usability News asked the big question: does Breadcrumb navigation positively affect a user's experience?

      There has only been limited research on breadcrumb navigation. However, the studies that have been performed have shown that breadcrumb navigation makes site navigation simpler and more efficient (Bowler, et al. 2001; Maldaonado & Resnick, 2002). In 2003 Bonnie Lida, Spring Hull, and Katie Pilcher examined if study participants would use breadcrumb navigation when given the task of finding several items on a website. They also studied what other methods the subjects chose to use, such as the browser back button or search fields. They hypothesized that breadcrumb navigation was more useful for browsing than for searching for specific terms."

      article

      Source: http://community.livejournal.com/php/613206.html

    7. nl2br and strip_tags

      Date: 02/13/08     Keywords: php, yahoo

      i'm still fairly new to php, so this questions may be pretty obvious.

      i'm trying to allow strong, em, and a tags to pass through, but i also want to keep the breaks. all is fine with strong and em, but a's attributes show through. when i get rid of nl2br, everything works, but then i lose my breaks. here is my code:

      $post = strip_tags($post, '');
      $post = nl2br($post);

      the link looks like this when it outputs:

      href="
      http://www.yahoo.com">click here

      a is missing, but the href shows through. link hovers, but of course, it doesn't take you anywhere.

      thanks in advance!

      Source: http://community.livejournal.com/php/612909.html

    8. PHP and Java/J2EE

      Date: 02/12/08     Keywords: php, java

      Hey, I was wondering if you could recommend some sites/books on learning Java for PHP programmers. I have 2 years of professional exp in PHP but I see a lot of job ads for Java/J2EE developers and I want to add it to my resume. Any help is appreciated. Thanks!

      Source: http://community.livejournal.com/php/612806.html

    9. Form-Generated Image..?

      Date: 02/11/08     Keywords: php, google

      Hello; I'm new to this comm and fairly new to php. I'm very sorry if this is a ridiculously stupid question, but I'm not sure where to start with this (and Google/PHP's help articles are no use).

      I basically just want to create something like this - where you fill in a form and an image is generated based on your responses/entries. (Although I'd like to do one mimicking a Facebook profile, since Livejournal refuses to allow div/style commands on user bios.)

      I promise I'm not a simpleton and I'm not asking to be walked through the whole thing - just an idea where to start (some sample code would be marvellous) would be lovely.

      Thank you very much in advance!

      Source: http://community.livejournal.com/php/612563.html

    10. low-cost logging?

      Date: 02/11/08     Keywords: no keywords

      I've been trying to find a low-cost (memory/time) way of logging application events/data and the one idea that came to me was using something like
      file_get_contents("http://inside.my.network.local/logthis/?u=unixTimestamp&i=machineID&l=levelCode&m=escapedMessage&uid=userID")  that way I could use a python server built just to handle message logging.  My only thought, is there a better (non-blocking) way, perhaps with curl, embedding all the data as Post instead of Get variables and setting the timeout to something low like 5MS max.

      Source: http://community.livejournal.com/php/612144.html

    11. Looping through data, creating table

      Date: 02/08/08     Keywords: php, html

      A client needs a table of data displayed as follows:



         
         
         


         
         
         


         
         
         



         
         
         


         
         
         


         
         
         

      Title 1Title 2Title 3
      image 1image 2image 3
      Desc 1Desc 2Desc 3
      Title 4Title 5Title 6
      image 4image 5image 6
      Desc 4Desc 5Desc 6


      The data is stored in an array, so I am looping through results.  How do I create a table with this exact layout?  The key is the title, image and desc need to be level on each row.  The client did not like everything put in one cell, since the images & titles were different sizes & lengths. 

      I was using this

          foreach ($array_clips as $clip => $data)
          {
              if ($c==0)
              {
                  $html .= "

                   

    $title
                   

          
                   

    $description
                   

    Previous page  ||  Next page


    antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home