PHP returns invalid MySQL resource

Posted by DeadMG on Stack Overflow See other posts from Stack Overflow or by DeadMG
Published on 2010-05-03T19:01:20Z Indexed on 2010/05/03 19:08 UTC
Read the original article Hit count: 280

Filed under:
|
    $LDATE = '#' . $_REQUEST['LDateDay'] . '/' . $_REQUEST['LDateMonth'] . '/' . $_REQUEST['LDateYear'] . '#';
    $RDATE = '#' . $_REQUEST['RDateDay'] . '/' . $_REQUEST['RDateMonth'] . '/' . $_REQUEST['RDateYear'] . '#';
    include("../../sql.php");
    $myconn2 = mysql_connect(/*removed*/, $username, $password);
    mysql_select_db(/*removed*/, $myconn2);
    $LSQLRequest = "SELECT * FROM flight WHERE DepartureDate = ".$LDATE;
    $LFlights = mysql_query($LSQLRequest, $myconn2);
    $RSQLRequest = "SELECT * FROM flight WHERE DepartureDate = ".$RDATE;
    $RFlights = mysql_query($RSQLRequest, $myconn2);

Assuming that all the $_REQUESTs are valid numerical values for their appropriate fields in the day/month/year field, how can LFlights and RFlights be invalid? When I polled the whole database I got hundreds of results so I know that the database and connection data is fine, and the field DepartureDate exists too.

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql