1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

PHP + mySQL - Variables being returned are incorrect?

Discussion in 'Software Development' started by crEA-tEch, Apr 4, 2008.

Thread Status:
Not open for further replies.
  1. crEA-tEch

    crEA-tEch Thread Starter

    Joined:
    Jul 2, 2003
    Messages:
    80
    Hi all!

    I've been trying to get my head around this for hours, but I'm utterly confused.

    I'm trying to query from a database by date.

    In a nutshell, I want to retrieve information from a 'courses' table, that is OLDER than today, but between 2 dates... please see the attached image (the query is echo'd here so you can see it).

    Problem is, as you can see by the image - it just displays all the information in the table - as far as I can see. It doesnt seem to take into consideration my query by the dates I supplied.

    Here is my code:

    PHP:
    $queryx = "SELECT * FROM courses WHERE date > '$day' AND date >= '$fromm' AND date <= '$too'";
    echo $queryx;
    ///$queryx  = "SELECT * FROM courses WHERE date > current_date ORDER BY fromm ";
    $resultx = mysql_query($queryx);

    while($rowx = mysql_fetch_array($resultx, MYSQL_ASSOC))




    ?>              
                <table border="0" cellspacing="0" cellpadding="2">
                  <tr>
                    <td width="127"  bgcolor="#FFFFFF"><span class="style9"><? echo ($rowx['date']);  ?></span></td>
                    <td width="132"  bgcolor="#FFFFFF"><span class="style9"><? echo ($rowx['title']);  ?></span></td>
                  </tr>
                  <tr>
             <td colspan="2" bgcolor="#FFFFFF"><span class="style7"><? echo ($rowx['description']);  ?></span></td>
                  </tr> 
                </table>       



                <? ?>

    I'd appreciate any help whatsoever. I'm pulling my hair out!

    Thanks guys,

    Nick
     
  2. crEA-tEch

    crEA-tEch Thread Starter

    Joined:
    Jul 2, 2003
    Messages:
    80
    Sorry... forgot the screenshot!

    attached
     

    Attached Files:

  3. crEA-tEch

    crEA-tEch Thread Starter

    Joined:
    Jul 2, 2003
    Messages:
    80
    I've solved it!

    Thanks any way guys!

    Nick
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Similar Threads - mySQL Variables being
  1. riiiiiya
    Replies:
    0
    Views:
    252
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/700297

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice