pixeltrace Posted March 17, 2007 Share Posted March 17, 2007 guys, i need help, i have a view page that has a searchtool bar. its working without the conditions on the tool bar but when i added it already i am getting errors already. hope you could check my codes and help. below is the codes for my view page <?php session_start(); if (session_is_registered("username")){ //include 'db_connect.php'; include("pagina/my_pagina_class.php"); //-for the keywords, specialization condition..... $stat = ''; if (isset($_POST['status'])) { if($_POST['status'] != ''){ $stat = "j_status = '". $_POST['status'] ."'"; } } $key = ''; if (isset($_POST['keywords'])) { if($_POST['keywords'] != ''){ $key = " AND j_position LIKE '%". $_POST['keywords'] ."%'"; } } $cond = ''; if (isset($_POST['managed'])) { if($_POST['managed'] != ''){ $cond = " AND managedby = '". $_POST['managed'] ."'"; } } //-for the drop down menu if(isset($_POST['sort1']) && $_POST['sort1']!=''){ $sort1 = $_POST['sort1']; }else{ $sort1 = "ASC"; } $test = new JHpage; //this is where we use the query string... //also, i'd put the conditional order by statement here, not up above. //on top of that, you need a comma (,) between your two sort variables. //i didn't change anything else... let me know how this works out for ya. $test->sql = "SELECT * FROM job_ads WHERE ".$stat."".$key."".$cond." ORDER BY ".$sort1 .""; //$test->sql = "SELECT * FROM job_ads WHERE ".$keywords."".$managedby." ORDER BY ".$sort1 .""; // the (basic) sql statement (use the SQL whatever you like) $result = $test->get_page_result(); // result set $num_rows = $test->get_page_num_rows(); // number of records in result set $nav_links = $test->navigation(" | ", "currentStyle"); // the navigation links (define a CSS class selector for the current link) $nav_info = $test->page_info(); // information about the number of records on page ("to" is the text between the number) $simple_nav_links = $test->back_forward_link(true); // the navigation with only the back and forward links, use true to use images $total_recs = $test->get_total_rows(); // the total number of records ?> <script type="text/JavaScript"> <!-- function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //--> </script> <table width="100" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="../images/spacer.gif" width="6" height="10"></td> <td><table width="216" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="3" valign="top" bgcolor="#3261BB"><img src="images/spacer.gif" width="1" height="1"></td> </tr> <tr> <td align="left" bgcolor="#3261BB" width="1"><img src="images/spacer.gif" width="1" height="1"></td> <td width="214" valign="top"> <table width="862" border="0" cellspacing="2" cellpadding="0"> <tr> <td colspan="4"><form method="POST" action="sjobs.php?id=1"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="157"><span class="text6"> <?php echo " total record found: " .$total_recs; ?> </span></td> <td width="701" align="right" class="text6">job title: <input type="text" name="keywords" /> status: <select name="status"> <option value="open" selected>open</option> <option value="close">close</option> </select> managed by: <select name="managed"> <option value="">-------------</option> <?php $uSql = "SELECT managedby FROM job_ads ASC"; $uResult = mysql_query($uSql, $connection); while($uRow = mysql_fetch_row($uResult)){ echo "<option value=\"". $uRow[0] ."\">". $uRow[0] ."\n"; } ?> </select> <select name="sort2"> <option value="ASC">ASC</option> <option value="DESC">DESC</option> </select> <input type="submit" name="Submit" value="Go" /> </td> </tr> </table> </form></td> </tr> <tr> <td colspan="4"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="60%" align="left" class="text8"> </td> <td width="39%" align="right"><!-- nav top --> <? echo "<span class='link1'>".$nav_links."</span>"; ?> </td> <td width="1%" align="right"><img src="../../images/main/spacer.gif" width="1" height="1" /></td> </tr> </table></td> </tr> <tr> <td width="66" align="center" bgcolor="#83C2ED" class="text5">ID</td> <td width="309" align="center" valign="top" bgcolor="#83C2ED" class="text5">job title</td> <td width="274" align="center" bgcolor="#83C2ED" class="text5">managed by </td> <td width="203" align="center" bgcolor="#83C2ED" class="text5">status</td> </tr> <?php for ($i = 0; $i < $num_rows; $i++) { $jobid = mysql_result($result, $i, "jobid"); $j_position = mysql_result($result, $i, "j_position"); $managedby = mysql_result($result, $i, "managedby"); $j_status = mysql_result($result, $i, "j_status"); ?> <tr> <td align="center" bgcolor="#FFFFCC" class="text8">J<? echo ($jobid <= 9) ? $jobid : $jobid;?> </td> <td bgcolor="#FFFFCC"> <a href="javascript:;" class="link1" onClick="MM_openBrWindow('../jobsearch/jobpost.php?jobid=<? echo "$jobid"; ?>','','scrollbars=yes,width=720,height=700')"> <? echo "$j_position";?></a></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$managedby";?> </td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$j_status";?></td> </tr> <? } ?> <tr> <td colspan="4" bgcolor="#83C2ED"><img src="../images/spacer.gif" width="10" height="2" /></td> </tr> <tr> <td colspan="4"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="60%" align="left" class="text8"> </td> <td width="39%" align="right"><!-- nav top --> <? echo "<span class='link1'>".$nav_links."</span>"; ?> </td> <td width="1%" align="right"><img src="../../images/main/spacer.gif" width="1" height="1" /></td> </tr> </table></td> </tr> <tr> <td colspan="4"> </td> </tr> </table> </td> <td align="right" bgcolor="#3261BB" width="1"><img src="images/spacer.gif" width="1" height="1"></td> </tr> <tr> <td colspan="3" valign="top" bgcolor="#3261BB"><img src="images/spacer.gif" width="1" height="1"></td> </tr> </table></td> <td><img src="../images/spacer.gif" width="6" height="10"></td> </tr> </table> <? }else{ echo "<font face=\"Arial\">You are not authorized to access this page ... Please <a href='../index.php'>Login</a></font>"; } ?> thanks! Link to comment https://forums.phpfreaks.com/topic/43133-solved-help-on-my-view-page-with-searchtool-bar/ Share on other sites More sharing options...
fert Posted March 17, 2007 Share Posted March 17, 2007 what errors are you getting? Link to comment https://forums.phpfreaks.com/topic/43133-solved-help-on-my-view-page-with-searchtool-bar/#findComment-209470 Share on other sites More sharing options...
pixeltrace Posted March 17, 2007 Author Share Posted March 17, 2007 this are the errors i am getting. Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\hosting\webhost4life\member\diorgrace\admean\pagina\my_pagina_class.php on line 90 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\hosting\webhost4life\member\diorgrace\admean\pagina\my_pagina_class.php on line 63 Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in c:\hosting\webhost4life\member\diorgrace\admean\pagina\my_pagina_class.php on line 68 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\hosting\webhost4life\member\diorgrace\admean\pagina\my_pagina_class.php on line 63 Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in c:\hosting\webhost4life\member\diorgrace\admean\pagina\my_pagina_class.php on line 68 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\hosting\webhost4life\member\diorgrace\admean\pagina\my_pagina_class.php on line 63 Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in c:\hosting\webhost4life\member\diorgrace\admean\pagina\my_pagina_class.php on line 68 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\hosting\webhost4life\member\diorgrace\admean\pagina\my_pagina_class.php on line 63 Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in c:\hosting\webhost4life\member\diorgrace\admean\pagina\my_pagina_class.php on line 68 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\hosting\webhost4life\member\diorgrace\admean\pagina\my_pagina_class.php on line 63 Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in c:\hosting\webhost4life\member\diorgrace\admean\pagina\my_pagina_class.php on line 68 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\hosting\webhost4life\member\diorgrace\admean\pagina\my_pagina_class.php on line 63 Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in c:\hosting\webhost4life\member\diorgrace\admean\pagina\my_pagina_class.php on line 68 normally i encounter this errors before if the variables that you assigned in line 122 to 127 is wrong. but in my case i already tested it and the variables are correct and the page is working if i havent placed any conditions. when i added the conditions i am getting this. i checked my variables several times already and everything is correct. need help please thanks! Link to comment https://forums.phpfreaks.com/topic/43133-solved-help-on-my-view-page-with-searchtool-bar/#findComment-209473 Share on other sites More sharing options...
fert Posted March 17, 2007 Share Posted March 17, 2007 you queries in my_pagina_class.php aren't working Link to comment https://forums.phpfreaks.com/topic/43133-solved-help-on-my-view-page-with-searchtool-bar/#findComment-209475 Share on other sites More sharing options...
pixeltrace Posted March 17, 2007 Author Share Posted March 17, 2007 that one is working. my problem just started when i added the conditions on my first lines of codes Link to comment https://forums.phpfreaks.com/topic/43133-solved-help-on-my-view-page-with-searchtool-bar/#findComment-209478 Share on other sites More sharing options...
pixeltrace Posted March 17, 2007 Author Share Posted March 17, 2007 i was able to make it worked now. thanks for the help though Link to comment https://forums.phpfreaks.com/topic/43133-solved-help-on-my-view-page-with-searchtool-bar/#findComment-209492 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.