Jump to content

R1der

Members
  • Posts

    104
  • Joined

  • Last visited

    Never

Posts posted by R1der

  1. I'm having a issue with a little bit of coding involving SELECT the problem is I want it to select from the database and say limit it to 5 so basicly it prints 5 results from the database but its only printing 1 result

     

    It is not an error in the query.

     

    You need to loop through the results to get them all.

    $q=mysql_query("SELECT * FROM papercontent LIMIT 5",$c); //run the query.
    echo "<center><table width = '40%' border = '1'><tr><th>
               <center><u>Latest Announcements</u></center>"; //print the first part of the table.
    while($content=mysql_fetch_row($q)) { //while there are rows left in the database (fetch_row pulls a numeric array, fetch_assoc pulls an associative array)
    echo "<tr><td>{$content[0]}</td></tr></td>"; //print a new row, with the first column of the database row.
    }
    echo '</table>'; //close the table after all rows are finished.
    

     

    Thanks this worked great

  2. Thanks for your reply but changes what you said and get a error lol..

     

    Warning: mysql_result() expects parameter 1 to be resource, boolean given in /home/crimcity/public_html/login.php on line 144

  3. Hi guys,

     

    I'm having a issue with a little bit of coding involving SELECT the problem is I want it to select from the database and say limit it to 5 so basicly it prints 5 results from the database but its only printing 1 result

     

    Here is the code i'm using

     

    $q=mysql_query("SELECT * FROM papercontent LIMIT 5",$c);
    $content=mysql_result($q,0,0);
    
    print "
    <center><table width = '40%' border = '1'><tr><th>
    <center><u>Latest Announcements</u></center>
    
    $content
    </tr></td></table>
    ";
    

     

    Thanks

  4. <?php
    
    
    include("config.php");
    
    
    
    $getEMails = mysql_query("Select * from userdb");
    if(!$getEMails)
    {
    die("Error " . mysql_errno() . ": " . mysql_error());
    }
    $loadMails = mysql_fetch_array($GetEMails);
    
    {
    $message = "ftest.";
    $subject = "test";
    $sendto = "$loadmails";
    mail($sendto, $subject, $message, $header);
    echo "Mail Sent To . $loadMails[email] . 
    ";
    }
    
    ?>
    
    

  5. Thanks for the replys..

     

    I will start by saying i changed the uppercase "M" to a lowercase but still get the error.

     

    ok i also added the code you posted but still get the same error w/out error report

     

     

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/r1der1/public_html/emailall.php on line 13

    Mail Sent To . .

  6. I have spent countless hours tryign to work out the problem here but failed.

     

    Please can someone fix this code for me?

     

    I get this error

     

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/*****/public_html/emailall.php on line 14

    Mail Sent To . .

     

     

    <?php
    
    
    include("config.php");
    
    
    
         $getEMails = Mysql_query("Select * from email");
         $loadMails = mysql_fetch_array($GetEMails);
    
    {
      $message = "message here.";
      $subject = "subject here";
      $sendto = "$loadmails";
      mail($sendto, $subject, $message, $header);
      echo "Mail Sent To  . $loadMails[email]  . 
    ";
    }
    
    ?>
    

     

    Thanks

  7. I am not sure if this is to do with the "SELECT" query but its only returning 1 result from the database. What have i done wrong? lol

     

    $get_horse = mysql_query("SELECT * FROM hracing ORDER BY id");
    
    $horses = mysql_fetch_array($get_horse);
    
    echo"<br><Br>";
      echo "<table width=100%>";
                    echo "<tr>";
                    echo "<td width=30%><b>Horse</b></td>";
                    echo "<td width=30%><b>Odds</b></td>";
                    echo "<td width=30%><b>Bet Cost</b></td>"; 
                    echo "<td width=30%><b>Bet</b></td>";       
                    echo "</tr>";
    
    
    
    echo "<td>$horses[name]</td>";
    echo "<td>$horses[odds]</td>";
    echo "<td>$horses[cost]</td>";
    echo "<td><a href=hracing.php?action=$horses[name]>Bet</a></td>";
    echo "</table>";
    include("bottom.php");

     

    Thanks for your time

  8. But like i said all the others insert fine so all you need to know is the refip one as that is the only one that dont insert.

     

    correct?

     

    
    mysql_query("SELECT * FROM userdb WHERE `ipaddress` = '$refip' AND `id` = '$_GET[refer]'");
    
    

  9. Ok i am trying to insert something into referals database but its not inserting the users ipaddress can anyone see a problem?

     

    mysql_query("SELECT * FROM userdb WHERE `ipaddress` = '$refip' AND `id` = '$_GET[refer]'");
    mysql_query("INSERT INTO referals (id, refer, referip, referedip, refered) VALUES ('', '$refer', '$refip', '$ip', '$username')") or die(mysql_error());
    

     

    All insert right except 'referip'

     

    Thanks

  10. All depends Cant you add a query

     

    To say like

     

    if thay have not paid then exit the script?

     

    Not sure like i have never had to do it.. so i dont know if it can be done with a 'if' statment

     

    But i am sure there must be a way to do it..

     

  11. But i dont want it to insert '0' lol

     

    It's a advertisement thing so thay type something and it shows..

     

    i.e

     

    thay type..

     

    'I am selling crystals'

     

    and it should insert "I am selling crystals" but its not its inserting '0'

     

    Get what i mean?

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