djdellux Posted November 20, 2008 Share Posted November 20, 2008 MY CODE <html> <head> <title>Loggin DB</title> </head> <body> <h1 align=left>Please enter search feilds:</h1> <body bgcolor="#82CAFA"> <form method="get" action="loggin1.php"> Page: <select name="Page"> <option value="approve.php" >Approve</option> <option value="custquery" >CustQuery</option> <option value="slpnlogin">SlpnLogin</option> </select> User Code: <select name="UserCode"> <option >T3</option> <option >J9</option> <option>BL</option> <option >SC</option> <option >MN</option> <option >CA</option> <option>MW</option> <option >TJ</option> <option >E2</option> <option >D6</option> <option >SS</option> <option >R9</option> <option >GL</option> <option >MP</option> <option >RW</option> </select> Start Date: <input type="text" name="time"> End Date: <input type="text" name="time"> <p><input name="submitted" type="submit" value="send"/></p></form> <?php $db = $_SERVER['DOCUMENT_ROOT']."/../data/log.db"; //connect to sql $handle = sqlite_open($db); $query = "SELECT * FROM log WHERE"; if(isset($_GET['submitted']) && $_GET["submitted"] == "send")// line check { if ($_GET["Page"] !="") { $query.=" page=\"" .$_GET["Page"]."\""; } if ($_GET["UserCode"] !="") { $query.=" and userCode=\"" .$_GET["UserCode"]."\""; } if(isset($_GET["time"])) { $stime = strtotime($_GET["time"]); $query.=" and time <='" .$stime.'"'; } if(isset($_GET["time"])) { $etime = strtotime($_GET["time"]); $query.=" and time >='" .$etime.'"'; } } echo $query;// show the result of the search $result = sqlite_query($handle, $query); $row = sqlite_fetch_array( $result ); echo "<style type='text/css'> table { border-width: 1px; border-spacing:0px ; border-style: double; border-color: black; border-collapse: separate; background-color: #82CAFA; } table th { border-width: 1px; padding: 0px; border-style: solid; border-color: black; background-color: #82CAFA; } table td { border-width: 1px; padding: 3px; border-style: solid; border-color: black; background-color: #82CAFA; } </style> <table class='db'; cellspacing=\"0px\">"; while($row = sqlite_fetch_array($result)){ echo " <tr>\n"; echo " <td> $row[id]</td><td> $row </td> <td> $row[desc] </td><td> $row[userCode] </td><td> $row[codeType] </td><td>". date( "Y-m-d", $row['time'])."</td><td> $row[ipaddr]</td>\n"; echo " </tr>\n"; } echo "</table>"; ?> </html> MY ERRORS SELECT * FROM log WHERE page="slpnlogin" and userCode="T3" and time <='1169442000" and time >='1169442000" Warning: sqlite_query() [function.sqlite-query]: near "1169442000": syntax error in c:\program files\Apache\htdocs\loggin1.php on line 64 Warning: sqlite_fetch_array() expects parameter 1 to be resource, boolean given in c:\program files\Apache\htdocs\loggin1.php on line 65 Warning: sqlite_fetch_array() expects parameter 1 to be resource, boolean given in c:\program files\Apache\htdocs\loggin1.php on line 91 what do you gurus think ?????? Quote Link to comment https://forums.phpfreaks.com/topic/133531-solved-wow-go-newbie/ Share on other sites More sharing options...
gevans Posted November 20, 2008 Share Posted November 20, 2008 if(isset($_GET['submitted']) && $_GET["submitted"] == "send")// line check { if ($_GET["Page"] !="") { $query.=" page=\"" .$_GET["Page"]."\""; } if ($_GET["UserCode"] !="") { $query.=" and userCode=\"" .$_GET["UserCode"]."\""; } if(isset($_GET["time"])) { $stime = strtotime($_GET["time"]); $query.=" and time <=\"$stime\""; } if(isset($_GET["time"])) { $etime = strtotime($_GET["time"]); $query.=" and time >=\"$etime\""; } } try putting that in Quote Link to comment https://forums.phpfreaks.com/topic/133531-solved-wow-go-newbie/#findComment-694541 Share on other sites More sharing options...
wildteen88 Posted November 20, 2008 Share Posted November 20, 2008 Please wrap any code posted within code tags -- I have done this for you. Also it would be helpful if you described what you're trying to do too. Quote Link to comment https://forums.phpfreaks.com/topic/133531-solved-wow-go-newbie/#findComment-694542 Share on other sites More sharing options...
djdellux Posted November 20, 2008 Author Share Posted November 20, 2008 i have figured it out with ur help guys thx as always and i will wrap my code for ya from now on Quote Link to comment https://forums.phpfreaks.com/topic/133531-solved-wow-go-newbie/#findComment-694567 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.