jonw118 Posted March 11, 2008 Share Posted March 11, 2008 Here's the deal - I have an admin panel that displays listings based on the users ID (when a user is logged in, displays only their listings). Well, I now need to build a page where it displays all listings in the sytem - user ID is completely irrelevant. And I took out the line that verifies against sessions, as the page I am building is open to the public, so I don't need any type of user restrictions. But I'm stuck. Here's the PHP code at the top of the page. I tried just to delete out the areas referring to [my_adminid], but not good enough. I would REALLY appreciate anyone's thoughts on making this happen: <?php require_once("inc/admin_info_class.php"); require_once("inc/paging_class.php"); $object=new admin_info_class; if($_REQUEST["noPerPage"]!=""){ $noPerPage=$_REQUEST["noPerPage"]; }else{ $noPerPage=10; } $memType=$object->check_user_Type($_SESSION["my_adminid"]); if($memType==0){ $strSQL="select DATE_FORMAT(reg_date,'%m/%d/%Y') as _date ,a.* from tbl_listing as a WHERE a.mem_ID=$_SESSION[my_adminid] order by list_ID "; } else { $strSQL="select DATE_FORMAT(reg_date,'%m/%d/%Y') as _date ,a.* from tbl_listing as a order by list_ID "; } // echo $strSQL; $paging=new paging($noPerPage,5); // paging class object $rsListing=$paging->query($strSQL); if($_REQUEST['action']=='_delete') { $sql = "DELETE FROM tbl_listing where list_ID=". $_REQUEST['id'] ." "; mysql_query($sql); @mysql_query("DELETE FROM tbl_listing_image WHERE list_ID=". $_REQUEST['id'] ." "); @mysql_query("DELETE FROM tbl_listing_map WHERE list_ID=". $_REQUEST['id'] ." "); @mysql_query("DELETE FROM tbl_sell_mang_link WHERE list_ID=". $_REQUEST['id'] ." "); header("location:listings.php"); } ?> If it helps at all, here is the full page of code: <?php require_once("inc/admin_info_class.php"); require_once("inc/paging_class.php"); $object=new admin_info_class; if($_REQUEST["noPerPage"]!=""){ $noPerPage=$_REQUEST["noPerPage"]; }else{ $noPerPage=10; } $memType=$object->check_user_Type($_SESSION["my_adminid"]); if($memType==0){ $strSQL="select DATE_FORMAT(reg_date,'%m/%d/%Y') as _date ,a.* from tbl_listing as a WHERE a.mem_ID=$_SESSION[my_adminid] order by list_ID "; } else { $strSQL="select DATE_FORMAT(reg_date,'%m/%d/%Y') as _date ,a.* from tbl_listing as a order by list_ID "; } // echo $strSQL; $paging=new paging($noPerPage,5); // paging class object $rsListing=$paging->query($strSQL); if($_REQUEST['action']=='_delete') { $sql = "DELETE FROM tbl_listing where list_ID=". $_REQUEST['id'] ." "; mysql_query($sql); @mysql_query("DELETE FROM tbl_listing_image WHERE list_ID=". $_REQUEST['id'] ." "); @mysql_query("DELETE FROM tbl_listing_map WHERE list_ID=". $_REQUEST['id'] ." "); @mysql_query("DELETE FROM tbl_sell_mang_link WHERE list_ID=". $_REQUEST['id'] ." "); header("location:listings.php"); } ?><center> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE>listings</TITLE> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link type="text/css" rel="stylesheet" href="<?php echo $page['css_path']; ?>"> <script type="text/javascript" src="<?php echo isset($page['js'])? $page['js']:'../../functions.js'; ?> "> </script> <script> var hwndPopup_27b5; function openpopup_27b5(url){ var popupWidth = 715; var popupHeight = 415; var popupTop = 300; var popupLeft = 300; var isFullScreen = false; var isAutoCenter = true; var popupTarget = "popupwin_27b5"; var popupParams = "toolbar=0, scrollbars=0, menubar=0, status=0, resizable=0"; if (isFullScreen) { popupParams += ", fullscreen=1"; } else if (isAutoCenter) { popupTop = parseInt((window.screen.height - popupHeight)/2); popupLeft = parseInt((window.screen.width - popupWidth)/2); } var ua = window.navigator.userAgent; var isMac = (ua.indexOf("Mac") > -1); //IE 5.1 PR on OSX 10.0.x does not support relative URLs in pop-ups the way they're handled below w/ document.writeln if (isMac && url.indexOf("http") != 0) { url = location.href.substring(0,location.href.lastIndexOf('\/')) + "/" + url; } var isOpera = (ua.indexOf("Opera") > -1); var operaVersion; if (isOpera) { var i = ua.indexOf("Opera"); operaVersion = parseFloat(ua.substring(i + 6, ua.indexOf(" ", i + )); if (operaVersion > 7.00) { var isAccessible = false; eval("try { isAccessible = ( (hwndPopup_27b5 != null) && !hwndPopup_27b5.closed ); } catch(exc) { } "); if (!isAccessible) { hwndPopup_27b5 = null; } } } if ( (hwndPopup_27b5 == null) || hwndPopup_27b5.closed ) { if (isOpera && (operaVersion < 7)) { if (url.indexOf("http") != 0) { hwndPopup_27b5 = window.open(url,popupTarget,popupParams + ((!isFullScreen) ? ", width=" + popupWidth +", height=" + popupHeight : "")); if (!isFullScreen) { hwndPopup_27b5.moveTo(popupLeft, popupTop); } hwndPopup_27b5.focus(); return; } } if (!(window.navigator.appName == "Netscape" && !document.getElementById)) { //not ns4 popupParams += ", width=" + popupWidth +", height=" + popupHeight + ", left=" + popupLeft + ", top=" + popupTop; } else { popupParams += ", left=" + popupLeft + ", top=" + popupTop; } //alert(popupParams); hwndPopup_27b5 = window.open("",popupTarget,popupParams); if (!isFullScreen) { hwndPopup_27b5.resizeTo(popupWidth, popupHeight); hwndPopup_27b5.moveTo(popupLeft, popupTop); } hwndPopup_27b5.focus(); with (hwndPopup_27b5.document) { open(); write("<ht"+"ml><he"+"ad></he"+"ad><bo"+"dy onLoad=\"window.location.href='" + url + "'\"></bo"+"dy></ht"+"ml>"); close(); } } else { if (isOpera && (operaVersion > 7.00)) { eval("try { hwndPopup_27b5.focus(); hwndPopup_27b5.location.href = url; } catch(exc) { hwndPopup_27b5 = window.open(\""+ url +"\",\"" + popupTarget +"\",\""+ popupParams + ", width=" + popupWidth +", height=" + popupHeight +"\"); } "); } else { hwndPopup_27b5.focus(); hwndPopup_27b5.location.href = url; } } } </script> <script> var domok=document.all||document.getElementById if (domok) document.write('<SCRIPT SRC="js/sortTable.js"><\/SCRIPT>') </script> <LINK REL=STYLESHEET TYPE="text/css" HREF="http://www.dotcomproducer.com/drop.css"> </HEAD> <BODY NOF="(MB=(Listings, 0, 0, 0, 0), L=(listingsLayout, 641, 721))" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0033CC" VLINK="#990099" ALINK="#FF0000" onLoad='if (domok) initTable("table0")' TOPMARGIN=0 LEFTMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0> <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=614 NOF=LY> <TR VALIGN=TOP ALIGN=LEFT> <TD WIDTH=614> <P ALIGN=LEFT><FONT FACE="Arial,Helvetica,Geneva,Sans-serif"><TR VALIGN=TOP ALIGN=LEFT> <TD></TD> <TD WIDTH=614> <P ALIGN=LEFT><FONT FACE="Arial,Helvetica,Geneva,Sans-serif"> <table border=0 cellspacing=0 cellpadding=0 width=558 nof="LayoutRegion1"> <tr valign=top align=left> <td width=10 height=16><img src="../assets/images/autogen/clearpixel.gif" width=10 height=1 border=0 alt=""></td> <td width=1><img src="../assets/images/autogen/clearpixel.gif" width=1 height=1 border=0 alt=""></td> <td width=456><img src="../assets/images/autogen/clearpixel.gif" width=456 height=1 border=0 alt=""></td> <td width=91><img src="../assets/images/autogen/clearpixel.gif" width=91 height=1 border=0 alt=""></td> </tr> <tr valign=top align=left> <td></td> <td colspan=2 width=457 class="TextObject"> <p><b><span style="font-family: Verdana,Tahoma,Arial,Helvetica,Sans-serif; font-size: 14px; color: rgb(0,51,153);">Current Products in Gallery:</span></b><span style="font-size: 10px;"><b><span style="font-family: Verdana,Tahoma,Arial,Helvetica,Sans-serif; color: rgb(0,51,153);"> </span></b><span style="font-family: Verdana,Tahoma,Arial,Helvetica,Sans-serif;"></span></span></p> </td> <td></td> </tr> <tr valign=top align=left> <td colspan=4 height=20></td> </tr> <tr valign=top align=left> <td colspan=2></td> <td colspan=2 width=547 class="TextObject"> <p style="text-align: left;"><span style="font-family: Verdana,Tahoma,Arial,Helvetica,Sans-serif; font-size: 10px; color: rgb(255,0,0);"><a style="color: rgb(255,0,0);" href="create_listings.php">Add New Product To Gallery</a><br><a style="color: rgb(255,0,0);" target="_self" href="javascript:openpopup_27b5('import.php')"></a></span></p> </td> </tr> </table> </td> <td> <table border=0 cellspacing=0 cellpadding=0 width=221 nof="LayoutRegion1"> <tr valign=top align=left> <td width=1 height=52><img src="../assets/images/autogen/clearpixel.gif" width=1 height=1 border=0 alt=""></td> <td width=220><img src="../assets/images/autogen/clearpixel.gif" width=220 height=1 border=0 alt=""></td> </tr> <tr valign=top align=left> <td></td> </tr> </table> </td> </tr> </table> <table border=0 cellspacing=0 cellpadding=0 nof="LayoutRegion1"> <tr valign=top align=left> <td width=10 height=9><img src="../assets/images/autogen/clearpixel.gif" width=10 height=1 border=0 alt=""></td> <td></td> </tr> <tr valign=top align=left> <td></td> <td width=520> <table id="table0" border=0 cellspacing=0 cellpadding=2 width="100%" height=31> <p><b></b></p> </td> <td width=210> <p><b><span style="font-family: Verdana,Tahoma,Arial,Helvetica,Sans-serif; font-size: 11px;">Product:</span></b></p> </td> <?php $i=0; while($rowListing=$paging->result_assoc($rsListing)){ if($i%2==0){ echo "<tr style=\"background-color: rgb(190,197,255);\">"; } else{ echo " <tr>"; } ?> <td > <p><span style="font-family: Verdana,Tahoma,Arial,Helvetica,Sans-serif; font-size: 11px;"><?php echo $rowListing["street_add"]?></span></p> </td> <td > <p><span style="font-family: Verdana,Tahoma,Arial,Helvetica,Sans-serif; font-size: 9px; color: rgb(255,0,0);"><a href="edit_listings.php?lID=<?php echo $rowListing["list_ID"]?>" style="font-family: Verdana,Tahoma,Arial,Helvetica,Sans-serif; font-size: 9px; color: rgb(255,0,0);">View / Edit</a> | <a href="#" style="font-family: Verdana,Tahoma,Arial,Helvetica,Sans-serif; font-size: 9px; color: rgb(255,0,0);"onClick="javasdcript:frmConfirm(<?php echo $rowListing["list_ID"]?>);">Delete</a></span></p> </td> <?php $i++; } mysql_free_result($rsListing); ?> </table> </td> </tr> <tr valign=top align=left> <td></td> <td> </td> </tr> <tr valign=top align=left> <td></td> <td><div align="center"><?php echo $paging->print_link();?> </div></td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </FONT></P> </TD> </TR> </TABLE> </BODY> </HTML> <script language="javascript"> function frmConfirm(_ID) { var strConfirm; strConfirm = confirm("Are you sure to want to delete this ?"); if(strConfirm) { window.location.href='?action=_delete&id='+ _ID ; } } </script> Link to comment https://forums.phpfreaks.com/topic/95653-user_type/ Share on other sites More sharing options...
uniflare Posted March 11, 2008 Share Posted March 11, 2008 have you tried: { $strSQL="select DATE_FORMAT(reg_date,'%m/%d/%Y') as _date ,a.* from `tbl_listing` order by `list_ID`"; } Link to comment https://forums.phpfreaks.com/topic/95653-user_type/#findComment-489728 Share on other sites More sharing options...
jonw118 Posted March 11, 2008 Author Share Posted March 11, 2008 I tried that, and getting the same error message (which I forgot to post in the first one): Query ErrorYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order by list_ID' at line 1 Link to comment https://forums.phpfreaks.com/topic/95653-user_type/#findComment-489731 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.