Jump to content

micah1701

Members
  • Posts

    613
  • Joined

  • Last visited

Posts posted by micah1701

  1. [quote]maybe the query itself is failing and it will send you an email with a clue[/quote]'

    Crayon Violent and Kenrbns, YOU WERE RIGHT!  I was looking at my error output the wrong way

    THANK YOU!!!!  :D

    yeah, I feel like an idiot. I was so sure it wasn't the query because I tested the page by running it straight from the browser (not using exec()) and added a mysql_error() line and it didn't report any errors.

    when I ran it from the browser, the page had no problems accessing my connection string information.
    I use include('configInfo.php');

    but when the site tried to run the file, it could needed a differnet path, IE:
    include('/www/htdocs/scripts/.../configInfo.php');

    I didn't realize this until you had me check for errors through the e-mail outtput.

    Problem solved.  Thanks!
  2. since the script is running in the background, I can't exactly echo or print error messages to the screen.

    what I have been doing is inserting a quick code to e-mail what I want outputted.

    in the previously posted code, I added:
    [code]$id = $_SERVER['argv'][1];

    mail("micah.murray@mywebsite.com","distribution script ran","the id passed was: $id");

    $getMessage = mysql_query("SELECT * FROM bulkMail WHERE id='$id'");
    $messageRow = mysql_fetch_array($getMessage);
    $subject = $messageRow['subject'];
    $message = $messageRow['body'];

    ....
    below is code that send my e-mail to all the users
    [/code]

    This sends me an e-mail with the message [quote]the id passed was: 7[/quote]

    So I know it passed the variable, but the rest of the script didn't work.

    then I did the same thing but moved my mail() script down a line to right after the query:
    [code]$id = $_SERVER['argv'][1];

    $getMessage = mysql_query("SELECT * FROM bulkMail WHERE id='$id'");

    mail("micah.murray@mywebsite.com","distribution script ran","the id passed was: $id");

    $messageRow = mysql_fetch_array($getMessage);
    $subject = $messageRow['subject'];
    $message = $messageRow['body'];

    ....
    below is code that send my e-mail to all the users
    [/code]

    After doing that, it wouldn't even send me my e-mail.  So it has to be that line w/ the query.
  3. [quote]I don't understand how the variable is passed, but you can't use it. What does this show you?

    Code:

    echo '<pre>', print_r($_SERVER, true), '</pre>';[/quote]

    the $_SERVER array passes:
    [code]Array
    (
        [PWD] => /var/www/html
        [JTOOLS_CONF_USER] => .jtools
        [JTOOLS_HOME] => /usr
        [LC_MESSAGES] => C
        [LD_PRELOAD] =>
        [HOSTNAME] => sd32.vds2000.com
        [LD_LIBRARY_PATH] => /lib:/usr/lib:/usr/local/lib:/usr/local/hostdir/lib
        [SPH_CONFIG] => /usr/local/hostdir/conf/hostdir.xml
        [LESSOPEN] => |/usr/bin/lesspipe.sh %s
        [ENV] => /root/.bashrc
        [USER] => root
        [LS_COLORS] => no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jpg=01;35:*.png=01;35:*.gif=01;35:*.bmp=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.png=01;35:*.mpg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:
        [MACHTYPE] => i386-redhat-linux-gnu
        [SPH_HOME] => /usr/local/hostdir
        [LC_ALL] => C
        [MAIL] => /var/spool/mail/root
        [INPUTRC] => /etc/inputrc
        [BASH_ENV] => /root/.bashrc
        [SPH_ACCOUNTS] => /sphera/accounts
        [LANG] => C
        [LC_NUMERIC] => C
        [LOGNAME] => root
        [SHLVL] => 7
        [JTOOLS_LOGLEVEL] => notice
        [LC_CTYPE] => C
        [_] => /bin/php
        [SHELL] => /bin/bash
        [HOSTTYPE] => i386
        [OSTYPE] => linux-gnu
        [HISTSIZE] => 1000
        [TERM] => xterm
        [HOME] => /root
        [PATH] => /sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
        [JTOOLS_CONF_SYS] => /etc/jtools
        [LC_MONETARY] => C
        [LC_COLLATE] => C
        [SPHERA_monitor] => xxxx
        [SPHERA_service] => xxxx
        [SPHERA_fifoPath] => xxxxxxxxxxxxxxxxxxxxxx
        [SPHERA_execName] => xxx
        [SPHERA_pIOr] => x
        [SPHERA_pIOw] => x
        [SPHERA_pNETr] => x
        [SPHERA_pNETw] => x
        [SPHERA_fd0] => xxxx
        [SPHERA_fd1] => xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        [SPHERA_fd2] => xxxxxxxxxxxxxxxxxxxxxxxxxx
        [SPHERA_fd4] => xxxxxxxxxxxxxxxxxxxxx
        [SPHERA_fd5] => xxxxxxxxxxxxxxxx
        [SPHERA_fd6] => xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        [SPHERA_fd7] => xxxxxx
        [SPHERA_fd15] => 
        [SPHERA_fd16] => xxxxxxxxxxxxxxxxxxxxxxxxxxx
        [SPHERA_fd17] => xxxxxxxxxxxxxxxxxxxxxx
        [SPHERA_config] => x
        [PHP_SELF] => /www/htdocs/newsletter/distribution.php
        [SCRIPT_NAME] => /www/htdocs/newsletter/distribution.php
        [SCRIPT_FILENAME] => /www/htdocs/newsletter/distribution.php
        [PATH_TRANSLATED] => /www/htdocs/newsletter/distribution.php
        [DOCUMENT_ROOT] =>
        [argv] => Array
            (
                [0] => /www/htdocs/newsletter/distribution.php
                [1] => 7
            )

        [argc] => 2
    )
    [/code]

    Note at the very bottom, argv[1] is the value 7.  That is the value I want in my query.

    my code in distribution.php is

    [code]$id = $_SERVER['argv'][1];

    $getMessage = mysql_query("SELECT * FROM bulkMail WHERE id='$id'") or die(mysql_error());
    $messageRow = mysql_fetch_array($getMessage);
    $subject = $messageRow['subject'];
    $message = $messageRow['body'];

    echo $subject."<br>";
    echo $message;
    [/code]

    its failing at $getMessage = mysql_query.....
    however, if I change the line that defines $id to an integer, ie:
    $id = 7;

    then, the script will work fine.
  4. This is what I have for the exact same application.
    you want to use  HTML chars, like 
    &gt; = > 
    &quot; =  "

    [code]     <table border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td>HTML Code: </td>
            <td><input name="textfield" type="text" size="30" value="&lt;img src=&quot;http://www.mysite.com/photos/<? echo $row['imageLocation'] ?>&quot;&gt;" onClick="this.focus(); this.select()" title="display image on sites like myspace or ebay"></td>
              </tr>
          <tr>
            <td>Forum Code: </td>
            <td><input name="textfield2" type="text" size="30" value="[IMG]http://www.mysite.com/photos/<? echo $row['imageLocation'] ?>[/IMG]" onClick="this.focus(); this.select()" title="display image in a forum using BBcode"></td>
                </tr>
          <tr>
            <td>HTML Link: </td>
            <td><input name="textfield3" type="text" size="30" value="&lt;a href=&quot;http://www.mysite.com/photos/<? echo $row['imageLocation'] ?>&quot;&gt;Click Here To View Image&lt;/a&gt;" onClick="this.focus(); this.select()" title="create an HTML hyperlink to the image for sites like myspace or ebay"></td>
                </tr>
              </table>[/code]

    this lets you click on the text field to auto highlight the code snippet too. kind of like photobucket
  5. I have a mass mailing program that lets a user write a e-mail message into a textbox and hit submit.  The script then saves the contents in a database and "forks" (sort of) using exec() to run the script that goes through each member in the database and send them the message.

    [code]$getID = mysql_query("SELECT MAX(id) AS id FROM bulkMail");
    $id = mysql_result($getID,0,0);

    //execute distribution script
    exec("php /www/htdocs/newsletter/distribution.php $id > /dev/null &");[/code]

    this allows the user to go about their life while the script in "distribution.php" runs the e-mail program and sends the message w/ the id of $id.

    On the distribution.php page, this $id is passed in array $_SERVER['argv'][1];

    The id IS BEING PASSED, if I use the script and have it output the passed variable, it shows it to me.  The problem is when I do this:[code]$getMessage = mysql_query("SELECT * FROM bulkMail WHERE id='$id'");[/code] The script wont work.

    if I overwrite $id to an integer of a known table row ($id=5;) the script works.
    but if I use the passed variable ($id= $_SERVER['argv'][1]) it doesn't work.

    What am I missing?  I'm pulling my hair out trying to figure this out.  ???
  6. So I have two arrays.
    the first lists the winners of a series of games:

    $winners = Array
    (
    [0] => New England
    [1] => Buffalo
    [2] => pittsburgh
    [3] => St. Louis
    )

    and the other is a person's guess of who will win

    $picks = Array
    (
    [0] => New England
    [1] => NY Giants
    [2] => Dallas
    [3] => St. Louis
    )

    What is the best way to compare the arrays to see how many guesses in $picks match the results in $winners

    if I had 1 pick, I could use in_array but I need to check each value in picks against the $winners array and determine a value for total matches. (ie, "2" in the example above)

    thoughts on the best way to do it?
    I always come up w/ hack jobs and make it 20 times more complicated then it needs to be.

    [EDIT]

    ok, well here's what I have:

    [code]
      foreach($picks as $pick){
      if(in_array($pick,$winners)){
       $total = $total + 1;
       }
      }
      echo "you got $total correct";
    [/code]

    I guess thats pretty simple if no one has a better idea.
  7. you want to use JavaScript and CSS - this should probably be moved to one of those forums.

    create a css styled box containing your message and give it a z-index (layer) property on top of the rest of your page and also set it's display property to "none"

    then, w/ javascript, onSubmit() when you are also getting rid of the button, change the display property back to "block" so it shows the box. whola!

    something like this:
    [code]
    <script>
    function message(){
    document.getElementById('messageBox').style.display = 'block';
    }
    </script>

    <style>
    #messageBox{
    z-index: 2;
    display: none;
    border: 1px #333333 solid;
    padding: 5px;
    }
    </style>

    <div id='messageBox'>
    Please wait while your form is being submitted.
    </div>

    <form action="" method="post" onSubmit="message()">
    <input type="submit" name="Submit" value="Submit">
    </form>
    [/code]
  8. Thanks for the well thought out comments guys.

    I will work over the next few days, when I have some down time, to make improvements to the page. Hopefully I can give more details in way thats clear and can be taken in quickly by the user.

    in response to one question, jumpline doesn't use plesk. but they do have a GUI - their system is based on software from [a href=\"http://www.sphera.com/prod-serv-server_virtualization.php\" target=\"_blank\"]sphera.com[/a].

    Its technically shared hosting, but you get a static IP address and your directory is isolated from the others on the server - giving you chroot access to run your site as if it were a dedicated server. All the access that most sites need at a much more affordable price.

    Thanks again guys. I'll bump this topic up when I get a chance to make improvements!
    _Micah
  9. i use the hosting services of Jumpline.com and also participate in their affiliate program where I get a comission for selling their hosting products. For a while I was just posting their ads on my other websites I host but then I got the idea to start actually advertising (with google adwords and whatnot).

    So i got the domain name [a href=\"http://www.getJumpline.com\" target=\"_blank\"]www.getJumpline.com[/a] which is basically just an ad to get people to click on the banner ad that takes them to jumpline.com so they can order hosting services and make me money.

    My goal is that one out of every few thousand hits will actually result in a sale, but first I need to make the single page ad atractive enough to get people to continue on to the site and buy the product.

    I know that I could just auto forward them to the site, but honestly, I don't feel that jumpline does a good enough job of promoting their services on their homepage so I want to really convince people that they are making a good decision before they even click the link.

    So, can you check out [a href=\"http://www.getjumpline.com\" target=\"_blank\"]getJumpline.com[/a] and tell me what I should do to make it better?

    thanks!

    (mods, I really am just looking for feedback, this is not a lame attempt to promote my website that is admitadly just an advertisement.)
  10. first, let me rant off subject about how annoying Heely's are. I am so sick of being in a store and have little 9 year olds zoom by me. Sometimes I just want to trip them. The other day I was in Target and I saw this head just float by from the other isle. I was like "what the ...." then I realized it was another tween on wheels. I'm surprised parents let their kids wear them out in public. Have they been banned yet in schools?

    second, I agree with those who commented on your menu. there's nothing wrong w/ plain text but it take a few moments for the user to adjust and understand the layout of your page. The first place people look for navigation is on the left - where you have your google ads. I'd move them to the right side of the screen - where people expect to see ads. You can keep your nav menu on the top if you'd like, but make it more obvious that it is a menu. Perhaps change the background color behind the text or make the text itself a bit lighter and bolder.
  11. Here you go:
    [code]<script type="text/javascript">
    function checkAll(yes){
    if(yes){
      document.getElementById('rbrow1Y').checked = true;
      document.getElementById('rbrow2Y').checked = true;
    }else{
      document.getElementById('rbrow1N').checked = true;
      document.getElementById('rbrow2N').checked = true;
    }
    }
    </script>

    <TABLE WIDTH="100%" BORDER="1" CELLSPACING="0">
    <TR>
    <TD>Yes<BR><INPUT TYPE="radio" NAME="rball" VALUE="yesall" onClick="checkAll(true)"><BR></TD>
    <TD WIDTH="6%">No<BR><INPUT TYPE="radio" NAME="rball" VALUE="noall" onClick="checkAll(false)"><BR></TD>
    </TR>
    <TR>
    <TD><INPUT TYPE="radio" ID="rbrow1Y" NAME="rb1" VALUE="YES" ></TD>
    <TD><INPUT TYPE="radio" ID="rbrow1N" NAME="rb1" VALUE="NO"></TD>
    </TR>
    <TR>
    <TD><INPUT TYPE="radio" ID="rbrow2Y" NAME="rb2" VALUE="YES" ></TD>
    <TD><INPUT TYPE="radio" ID="rbrow2N" NAME="rb2" VALUE="NO"></TD>
    </TR>
    </TABLE>[/code]
  12. Yeah, I had trouble find hel on that as well.
    I ended up just making my own and adding features as I learned what I was doing.

    first, start w/ Kevin Roth's [a href=\"http://www.kevinroth.com/rte/\" target=\"_blank\"]Rich Text Editor[/a] (RTE) it seems to be just about everywhere on the web where people have WYSIWYG text entry fields.

    Once you get that up and running, add new features.
    Find a tutorial for resizing images. Build an application that does that. Then, link it to the RTE.

    To insert those resized and uploaded images back into the generated code, look at and copy other features of the RTE program (such as "insert table") and adjust to do what you need.

    Sorry that doesn't give you an easier answer. but its a start.
  13. EDIT{
    I AM A DUMB@$$ - who didn't scroll down through this thread before posting the same response.
    }

    not sure what you are trying to accomplish, but if you want to be tricky you CAN use JS to control data that comes from the server side, using AJAX of course.

    have the page load, client side, noting the element ID of the data you want to control with PHP onChange.
    then just use client side JavaScript to call your PHP scripts that run server side. When they are done running, they send the info back to your javaScript function which then updates the data in the element on the semingly static, client side page.
  14. you could probably use "GROUP BY" in your query.

    SELECT * FROM recipies WHERE cluause goes here GROUP BY ingrediantsTable

    OR

    in your PHP script that makes a list, as you go through your database results and add each item to the list, put them into an array. As you add each item to the array, do a check to see if the item is already inarray(). if so, don't add it again.
  15. I keep a config.inc file for my application which includes a var called $tablename which holds the string value of, you guessed it, the table name used throughout the applications.

    on each page, I include() the config file and can call the $tablename var in my queries.
    example:

    [!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]mysql_query("SELECT * FROM $tablename");[!--colorc--][/span][!--/colorc--]

    This is working on all of my pages as it should; HOWEVER, it is failing when I include another page (called "functions.php") and try to run a function off that page.
    example:

    functions.php page has this function:
    [!--coloro:#FF6600--][span style=\"color:#FF6600\"][!--/coloro--]function runQuery{
    $result = mysql_query("SELECT * FROM $tablename");
    return $result;
    }[!--colorc--][/span][!--/colorc--]

    index.php has this code:
    [!--coloro:#33CC00--][span style=\"color:#33CC00\"][!--/coloro--]include('config.inc');
    include('function.php');
    $result = runQuery();[!--colorc--][/span][!--/colorc--]

    I get no result because the query in the function does not recognize the tablename var which is included from the previously loaded config file.

    what am I not understanding here?
    Thanks for your thoughts!

  16. I'm not sure I follow your problem?

    a "checkbox" is an HTML element, not PHP.

    a checkbox can be checked, or unchecked. if it is checked, when the form is submitted, the "value" is passed in $_POST with the element's "name". Your above code looks fine.

    a "checkbox" however, can not be a "BUTTON"

    unless you add a some sort of "onClick" javaScript to the checkbox, it can not behave like a button.

    If this doesn't help, perhaps you could explain your problem w/ more detail.
    Thanks!
  17. [!--quoteo(post=369238:date=Apr 27 2006, 10:18 AM:name=emehrkay)--][div class=\'quotetop\']QUOTE(emehrkay @ Apr 27 2006, 10:18 AM) [snapback]369238[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    i thought the double $$ would keep track of the changes but its not working, its only returning zero, when it should return 12.
    [/quote]

    you shouldn't need the double $$.

    another example using a for loop

    $var = 0;

    for($i=0; $i<20; $i++){

    if(condition){
    $var = $var + 1;
    }

    }

    echo $var;

  18. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]i like to decide at each usage which one fits the solution best.[/quote]

    good call - and thats what I just ended up doing.

    I convert the user dates entered from the form easily with strtotime.
    when the script needs to update the calendar events, I'm using mktime().

    in my calendar example, I was using just strtotime() to get a time stamp for an event, then I would add seconds to it to make it a future date. As I mentioned, this messed up the time when crossing Day Light Savings.

    my solution is to use mktime($h,$m,0,$month, $day+$NUMBER_OF_DAYS_IN_FUTURE,$year)
    that way mktime calcs for DLS. much better!

    Thanks again for your input
×
×
  • 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.