';
...etc


Until I thought this little guy up I've been stupidly sticking the same routine in manually each time. It's the little things I often overlook.

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

  • Two MySQL Questions.

    Date: 09/05/07     Keywords: mysql, sql

    1.) I'm trying to build a Query where you have condition 1 which is absolute (like foo = 'Bar') but then condition 2 which could have several options. This is how it looks:

    WHERE company_name = 'FOO' && entered_by = 'BOB' || entered_by = 'JOE' || entered_by = 'KAT'

    What it is 'supposed' to do is pull up any records with company name of FOO that were entered by BOB, JOE, or KAT. But instead it's just pulling up all records entered regardless of the company_name restriction. What am I doing wrong here?

    2.) Some of the company names use a & symbol which is wreaking havoc on the query. I've tried to use mysql_real_escape_string and addslashes but neither solve the problem; leaving a company name like R&F Cola reduced to a query search of R. How do I get MySQL to accept that the & is just part of the query?

    Thank you so much to anyone who helps. I'm sure I"m missing something easy; but those are usually the most annoying ones!

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

  • my brain hurts...

    Date: 09/04/07     Keywords: php

    You all are always a big help, so hopefully you won't mind my novice question... I've been searching through 2 books and the php.net site for the answer, but the problem is I'm not exactly sure what it is I'm searching for.

    This may make no sense, but here's my question:
    I'm trying to write a code that shows a default link when the page loads initially, but once the person has visited that default link and reloaded the page a new link will appear in place of the original.

    [ EDIT ]
    I'll try to rephrase. Basically, on the page there is an image and a link. I want the page to recognize, on refresh, that the link has already been visited so now it shows a new image and link. Is there a way to get the computer to return a true if the page has been visited and a false if it hasn't? (I'm helping a friend code this, so I can only explain it as best he explained it to me.)

    I'm guessing it involves a true false statement and an if else statement, but I'm not entirely sure how to phrase it or what it should be looking for in order to return either true or false.

    Can anyone help?

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

  • Help with DodosMail

    Date: 09/04/07     Keywords: php

    Hi! I'm in the process of installing DodosMail's form script in my site (that's clearly still in the making) and I had no problem with actually getting into the page.
    The only thing is, whenever I fill out the form to see if it sends the mail correctly, as soon as I click the "send" button, it opens Outlook for me to manually send the email. I'm guessing that's not how it should work, right?



    test.php file


    I haven't changed a single thing in the dodosmail.php file.



    Any help will be greatly appreciated ^_^

    Thank you!

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

  • Checkbox unchecked alert? - solved!

    Date: 09/03/07     Keywords: no keywords

    Hi there,

    I have a sign up form which is working perfectly except for one thing; no matter how I phrase it, I cannot get an alert to display when a checkbox is unchecked. The code works perfectly for the textboxes that use it, but the checkbox won't behave. Is there a fundamental difference I'm missing here?

    Here's two examples from the form; the company name part is working fine, but the terms simply won't register an alert.

    Company Name: (*) 
                    
                ">


    Please tick this box to confirm that you accept our terms and conditions.


    function ValidateSignupForm(x){
                if(x.company.value==""){
                    alert("");
                    x.company.focus();
                    return false;
                }   
                if(x.terms.value==""){
                    alert("You must agree to our terms and conditions in order to join.");
                    x.terms.focus();
                    return false;
                }


    Any thoughts would be greatly appreciated. Thank you in advance.

    Solved! Thanks to luminairex and cyclotron!

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

  • Memory profiling

    Date: 09/01/07     Keywords: php

      I am a big fan of the xdebug extension for development purposes, but it doesn't appear to have one thing I am looking for...which is a function or method of dumping the memory foot print of individual class instances and other structures of a script.  Specifically I am working on a proprietary framework in php 5 that out of the gate takes 1.8MB of memory per instance.  This just kind of spooks me.   I think one the bigger things taking up memory is the extensive use of output buffer and I've got some ideas of how to work around that...but before I make an experimental branch and start doing horrible things in the name of speed, I was hoping to be more informed.  Oddly enough, there doesn't seem to be any base functions to get back a real sizeof result.

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

  • PHP Install problems

    Date: 08/29/07     Keywords: php, mysql, html, sql, apache

    I've wrecked my setups enough times to be a pro at getting PHP, Apache, MySQL and Windows XP to all play together nicely. However, this time I'm running into a strange problem. I've got PHP 5.2.3 and Apache 2.0.59. Apache runs fine, PHP seems to run fine, phpinfo() shows everything as it should be. When I try to load anything that seems to have more than a single line in it, it doesn't look like it's parsing anything. I get a lot of broken bits of code showing on the screen. Things like '>' when used as operators are being parsed as HTML tags. These are scripts that ran fine on Sunday with Apache 1.0.3 and PHP 4.whatever. I'm having trouble deciphering exactly what it's doing or why, but it's obvious it's not working. I'm at an end here, for now. Anyone have any suggestions?

    EDIT: Found it after staring at a script for half an hour. Know what it was? From PHP.INI:

    short_open_tag = On

    That was set to off. Of course I'm lazy and never actually type to start a script, however, my editor sometimes puts that in for me, which is why some scripts worked. I'd read about this setting, but never thought it might apply to me.

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

  • PHP/AJAX Auto Suggest

    Date: 08/28/07     Keywords: php

    I'm using Timothy Groves' AJAX-based Auto Suggest script ( http://www.brandspankingnew.net ) on an in-house project, but am having some troubles (obviously). The default sample script offers fields for 'id', 'value', and 'info' which isn't so bad, but the project I'm working on is going to take one auto-suggest field, and fil in values for several texts. I'm not sure why, but I keep getting 'undefined' sets even though I'm parsing the variables.

    So all that longwinded explanation can be boiled down to:

    "I'm tring to have the PHP portion of this script parse more than 'id', 'info', and 'value' but the AJAX part keeps acting like it's all undefined. Please help me."

    This is all assuming you've used Timothy Groves' script before, as I imagine other scripts do it differently.

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

  • Another thing...

    Date: 08/23/07     Keywords: no keywords

    At what point do you sit back and look at your program and go "Hey, that class I made is way too big"?

    I ask for no particular reason other than to satisfy my own curiousity...

    *pretends like that's the truth*

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

  • Another quickie

    Date: 08/23/07     Keywords: php, mysql, sql

    Hello!

    Just another quick question from me to you.

    I simply need a little clarification on the mysql_insert_id() function that is available in PHP.

    The definition on PHP.net reads: "Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query." Is this ID the number that is created in a column I defined (with Auto increment enabled) or is this something else entirely?

    Say I have a table with two columns:
    Column 1 = id_num (auto increment)
    Column 2 = name

    I want to insert a new name into the table and let the value for id_num generate automatically. Easy, right? Can I then call the mysql_insert_id() function and have it return the value in the first column that was created, or does it return a value that mysql uses but nobody else would need?

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

  • Just a really quick question

    Date: 08/22/07     Keywords: no keywords

    Will unset() destroy all values in an array if I plug the array in there, or do I have to go through and unset the array 1 element at a time?

    :D

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

  • authorize.net?

    Date: 08/21/07     Keywords: html, web

    a client of mine (a politican) wants to be able to take donations using their authorize.net account, i've never done this before. :)

    i found this open-source script:
    http://napersolutions.com/aim_payment_bridge.html

    and it seems to do the trick just fine on my unix-based host, and is actually pretty well done (easy to edit) etc, but when i upload it to the client's host, which is windows-based (yeah, i know) it won't connect to the payment bridge.

    the script mentions this if you don't get a response from the host:

    // 1) You may not be https or a secure connection to Authoriznet (SSL)
    // 2) It could also mean that you are not using port 443, the port
    required by Authorizenet
    // 3) You may not have the proper version of CURL installed that support SSL
    // 4) Curl may not be initialized
    // 5) Also, Apple OSX Server has a preference in the Web Server that
    defaults to "enable
    // performance cache" and this seems to throw requests to other ports rather
    // than their default assigned ones. Disable "performance cache" and
    restart the Web server.

    i know #1 is correct because I'm using the shared ssl but i'm not sure about the others.

    the response from the client's host was less than helpful.

    --

    Unfortunatley we cannot offer any further advice on how to get
    authorize.net to work with our system.

    Our system does work with authorize.net, however what permissions/
    changes need to be done to get it to work, I cannot say.

    I can confirm thatcURL 7.95 is installed on the server as well as the
    port 443 is being used for the shared ssl. We are a Windows operating
    system network and so the Apple Server would not apply.

    You may wish to see if you need a ssl certificate that has the domain
    name on it to work with authorize.net.

    If you have any further questions, please feel free to contact us.


    --

    i'm pretty much at a loss here. any help/insights would be appreciated as i don't think this client will want to switch hosts.

    maybe an easier way to take donations?

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

  • I have a speed question….

    Date: 08/20/07     Keywords: php

    I’m writing a semi complicated (to me!) piece of code that will take input from a user (Form), and depending on what had been entered, do something with it.

    I’d like to put it all in a single page of code.

    So I thought I should use a switch statement(s) rather than a long complicated line of IF ELSE type statements.

    Does that sound like a good idea?

    Additionally….

    If the php code gets pretty long, is it OK to put all this into a single page? 
    Or will the page become slow to load?  
    (Worded another way---If the conditional returns a FALSE, does it skip to the next conditional, or read every line anyway?)

    Thank you!

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

  • php mail function logging

    Date: 08/17/07     Keywords: php

    We have a development server here, and we would like to be able to log all mail that is sent out (at the very least, To, From, Subject, and File Name and maybe the line number) because we have multiple people writing scripts. For the most part, any use of a custom function won't be helpful because there's still the issue of pre-made scripts that use mail(), and people who may not know about said function in the first place (and would help us in not having to code this in manually either)

    This is on a Windows box with mod_php, so any solution that doesn't require recompiling would be nice (and because those would be lost on upgrades to PHP if I forget to make said changes before hand).

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

  • Coding small

    Date: 08/17/07     Keywords: no keywords

    foreach ($dbReq['modules'] as $modName)
    {
        if (!extension_loaded($modName))
        {
            $badDb = true;
            break;
        }
    }

    Seems pretty simple right? But c'mon, SEVEN lines of code?

    Sorry, this won't do. Why should a whole seven lines be used up for something so simple? Really, the simple stuff should be as invisible as possible, right?

    In the end, some if statement checks for the value of $badDb, but I renamed $badDb to $x and did this:

    while ((list(,$mn) = each($db['modules'])) && !isset($x)) if (!extension_loaded($mn)) $x = 1;

    Not only does it do the same thing, but it's just one line of code and it works with E_ALL.

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

    1. Exceptions not caught

      Date: 09/14/07     Keywords: php, linux

      I'm experiencing a very strange issue one of my servers, and I can't seem to track it down - basic exception handling doesn't work.

      The following script:

      echo "Exception Test
      ";
      try {
        throw new Exception ("myException");
      } catch (Exception $e) {
        echo "Caught!";
      }

      Produces: Fatal error: Uncaught exception 'Exception' with message 'myException'...

      Any ideas? Is there some setting that might be screwed up somewhere? I'm using XAMPP on Linux, PHP 5.2.3.

      Thanks a bunch!!

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

    2. Post data into a link.

      Date: 09/11/07     Keywords: php

      I hope I can explain this properly.

      I would like to have a text box on a page with a login button. All the person does is type in a name and hit login.

      (Happens in the background is the person is sent to a personalized url based on their name.)

      Example I type in Tobi and it sends me to Reqsc.com/tobi/home

      Thats it no password authentication or anything like that just take the name and slap it into an url.

      Does anyone know of how to do this? language preferred is php

      Thanks for your time,

      Tobias

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

    3. Style Switching

      Date: 09/09/07     Keywords: php, css, html

      Hello, I have a small problem with understanding how the this style switcher doesn't work with more than two css layouts.


      It is simple:

      Before Html:

      < ?php
      $thestyle = $_GET['set'];
      if ($thestyle == "style1")
      {
      $thestyle = "style2";
      }
      else
      {
      $thestyle = "style1";
      }
      ? >

      In the head:
      < link rel="stylesheet" type="text/css" media="screen" href="< ?php echo($thestyle);? >.css" >

      In the html:
      < form name="jump" >
      < select name="menu" style="font-family:Verdana, Arial, Helvetica, sans-serif;color:#333333;background-color:#FFFFFF;text-decoration:none;font-size:8pt; width:150px;" >
      < option value="index.php?set=style1">gray< /option >
      < option value="index.php?set=style2">blue< /option >
      < /select >
      < input type="button" onClick="location=document.jump.menu.options[document.jump.menu.selectedIndex].value;" class="sebutton" value="GO" >
      < /form >

      If I try to add a third layout, it causes an error. What am I doing wrong? Appreciative of any help.

      Forget what I said. Still need help.

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

    4. .htaccess trouble

      Date: 09/09/07     Keywords: php

      I have this site I'm making, and the way I've taught myself to write pages the urls look like this.
      domain.com/home.php?user=user

      However the client I'm making the site for wants them to look like...
      domain.com/user/home
      domain.com/user/payments
      domain.com/user/settings
      etc..

      I know this is done by using the .htaccess file however, I'm not sure how it's done.

      Can anyone help?

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

    5. PHP property name case sensitivity

      Date: 09/06/07     Keywords: php

      Have object property names always been case-sensitive? If not, in what version did that change? I seem to remember it being different before, but maybe I'm remembering method names, which are still case-insensitive.

      A project I'm working on requires property names to be case-sensitive, and so I want to know whether that requirement makes my project depend on a minimum version of PHP.

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

    6. It's the simple things in life...

      Date: 09/06/07     Keywords: mysql, css, sql

      Most of you are probably already doing this. But you never know.

      Function to call to mark up table rows with CSS

      // odd_even
      	// marks up table rows odd or even
      	// returns string to echo
      function odd_even ($count) {
      	if ($count & 1) {
      		return ' class="odd" ';
      	} else {
      		return ' class="even" ';
      	}
      }
      

      And then...
      	$count = 0;
      		while ($row1 = mysql_fetch_array ($result1, MYSQL_ASSOC)) {
      			$count++;
      			echo '
    ** table row data **
    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