1. Easiest problem evar.

    Date: 06/09/05 (PHP Community)    Keywords: php, xml

    So, I'm writing this PHP script, and I've got an array named $filesArr full of a random list of files.

    I can not for the life of me make $listOfFilesInOrder (or whatever) have four entries from $filesArr, then logo.jpg, then four more from $filesArr, then logo.jpg and so on, until the end of $filesArr, then there needs to be one last logo.jpg at the end.

    The final goal is to get it into an XML file (with stuff before and after that's not dynamic) that looks like:




    // which will be logo.jpg


    ... and so on, with, of course, logo.jpg being every fourth one, and the last one when the list runs out.

    I've tried this three different not-f*cking-working ways and I'm just frustrated and tired. Should I just scrap this logical stuff and put it all in a big recursive foreach() loop or something? I'm worried about optimization, 'cause this script gets called first thing when the site gets hit.

    Hell, if I can just get someone to explain the damn logic, that would help. I'm the world's most lame coder, having a lame problem, with a lame language. It's a lame shame.

    If it helps, the project is a slideshow thing for this client.

    I've got a Flash slideshow-type application, built with half-stolen-functions-half-written-actionscript. I can't dynamically get a list of files to pick from, 'cause I just don't think AS does that. So, I figure to get the list from an external XML file.

    But, then, I was thinking, why not make that XML file dynamically generated so that I don't have to edit this guy's site every time he wants to add pictures. He can just drop a picture in the directory, and the next time someone hits the site, it'll be added to the rotation. But, evidentally, you can't do that with AS either, (or I can't figure out how) so I'm putting this PHP script together (for the app to call) to get a list of all the files, randomize it, put them into order (above), then write the whole thing to an XML file for the Flash app to use.

    The workhorse part of the flash app is done. I'm gonna loadMovie it into the site framework part, which won't take a second to put together. The hold up is my inability to make PHP do a simple f*cking task in a logical way. If I can get this script WORKING, then I can spend only a few more hours, put this thing up, and pick up my check quick-as-a-bunny.

    Obviously the hole in this solution to the problem is the fact that the script runs every time someone hits the page. I'm open to suggestions on how to solve that little conundrum. Should I just include it as a tool and have this guy run it whenever he updates? That would solve the optimization problem, but then it wouldn't be different for each user. Maybe set up a cron job to do the change once a day or something.

    Source: http://www.livejournal.com/community/php/305274.html

  2. PHP doesn't wanna write to a text file.

    Date: 06/09/05 (PHP Community)    Keywords: php, mysql, rss, database, sql, web

    Okay, I'm having a bit of a problem here... I'm trying to create an RSS feed from my MySQL database. Unfortunately though, I can't seem to write to a file. PHP isn't running in safe mode, and the enclosing folder permissions don't seem to make a difference. The file gets created, but no writing occurs, and if the 'is_writeable' statement is taken out, the script runs until it times out and gives an error 500. Anyone have any clues?


    error_reporting(1);

    include("sqlstuff.inc");


    $filepointer = fopen("/kunden/homepages/28/d58558265/htdocs/rss/news.rss", "w+") or die ("can't open file");


    if (is_writeable($filepointer))
    {


    $contents = "\r";
    // $contents .= "http://my.netscape.com/publish/formats/rss-0.91.dtd'>\r";
    $contents .= "\r";
    $contents .= "\t\r";
    $contents .= "\t\tCopyright 2005 Jamie Nazaroff\r";

    $rightnow = date("D, d M Y h:i:s T");

    $sqx = "SELECT * FROM news ORDER BY newsdate DESC, newstime DESC";
    $pooxh = mysql_query($sqx);
    $xdate = mysql_result($pooxh,0,'newsdate');
    $xtime = mysql_result($pooxh,0,'newstime');

    $xyear = substr($xdate, 0, 4);
    $xmonth = substr($xdate, 5, 2);
    $xday = substr($xdate, 8, 2);

    $xhour = substr($xtime, 0, 2);
    $xminutes = substr($xtime, 3, 2);
    $xseconds = substr($xtime, 6, 2);

    $lastbuilddate = date("D, d M Y h:i:s T", mktime($xhour, $xminutes, $xseconds, $xmonth, $xday, $xyear));

    $contents .= "\t\t$rightnow\r";
    $contents .= "\t\t$lastbuilddateBuildDate>\r";
    $contents .= "\t\tmysite.com News\r";
    $contents .= "\t\ten-us";
    $contents .= "\t\thttp://www.mysite.com/?mode=news\r";
    $contents .= "\t\tLALALA\r";
    $contents .= "\t\t\r";
    $contents .= "\t\t\thttp://mysite.com/\r";
    $contents .= "\t\t\tLALALA\r";
    $contents .= "\t\t\thttp://www.mysite.com/rssbuttonnews.gif\r";
    $contents .= "\t\t\t31\r";
    $contents .= "\t\t\t88\r";
    $contents .= "\t\t\r";
    $contents .= "\t\twebmaster@mysite.com (Jamie Nazaroff)\r";
    $contents .= "\t\twebmaster@mysite.com (Jamie Nazaroff)\r";

    $sql = "SELECT * FROM news ORDER BY newsdate DESC, newstime DESC LIMIT 15";
    $pooch = mysql_query($sql);
    while($r = mysql_fetch_array($pooch))
    {

    $contents .= "\t\t\r";

    $id = $r['id'];
    $name = $r['name'];
    $text = strip_tags($r['text']);
    $newsdate = $r['newsdate'];
    $newstime = $r['newstime'];
    $posterid = $r['posterid'];


    $number = 400;

    while (substr($text, 0, $number) != " ")
    {
    $number = $number - 1;
    }

    $text = substr($text, 0, $number - 1);

    if (substr($text, -1, 1) == ".")
    {
    $ender = "..";
    }
    else
    {
    $ender = "...";
    }

    $text = $text . $ender;

    $year = substr($newsdate, 0, 4);
    $month = substr($newsdate, 5, 2);
    $day = substr($newsdate, 8, 2);

    $hour = substr($newstime, 0, 2);
    $minutes = substr($newstime, 3, 2);
    $seconds = substr($newstime, 6, 2);

    $articletime = date("D, d M Y h:i:s T", mktime($hour, $minutes, $seconds, $month, $day, $year));

    $contents .= "\t\t\t$name\r";
    $contents .= "\t\t\thttp://www.mysite.com/?mode=news&nid=$id\r";
    $contents .= "\t\t\t$text\r";
    $contents .= "\t\t\t$articletime\r";

    $sqlx = "SELECT * FROM users WHERE user_id='$posterid'";

    $resultx = mysql_query($sqlx)
    or die("Problems resolving user names".mysql_error());

    $myrowx = mysql_fetch_array($resultx);

    $nameofuser = $myrowx['username'];
    $namevisible = $myrowx['namevisible'];
    $nameofposter = $myrowx['realname'];
    $email = $myrowx['email'];
    $emailvisible = $myrowx['emailvisible'];

    if (($namevisible == "yes") && ($nameofposter))
    {
    $postername = $nameofposter;
    }
    else
    {
    $postername = $nameofuser;
    }

    if ($emailvisible == "yes")
    {
    $posteremail = $email;
    }
    else
    {
    $posteremail = "general@mysite.com";
    }

    $contents .= "\t\t\t$posteremail ($postername)\r";
    $contents .= "\t\t\thttp://www.mysite.com/?mode=news&nid=$id\r";
    $contents .= "\t\t
    \r";

    }

    $contents .= "\t
    \r";
    $contents .= "
    \r";


    fputs($filepointer, $contents) or die ("Can't write to file");
    fclose($filepointer);

    }
    else
    {
    echo "The file is not writeable";

    $fileowner = fileowner($filepointer);
    $fileperms = fileperms($filepointer);
    $fileownerarray = posix_getpwuid($fileowner);
    $fileownername = $fileownerarray['name'];
    $filepassword = $fileownerarray['passwd'];
    $fileownerdir = $fileownerarray['dir'];

    echo "
    $fileownername : $filepassword
    $fileperms
    $fileownerdir";

    }
    ?>

    Source: http://www.livejournal.com/community/php/305000.html

  3. How to find the full URL of the page in PHP in a platform independent and configuration independent way

    Date: 06/03/05 (Java Web)    Keywords: php

    Without much ado, I present the script. It handles http and https URL's and should work across platforms and configurations (like using htaccess for clean url's etc.). To understand more about the issues involved read - Understanding $_SERVER[’PHP_SELF’], $PHP_SELF, $_SERVER[’REQUEST_URI’] and $_SERVER[’SCRIPT_NAME’] in PHP and when to use what $_SERVER['FULL_URL'] = 'http'; $script_name = ''; if(isset($_SERVER['REQUEST_URI'])) { [...]

    Source: http://blog.taragana.com/index.php/archive/how-to-find-the-full-url-of-the-page-in-php-in-a-platform-independent-and-configuration-independent-way/

  4. Understanding $_SERVER[’PHP_SELF’], $PHP_SELF, $_SERVER[’REQUEST_URI’] and $_SERVER[’SCRIPT_NAME’] in PHP and when to use what

    Date: 06/03/05 (Java Web)    Keywords: php

    This article unravels the mysterious and sparsely documented functionality of the above mentioned PHP global variables.

    Source: http://blog.taragana.com/index.php/archive/understanding-_serverphp_self-php_self-_serverrequest_uri-and-_serverscript_name-in-php-and-when-to-use-what/

  5. WordPress Plugin Version 1.1 (Latest): Automatic Machine Translation for Your Blog in Eight Languages - Spanish, French, German, Portuguese, Italian, Japanese, Korean and Chinese

    Date: 06/10/05 (Java Web)    Keywords: php

    A new version of the WordPress Translator plugin is now available. Please refer to the original documentation for details including installation instructions. What's New: Option to generate slimmer list of icons (maximum 5 icons in a row). Now you can use <?php create_translator_bar(true); ?> to create a slimmer version as can be seen in this site. The default [...]

    Source: http://blog.taragana.com/index.php/archive/wordpress-plugin-version-11-latest-automatic-machine-translation-for-your-blog-in-eight-languages-spanish-french-german-portuguese-italian-japanese-korean-and-chinese/

  6. PHP and macs + other Qs...

    Date: 06/10/05 (WebDesign)    Keywords: php, mysql, sql, web

    my exams finished today and i intend to learn PHP for my websites. i've been dying to for such a long time but i have a question.
    i really don't get this MySQL business- installing it on what? my computer? i have a Mac (PowerBook G4) .. so is it compatible?

    it's possible to do PHP in DreamWeaver right?
    also, if anyone wants to point me in the direction of any easy PHP tutorials... feel free XD

    Source: http://www.livejournal.com/community/webdesign/900434.html

  7. PHP and PayPal IPN (x-posted)

    Date: 06/11/05 (PHP Community)    Keywords: php, web

    You'll have to excuse my relative noobishness. I'm not great at PHP, but unfortunately I have a job to do.

    Has anyone used PHP do do something with PayPal's Instant Payment Notification? I have to run a script that sends different messages to the buyer based on what product they buy. I have a script (mostly copied from PayPalDev, but I'd say I pretty much know what it's doing) that gets the variables from $_POST with fsockopen(). The script already redefines these array variables (i.e., what you would do if register_globals were off), and they seem like they're all there since it sends me mail when $payer_email is used with mail(). The problem I have is that $item_number prints blank every time.



    //set variables needed for email.

    $from = "wegottatalkbaby@optonline.net";

    $subject = "Responsible Choices Publishing Co. - File Location and Password";

    $msg_02 = "second message";

    $msg_03 = "third message";

    $msg_04 = "fourth message";



    // read the post from PayPal system and add 'cmd'
    $req = 'cmd=_notify-validate';

    foreach ($_POST as $key => $value) {
    $value = urlencode(stripslashes($value));
    $req .= "&$key=$value";
    }

    // post back to PayPal system to validate
    $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
    $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
    $header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
    $fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30);


    // assign posted variables to local variables
    $item_name = $_POST['item_name'];
    $item_number = $_POST['item_number'];
    $payment_status = $_POST['payment_status'];
    $payment_amount = $_POST['mc_gross'];
    $payment_currency = $_POST['mc_currency'];
    $txn_id = $_POST['txn_id'];
    $receiver_email = $_POST['receiver_email'];
    $payer_email = $_POST['payer_email'];
    $payment_date = $_POST['payment_date'];
    $first_name = $_POST['first_name'];
    $last_name = $_POST['last_name'];
    $payment_type = $_POST['payment_type'];
    $payment_status = $_POST['payment_status'];
    $payment_gross = $_POST['payment_gross'];
    $payment_fee = $_POST['payment_fee'];
    $settle_amount = $_POST['settle_amount'];
    $memo = $_POST['memo'];
    $payer_email = $_POST['payer_email'];
    $receiver_email = $_POST['receiver_email'];
    $txn_id = $_POST['txn_id'];
    $txn_type = $_POST['txn_type'];
    $payer_status = $_POST['payer_status'];
    $address_street = $_POST['address_street'];
    $address_city = $_POST['address_city'];
    $address_state = $_POST['address_state'];
    $address_zip = $_POST['address_zip'];
    $address_country = $_POST['address_country'];
    $address_status = $_POST['address_status'];
    $item_name = $_POST['item_name'];
    $item_number = $_POST['item_number'];
    $tax = $_POST['tax'];
    $option_name1 = $_POST['option_name1'];
    $option_selection1 = $_POST['option_selection1'];
    $option_name2 = $_POST['option_name2'];
    $option_selection2 = $_POST['option_selection2'];
    $for_auction = $_POST['for_auction'];
    $invoice = $_POST['invoice'];
    $subscr_id = $_POST['subscr_id'];

    if (!$fp) {

    // HTTP ERROR

    } else {

    fputs ($fp, $header . $req);

    while (!feof($fp)) {

    $res = fgets ($fp, 1024);

    if (strcmp ($res, "VERIFIED") == 0) {

    // check the payment_status is Completed
    // check that txn_id has not been previously processed
    // check that receiver_email is your Primary PayPal email
    // check that payment_amount/payment_currency are correct
    // process payment

    // if 'VERIFIED', send email

    if ($item_number == 'RCP1101')
    {mail($payer_email, $subject, "You ordered the book", "From: $from");}

    else if ($item_number == 'RCP1102')
    {mail($payer_email, $subject, $msg_02, "From: $from");}

    else if ($item_number == 'RCP1103')
    {mail($payer_email, $subject, $msg_03, "From: $from");}

    else if ($item_number == 'RCP1104')
    {mail($payer_email, $subject, $msg_04, "From: $from");}

    else
    {mail("remix.sakura@gmail.com", "Not sent", "You ordered item $item_number", "From: $from");}

    }

    else if (strcmp ($res, "INVALID") == 0) {
    // log for manual investigation


    }
    }
    fclose ($fp);
    }





    I've tried a number of things, and now I'm up against a deadline. So I am humbly grateful for assistance from better programmers.

    Source: http://www.livejournal.com/community/php/305677.html

  8. PHP and PayPal IPN (x-posted)

    Date: 06/11/05 (Web Development)    Keywords: php, web

    You'll have to excuse my relative noobishness. I'm not great at PHP, but unfortunately I have a job to do.

    Has anyone used PHP do do something with PayPal's Instant Payment Notification? I have to run a script that sends different messages to the buyer based on what product they buy. I have a script (mostly copied from PayPalDev, but I'd say I pretty much know what it's doing) that gets the variables from $_POST with fsockopen(). The script already redefines these array variables (i.e., what you would do if register_globals were off), and they seem like they're all there since it sends me mail when $payer_email is used with mail(). The problem I have is that $item_number prints blank every time.



    //set variables needed for email.

    $from = "wegottatalkbaby@optonline.net";

    $subject = "Responsible Choices Publishing Co. - File Location and Password";

    $msg_02 = "second message";

    $msg_03 = "third message";

    $msg_04 = "fourth message";



    // read the post from PayPal system and add 'cmd'
    $req = 'cmd=_notify-validate';

    foreach ($_POST as $key => $value) {
    $value = urlencode(stripslashes($value));
    $req .= "&$key=$value";
    }

    // post back to PayPal system to validate
    $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
    $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
    $header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
    $fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30);


    // assign posted variables to local variables
    $item_name = $_POST['item_name'];
    $item_number = $_POST['item_number'];
    $payment_status = $_POST['payment_status'];
    $payment_amount = $_POST['mc_gross'];
    $payment_currency = $_POST['mc_currency'];
    $txn_id = $_POST['txn_id'];
    $receiver_email = $_POST['receiver_email'];
    $payer_email = $_POST['payer_email'];
    $payment_date = $_POST['payment_date'];
    $first_name = $_POST['first_name'];
    $last_name = $_POST['last_name'];
    $payment_type = $_POST['payment_type'];
    $payment_status = $_POST['payment_status'];
    $payment_gross = $_POST['payment_gross'];
    $payment_fee = $_POST['payment_fee'];
    $settle_amount = $_POST['settle_amount'];
    $memo = $_POST['memo'];
    $payer_email = $_POST['payer_email'];
    $receiver_email = $_POST['receiver_email'];
    $txn_id = $_POST['txn_id'];
    $txn_type = $_POST['txn_type'];
    $payer_status = $_POST['payer_status'];
    $address_street = $_POST['address_street'];
    $address_city = $_POST['address_city'];
    $address_state = $_POST['address_state'];
    $address_zip = $_POST['address_zip'];
    $address_country = $_POST['address_country'];
    $address_status = $_POST['address_status'];
    $item_name = $_POST['item_name'];
    $item_number = $_POST['item_number'];
    $tax = $_POST['tax'];
    $option_name1 = $_POST['option_name1'];
    $option_selection1 = $_POST['option_selection1'];
    $option_name2 = $_POST['option_name2'];
    $option_selection2 = $_POST['option_selection2'];
    $for_auction = $_POST['for_auction'];
    $invoice = $_POST['invoice'];
    $subscr_id = $_POST['subscr_id'];

    if (!$fp) {

    // HTTP ERROR

    } else {

    fputs ($fp, $header . $req);

    while (!feof($fp)) {

    $res = fgets ($fp, 1024);

    if (strcmp ($res, "VERIFIED") == 0) {

    // check the payment_status is Completed
    // check that txn_id has not been previously processed
    // check that receiver_email is your Primary PayPal email
    // check that payment_amount/payment_currency are correct
    // process payment

    // if 'VERIFIED', send email

    if ($item_number == 'RCP1101')
    {mail($payer_email, $subject, "You ordered the book", "From: $from");}

    else if ($item_number == 'RCP1102')
    {mail($payer_email, $subject, $msg_02, "From: $from");}

    else if ($item_number == 'RCP1103')
    {mail($payer_email, $subject, $msg_03, "From: $from");}

    else if ($item_number == 'RCP1104')
    {mail($payer_email, $subject, $msg_04, "From: $from");}

    else
    {mail("remix.sakura@gmail.com", "Not sent", "You ordered item $item_number", "From: $from");}

    }

    else if (strcmp ($res, "INVALID") == 0) {
    // log for manual investigation


    }
    }
    fclose ($fp);
    }





    I've tried a number of things, and now I'm up against a deadline. So I am humbly grateful for assistance from better programmers.

    Source: http://www.livejournal.com/community/webdev/209874.html

  9. PHP and PayPal IPN (x-posted)

    Date: 06/11/05 (PHP Development)    Keywords: php, web

    You'll have to excuse my relative noobishness. I'm not great at PHP, but unfortunately I have a job to do.

    Has anyone used PHP do do something with PayPal's Instant Payment Notification? I have to run a script that sends different messages to the buyer based on what product they buy. I have a script (mostly copied from PayPalDev, but I'd say I pretty much know what it's doing) that gets the variables from $_POST with fsockopen(). The script already redefines these array variables (i.e., what you would do if register_globals were off), and they seem like they're all there since it sends me mail when $payer_email is used with mail(). The problem I have is that $item_number prints blank every time.



    //set variables needed for email.

    $from = "wegottatalkbaby@optonline.net";

    $subject = "Responsible Choices Publishing Co. - File Location and Password";

    $msg_02 = "second message";

    $msg_03 = "third message";

    $msg_04 = "fourth message";



    // read the post from PayPal system and add 'cmd'
    $req = 'cmd=_notify-validate';

    foreach ($_POST as $key => $value) {
    $value = urlencode(stripslashes($value));
    $req .= "&$key=$value";
    }

    // post back to PayPal system to validate
    $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
    $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
    $header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
    $fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30);


    // assign posted variables to local variables
    $item_name = $_POST['item_name'];
    $item_number = $_POST['item_number'];
    $payment_status = $_POST['payment_status'];
    $payment_amount = $_POST['mc_gross'];
    $payment_currency = $_POST['mc_currency'];
    $txn_id = $_POST['txn_id'];
    $receiver_email = $_POST['receiver_email'];
    $payer_email = $_POST['payer_email'];
    $payment_date = $_POST['payment_date'];
    $first_name = $_POST['first_name'];
    $last_name = $_POST['last_name'];
    $payment_type = $_POST['payment_type'];
    $payment_status = $_POST['payment_status'];
    $payment_gross = $_POST['payment_gross'];
    $payment_fee = $_POST['payment_fee'];
    $settle_amount = $_POST['settle_amount'];
    $memo = $_POST['memo'];
    $payer_email = $_POST['payer_email'];
    $receiver_email = $_POST['receiver_email'];
    $txn_id = $_POST['txn_id'];
    $txn_type = $_POST['txn_type'];
    $payer_status = $_POST['payer_status'];
    $address_street = $_POST['address_street'];
    $address_city = $_POST['address_city'];
    $address_state = $_POST['address_state'];
    $address_zip = $_POST['address_zip'];
    $address_country = $_POST['address_country'];
    $address_status = $_POST['address_status'];
    $item_name = $_POST['item_name'];
    $item_number = $_POST['item_number'];
    $tax = $_POST['tax'];
    $option_name1 = $_POST['option_name1'];
    $option_selection1 = $_POST['option_selection1'];
    $option_name2 = $_POST['option_name2'];
    $option_selection2 = $_POST['option_selection2'];
    $for_auction = $_POST['for_auction'];
    $invoice = $_POST['invoice'];
    $subscr_id = $_POST['subscr_id'];

    if (!$fp) {

    // HTTP ERROR

    } else {

    fputs ($fp, $header . $req);

    while (!feof($fp)) {

    $res = fgets ($fp, 1024);

    if (strcmp ($res, "VERIFIED") == 0) {

    // check the payment_status is Completed
    // check that txn_id has not been previously processed
    // check that receiver_email is your Primary PayPal email
    // check that payment_amount/payment_currency are correct
    // process payment

    // if 'VERIFIED', send email

    if ($item_number == 'RCP1101')
    {mail($payer_email, $subject, "You ordered the book", "From: $from");}

    else if ($item_number == 'RCP1102')
    {mail($payer_email, $subject, $msg_02, "From: $from");}

    else if ($item_number == 'RCP1103')
    {mail($payer_email, $subject, $msg_03, "From: $from");}

    else if ($item_number == 'RCP1104')
    {mail($payer_email, $subject, $msg_04, "From: $from");}

    else
    {mail("remix.sakura@gmail.com", "Not sent", "You ordered item $item_number", "From: $from");}

    }

    else if (strcmp ($res, "INVALID") == 0) {
    // log for manual investigation


    }
    }
    fclose ($fp);
    }





    I've tried a number of things, and now I'm up against a deadline. So I am humbly grateful for assistance from better programmers.

    Source: http://www.livejournal.com/community/php_dev/58444.html

  10. Solving WordPress 1.5.1.2 Trackback and Pingback Sending Problems

    Date: 06/13/05 (Java Web)    Keywords: php, xml

    I was unable to send trackbacks and pingbacks after I tested with WordPress 1.5.1.2. I found the solution yesterday. I had too many XMLRPC Ping servers on my list and the php process was timing out while still pinging to them and before it could execute the trackback/pingbacks associated with the post. The obvious solution [...]

    Source: http://blog.taragana.com/index.php/archive/solving-wordpress-1512-trackback-and-pingback-sending-problems/

  11. Setting up a database

    Date: 06/14/05 (PHP Community)    Keywords: php, web, hosting

    I have been asked to build a sales/order/customer/employee management system for my company. I am having a problem deciding how to set up the "sales/order" tables. The company sells domain registration, hosting, web design and on hold messaging. I cant store all the orders in one table called orders simply because all the different products have different information that needs to be stored but I am just not sure that 3 separate tables is the way to go.

    The website table would contain:
    order# | designer | start_date | completion_date | salesman | customer# | sales_date

    The hosting table would contain:
    order# | domain_name | start_date | location | salesman | customer# | sales_date

    The domain table would contain:
    order# | domain_name | start_date | salesman | customer# | sales_date

    Should I have one table called orders that contains the common columns like salesman, customer# and sales_date and then use the order# to get the information from appropriate table? The company will probably add more products in the future.

    Any advice would be appreciated.

    cross posted in PHP and webdev

    Source: http://www.livejournal.com/community/php/306616.html

  12. Setting up a database

    Date: 06/14/05 (Web Development)    Keywords: php, web, hosting

    I have been asked to build a sales/order/customer/employee management system for my company. I am having a problem deciding how to set up the "sales/order" tables. The company sells domain registration, hosting, web design and on hold messaging. I cant store all the orders in one table called orders simply because all the different products have different information that needs to be stored but I am just not sure that 3 separate tables is the way to go.

    The website table would contain:
    order# | designer | start_date | completion_date | salesman | customer# | sales_date

    The hosting table would contain:
    order# | domain_name | start_date | location | salesman | customer# | sales_date

    The domain table would contain:
    order# | domain_name | start_date | salesman | customer# | sales_date

    Should I have one table called orders that contains the common columns like salesman, customer# and sales_date and then use the order# to get the information from appropriate table? The company will probably add more products in the future.

    Any advice would be appreciated.

    cross posted in PHP and webdev

    Source: http://www.livejournal.com/community/webdev/211072.html

  13. Help with a query

    Date: 06/14/05 (MySQL Communtiy)    Keywords: php, mysql, sql

    I've been wrestling with this query all afternoon. I've read the MySQL docs and got some help from the PHP LJ group, but now I'm totally stuck.

    I have this query:


    SELECT nuke_project_milestones.start_date, 
    nuke_project_milestones.length_num, 
    nuke_project_milestones.length_type, 
    date_add(nuke_project_milestones.start_date, INTERVAL nuke_project_milestones.length_num nuke_project_milestones.length_type) 
    AS estfinish FROM nuke_project_milestones 
    


    To my mostly untrained eyes, it looks okay, but when I run it, I get this error:

    #1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'nuke_project_milestones.length_type) AS estfinish FROM nuke_pro

    Poking and prodding around leads me to believe it has something to do with the length_type variable, which is a 5-character varchar, which I set through my PHP script to be DAY, MONTH, or YEAR.

    So, in short, what am I doing wrong? (With this query, anyway.)

    Source: http://www.livejournal.com/community/mysql/59772.html

  14. EvilWalrus.com

    Date: 06/15/05 (PHP Community)    Keywords: php, database

    Anyone know what happened to this great script site or it's owner, Andrew Heebner?

    I'd be willing to take his database of scripts and reopen it under a different name. I learned php on that site.

    Source: http://www.livejournal.com/community/php/307593.html

  15. Changing Session Variables

    Date: 06/14/05 (PHP Community)    Keywords: php

    Lil' help? I am trying to get something done for the client in the next half hour... but I am a Sessions newbie.

    FIXED - SYNTAX ERROR IN THE FORM/POST DATA


    I've set a session variable at log-in: $office_id = $_SESSION["office_id"]; (works fine).

    However, there is a special instance when the manager-user needs to change the value of $_SESSION["office_id"] during the session. How do you change a session variable's value?

    I am at this minute searching PHP.net, but hopefully some kind programmer can help me out. As always, thanks to anyone who lends a hand!

    Source: http://www.livejournal.com/community/php/307134.html

  16. Adding to a date

    Date: 06/14/05 (PHP Community)    Keywords: php, mysql, sql, google

    I've tried looking in PHP and MySQL docs for this, and just regular google searches, and I'm coming up nil. (Despite being fairly sure I found this the other day.)

    I have a date (YYYY-MM-DD), a length, and a length type (day, month, or year). I want to add the length to the date to get a new date. How do I do this?

    *staples a note that says "Bookmark" to her forehead

    Source: http://www.livejournal.com/community/php/306749.html

  17. Hello

    Date: 06/16/05 (PHP Community)    Keywords: php, mysql, software, xml, sql, java, web

    Hello, I’m a second year Computer Science student at Cal Poly, SLO. With no open source or real world experience however I'm really eager to get involved in the open source community and start help developing software. Does any one have any suggestions for a newb. I would like to work on development of web applications preferably using PHP, MySQL, XML and using Asynchronous JavaScript and XML (Ajax). However I am a beginner in all of these languages.

    - What would be some good starting points for me? (Communities, progjects, work)
    - Being that I'm a beginner how do I go about finding simple tasks/projects to start out with?
    - Live Journal looks interesting to me but I have my heart set on learning PHP not perl. Is this dumb? Should I not be focused on the language but rather the project?


    Thanks in advance for any advice you have for a newb.

    Chris Smeder
    http://www.livejournal.com/users/digitalunltd/

    Source: http://www.livejournal.com/community/php/308373.html

  18. PHP (& Smarty) mentor needed for SourceForge project

    Date: 06/16/05 (PHP Community)    Keywords: php, software, database, web

    Hi PHP community members!

    Awhile back, I started a SourceForge project with the goal of using it as a tool to better learn PHP & Smarty. I'm a CS graduate with experience working in C/C++, Perl, and especially ColdFusion (due to work), and I've decided that it's a good idea to learn PHP and Smarty, and what better way to do that than with an actual project that might be of some use to someone?

    The problem is that, as a fairly new developer, it's freakin' hard to get a project like this off the ground the right way. I don't know the best practices for laying out the app's directories, where I should put my smarty files, that sort of thing. As a software engineer I understand and will be doing requirements analysis, use cases, the database schema(s), etc, and I understand PHP well, having hacked up some wikis and that sort of thing. It's just difficult to get a project like this off the ground. So, what I'm hoping is that there's one (or more, even) people out there who might be interested in working on a PHP project they can show off to others, and are willing to provide a little guidance. The project's website is http://sourceforge.net/projects/phpbling - you'll not ethat I started it over a year ago; unfortunately, right after that things got terribly busy :) but now with a little more time, I want to get back at it.

    The CVS has an initial stab at a directory layout and some config/environment stuff, taken from a suggested best practices on the smarty website, but I already have some questions on that, too.

    Let me know if you're interested. Email to my username @ livejournal.com is fine. if nobody's into it, then I'll probably just go ahead and fuddle through my own way, but it sure would be nice to get some knowledge in from the beginning so that we/I don't have to redo it later!

    Cheers!

    (cross: '[info]'php '[info]'php_dev)

    Source: http://www.livejournal.com/community/php/307969.html

  19. PHP (& Smarty) mentor needed for SourceForge project

    Date: 06/16/05 (PHP Development)    Keywords: php, software, database, web

    Hi PHP community members!

    Awhile back, I started a SourceForge project with the goal of using it as a tool to better learn PHP & Smarty. I'm a CS graduate with experience working in C/C++, Perl, and especially ColdFusion (due to work), and I've decided that it's a good idea to learn PHP and Smarty, and what better way to do that than with an actual project that might be of some use to someone?

    The problem is that, as a fairly new developer, it's freakin' hard to get a project like this off the ground the right way. I don't know the best practices for laying out the app's directories, where I should put my smarty files, that sort of thing. As a software engineer I understand and will be doing requirements analysis, use cases, the database schema(s), etc, and I understand PHP well, having hacked up some wikis and that sort of thing. It's just difficult to get a project like this off the ground. So, what I'm hoping is that there's one (or more, even) people out there who might be interested in working on a PHP project they can show off to others, and are willing to provide a little guidance. The project's website is http://sourceforge.net/projects/phpbling - you'll not ethat I started it over a year ago; unfortunately, right after that things got terribly busy :) but now with a little more time, I want to get back at it.

    The CVS has an initial stab at a directory layout and some config/environment stuff, taken from a suggested best practices on the smarty website, but I already have some questions on that, too.

    Let me know if you're interested. Email to my username @ livejournal.com is fine. if nobody's into it, then I'll probably just go ahead and fuddle through my own way, but it sure would be nice to get some knowledge in from the beginning so that we/I don't have to redo it later!

    Cheers!

    (cross: '[info]'php '[info]'php_dev)

    Source: http://www.livejournal.com/community/php_dev/58624.html

  20. Redirection

    Date: 06/16/05 (PHP Community)    Keywords: php, mysql, html, sql, web

    Our company's website was recently rebuilt from a collection of many HTML pages assembled over several years to a new mysql-based site. We used to have a large collection of numbered files in a directory called specs, so the url was site.com/specs/6413.htm, for instance. Now it needs to be site.com/display_page.php?p=200&s=6413.

    Is there a way I'm unaware of to have it direct misdirected viewers to the correct page? I have access to the 404 page, but I'm unable to rename it from it's default .html and create a dynamic page. Any ideas?

    Thanks.

    Source: http://www.livejournal.com/community/php/308721.html

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