Jump to content

aebstract

Members
  • Posts

    1,105
  • Joined

  • Last visited

Posts posted by aebstract

  1. your else statements should have 'one' closing bracket in front of them:

     

    <?php
    if (isset($_GET["title"])){
       if (file_exists($_GET["title"].".php")) {
          include ($_GET["title"].".php");
       } else { echo ("Wrong page homie!"); }
    } else { include ("home.php"); }
    ?>
    

  2. I've got some ideas on how to approach this but I just can't seem to find the exact tools I am going to need. Just some points in the right direction and some functions that I'll need would be great. Basically if my string is over 20 characters, I want to cut off everything past the 20th character and just add '..' to the end of the string and display the result.

    Thanks

  3. You put a \ in front of 2 " and not all of the rest inside your echo. Should be:

     

    echo "<a href=\"#\" onclick=\"toggle_visibility('foo');\">";
    echo "<img src=\"http://forum.wootability.com/CE.png\">";
    echo "</a>";
    
    echo "<div id=\"foo\">";
                            $row['ratings'] = $this->ipsclass->compiled_templates['skin_topic']->ratings( $row['pid'] , $row['author_id'] , $ratingshtml );
    echo "</div>"; 
    

  4. :(

    Okay let's see if I can make this as clear as possible as to what I am trying to figure out. I have a script that sends out an email to about 400 email addresses. My email address is about 10 deep, then I have someone else I work with about half way and finally a third person near the end. Me and the first person both got the mail, the last person did not. I have

    set_time_limit(0);

    at the very top of my script so that it won't time out due to it taking so long to process. So this means it must be something else causing it to cut short? Is there any way for me to test and find the problem and get a solution without physically sending out an email to all of these users, as I cannot spam the emails of important people running chicken processing plants around America. I don't even know where to begin to troubleshoot this.

  5. So you need something like this?

     

    $myquery = mysql_query("SELECT * FROM tablenamehere WHERE category='cat2'") or DIE(mysql_error());
    
    while($r=mysql_fetch_array($myquery))
    {
    $id=$r["id"];
    $value=$r["value"];
    $value=$r["value"];
    
    echo "$value";
    }
    
    

     

    Quicky to get the idea to you, basically grab all information with a certain category. Then you just set variables for whatever information you want from each from. Hope this is what you were looking for.

  6. tmallen, who said he wanted all of his links to not have the underlined mark?

     

    a {
        text-decoration: none;
    }

     

    There may be ONE spot on his website, where a link needs to be without an underlined mark and all of his others are fine. Think of that one? Maybe he is making a website where you click a link and go to another page and there is only one link to click per page. Why? Who knows... he's making his website for his reasoning and I am sure there is one.

  7. I'm not sure if this is what's causing it, but try putting quotes around the style:

    <h2 style="italic .5em Georgia, Times, serif;">

     

    Even if the style wasn't right, it would still display the text/information without styling.

     

     

    try changing $content =  to $content .= for the second two values...

     

    I'm running a str_replace on my entire $content variable and replacing parts of it, not adding to it so the .= would have no working effect towards fixing the problem.

     

     

    That leaves us with thorpe, I tossed your code in and it works ;) Thanks a bunch man.

     

     

     

     

    edit: did they remove the topic solved feature?!

  8. Here is my mail script, runs on a cron job once a week.

     

    <?php
    set_time_limit(0);
    
    
    mysql_connect("localhost","***","***") or die(mysql_error());
    mysql_select_db("**_*_*");
    
    
    $i = 1;
    while ($i != 0){
    
    $myquery = mysql_query("SELECT * FROM mailer ORDER BY RAND() LIMIT 1") or DIE(mysql_error());
    
    while($r=mysql_fetch_array($myquery))
    {
    $id=$r["id"];
    $flyer=$r["flyer"];
    $date=$r["date"];
    $used=$r["used"];
    }
    
    if ($used == 0) {
    $i = 0;
        mysql_query("UPDATE mailer SET used='1' WHERE id=$id LIMIT 1") or DIE(mysql_error());
    }
    
    }
    
    
    include "../eq$flyer.php";
    
    $content = str_replace('class="contacttd"', 'bgcolor="c0c0c0" cellpadding="5"', $content);
    $content = str_replace('class="contacttd2"', 'bgcolor="dddddd" cellpadding="5"', $content);
    $content = str_replace('<h2>', '<h2 style=italic .5em Georgia, Times, serif;>', $content);
    
    
    $message = "<html><head></head><body>$content</body></html>";
    $fromaddress = 'admin@berryequipment.net';
    $emailsubject = 'Berry Plumbing & Equipment - Product Information';
    
    
    
    
    
    $emails = array("lots of emails");
    $emailaddress = array_unique($emails);
    
    
    $i = count($emailaddress);
    $z = 0;
    
    
    if ($i != 0){
    
    while ($i != $z){
    
    mail($emailaddress[$z], $emailsubject, $message, "From: " .$fromaddress. "\nX-Mailer: PHP 4.x");
    $z++;
    
    }
    
    }
    
    
    
    
    
    
    
    ?>
    

     

    Problem is, this is the email that I received:

     

    <html><head></head><body></body></html>

     

    I thought it was all correct so that it would put the content in to the email but I must have messed something up.

  9. http://www.titov.net/2005/09/21/do-not-use-order-by-rand-or-how-to-get-random-rows-from-table/

     

    Which in that article, this is all that is relevant:

     

    You can use something like:
    
    SELECT COUNT(*) AS cnt FROM quotes
    
    generate random number between 0 and cnt-1 in your programming language and run the query:
    
    SELECT quote FROM quotes LIMIT $generated_number, 1
    
    Yes. This are two queries, but they are MUCH faster than the first one. This option is good if you need just one random row.
    

     

    Which is what I got going on but I have that error.. Which I just realized I wasn't getting the random number, so here is my updated:

     

    $generated_number = mysql_query("SELECT COUNT(*) AS cnt FROM mailer") or DIE(mysql_error());
    
    $random_number = rand(1, $generated_number);
    
    $myquery = mysql_query("SELECT * FROM mailer LIMIT $random_number, 1") or DIE(mysql_error());
    
    while($r=mysql_fetch_array($myquery))
    {
    
    $id=$r["id"];
    $flyer=$r["flyer"];
    $date=$r["date"];
    
    }
    

    and here is my updated error:

    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 ' 1' at line 1

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