Jump to content

taquitosensei

Members
  • Posts

    676
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by taquitosensei

  1. also if you're looking for the last inserted id I would use this

    select last_insert_id() as lastid from table limit 1 
    

     

    that actually gets the id of the last row inserted by the current connection. This saves you headaches further down the road if you get more than one connection putting data into your database.

  2. array_rand();

    $product_1 = '<h2>Test Product 1</h2><p>skdug sdkhg ks dkghjs  kjsd jhfs dfklj</p><img src="images/test/test1.gif" align="left" height="50" width="50" border="0" />';
    $product_2 = '<h2>Test Product 2</h2><p>skdug sdkhg ks dkghjs  kjsd jhfs dfklj</p><img src="images/test/test2.gif" align="left" height="50" width="50" border="0" />';
    $product_3 = '<h2>Test Product 3</h2><p>skdug sdkhg ks dkghjs  kjsd jhfs dfklj</p><img src="images/test/test3.gif" align="left" height="50" width="50" border="0" />';
    
    $products = array($product_1, $product_2, $product_3);
    $rand_products=array_rand($products,3);  // this gives you an array with your 3 random elements 
    

     

     

  3. as best as I can tell

    $age=520;
    $remainder=$age%50;  // % gets the remainder of division 
    $amount=floor($age/50);   // divide by 50 then round down.  Gets the number of times 50 goes in to the age. 
    
    // loop for each time 50 goes into $age
    for($a=0;$a<$amount;$a++)
    {
    // send 50 to your site
    } 
    // send remainder to your site
    

     

  4. It's combining your 2 queries.  It's selecting everything from comments and users where the name in comments = the name in users  and Comments.id=$t

     

    let's say I have this table structure

    Comments

     

    comments                                                                  name                        id

    Hi long time lurker, first time poster                      tom                            1

    Am I the only on here?                                            tom                            2

     

    Users                                   

    name                            id

    tom                                1

     

    This query

    select * from Comments JOIN Users on Comments.Name=Users.Name where Comments.id=1
    

    would give you

     

    Comments.comment

    Hi long time lurker, first time poster 

    Comments.name

    tom

    Comments.id

    1

    Users.name

    tom

    Users.id

    1

     

     

  5. it would kind of work.

    Something like this would work better.

    <?php
    
    $result4 = mysql_query("SELECT * FROM comments JOIN Users on Comments.Name=Users.NameWHERE Comments.id=$t");
        while($row = mysql_fetch_assoc($result4));
       {
        $to      = $row['email'];
    $subject = 'the subject';
    $message = 'hello';
    $headers = 'From: webmaster@example.com' . "\r\n" .
        'Reply-To: webmaster@example.com' . "\r\n" .
        'X-Mailer: PHP/' . phpversion();
    
    mail($to, $subject, $message, $headers);
      }
    ?>
    

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