Jump to content

SpireLink

Members
  • Posts

    41
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

SpireLink's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. HI. i am working on a program that have categories and sup categories, the thing that the main category have a prent_id=0 and the sup category hase a the parent category_id the probleme now that I wont to be able to update the parent_id and when the parent_id=0 it will show me an option says "no parent" with the value of 0 <SELECT SIZE='1' name='parent_id'>"; $categories = mysql_query("SELECT * FROM categories where category_id<>$category_id ",$db); while ($categories_data = mysql_fetch_array($categories)) { $category_id=$categories_data['category_id']; $category_title=$categories_data['category_title']; if($category_id == $parent_id) { echo"<OPTION SELECTED value='$category_id'>$category_title</option>"; } else { echo"<option value='$category_id'>$category_title</option>"; } } echo"</select> i have worked around it in the add section and am using this code <SELECT SIZE='1' NAME='parent_id' dir='rtl' tabindex='1'> <option value='0'>no parent</option>"; $categories = mysql_query("SELECT * FROM categories",$db); while ($categories_data = mysql_fetch_array($categories)) { $pcategory_id=$categories_data["category_id"]; $pcategory_title=$categories_data["category_title"]; echo"<option value='$pcategory_id'>$pcategory_title</option>"; } echo"</SELECT>
  2. For me when I am coding I get a big glass of orange juice and a collection o the chocolate that I like not forgetting my cigarettes, and when I have all of this with me, I will continue coding for 2 days without sleeping
  3. No need for a seperate function for each type. You simply need to make the sort by links pass a perameter via the url, then sort by that within your query. eg; <?php if (isset($_GET['sortby'])) { $sortby = $_GET['sortby']; } else { $sortby = 'name'; // sort by name as default. } if (isset($_GET['sortorder'])) { $sortorder = $_GET['sortorder']; } else { $sortorder = 'DESC'; // order by DESC as default. } $sql = "SELECT * FROM users ORDER BY $sortby $sortorder"; // go ahead and execute the query. ?> PS: Don't forget to escape any data that may be manipulated by your users. aha, you mean like tha pagenation way right ? now regarding what do you mean by that ?? i didnt get you .. Thanks, it works as I want it, now a small dout please , how can i make it toggle between ASC and DESC , like if its the current USED link was users.php?sortby=id&sortorder= DESC the NEW link will be users.php?sortby=id&sortorder= ASC and vice versa Thanks in advance
  4. I wlunder why do you want to release an encrypted software? IMHO I would realase it open so the users will be able to develope plugins to the software that could be used as a feature in the next release just like what vBulletin did, but in the other hand protect the copyrights of the orginal code ..
  5. i have many tables with different data structure due, am making a service which will allow users to add itimes to thier "favorit items" tables I thinked to use the table names as a hidden filed, like if the table name is "hotel" and the user added a hotel to his favorit items , the hidden fild will be hotels, and then pass that field as a variable then use it in a query to get the hitel data, does this adea work? or there is a better way ?
  6. My biggest probleme is with sessions as am new to it, would you please explain how to do it with seasons?
  7. Thanks for clarification, but at the moment I dont get data posted by users, its only the admins who will be able to post data,users section will be done after final testing of the program with the current services which doesnt include members section untile now Any how, I have learned something new from you guys, thanks a bunch
  8. No need for a seperate function for each type. You simply need to make the sort by links pass a perameter via the url, then sort by that within your query. eg; <?php if (isset($_GET['sortby'])) { $sortby = $_GET['sortby']; } else { $sortby = 'name'; // sort by name as default. } if (isset($_GET['sortorder'])) { $sortorder = $_GET['sortorder']; } else { $sortorder = 'DESC'; // order by DESC as default. } $sql = "SELECT * FROM users ORDER BY $sortby $sortorder"; // go ahead and execute the query. ?> PS: Don't forget to escape any data that may be manipulated by your users. aha, you mean like tha pagenation way right ? now regarding what do you mean by that ?? i didnt get you ..
  9. Dont start with all of facebook services, do it one by one, at the moment am working on a city gude website, but am not offering "User Accounts" and "User Groups" not even "Comments" and "Rates" I will firest start my site as VERSION 1.0 and let the users test it with me and get back by contacting me telling me what does they think, and in case there is any errors.. after that I will start adding the other services one by one and letting the users test it with me .. its good to do like that because you will get more feedbacks from many users around the world ..
  10. [code]as we all have saw in forums, like when you get the members list it allows you to select the way you want the data to be listed Member Name DESC Member Name ASC Member ID DESC Member ID ASC I wanted want to use this future in my site the way i know to sort data is doing it in the query, like this [code]$dinings = mysql_query("SELECT * FROM dinings ORDER BY dining_id DESC",$db); I have thinked to it with functions [/code] function sort_name_desc { } function sort_name_asc { } function sort_id_desc { } function sort_id_asc { } [/code] now even if am going to do it like this, i dont want the users to get to know what is the fucntion that I am using , or if there is a better and easier way to do it, because with functions my file will have the same code four times with differnt sort types
  11. i have tested it with echo to show me the values, and it was not having the record ID so it wasn't updating the data, i workes around it by adding a hidden field in the form whcih will contain the record ID and pass it to the SQL query.. and it works
  12. thanks, it works like a charm even i have added the function that will show ma a list with the modify/delete link so i will be able to do it.. now the thing in that i cant update the data, it show me the current data but when i change any thing in there it doesnt update the record and show me an error message [attachment deleted by admin]
  13. Looks a nice adea to have a Socity Site like facebook, For me when i want to programe a site, I think for the services I am offering in that site, and i make a text filewith all of the field names that i am going to use for each section, its good for me as a referance, than i move on to the folders i create - admin (for admin section) - includ (for classes and config) tnen i make files with the name of each service like if i am offering news/events service the files structure will be like this - admin -- news -- events -include -- config -- dbclass and the user interface will be - index - news - events - show (to show the record details) after all i build the DataBase , and start programing from the admin moving to the user interface while testeing every function, and finaly work on the design and how to show the data to users. i know it might be a long way, but with this i am decreasing the coding time beacuse im am testing every single pice of record before finaly using it..
  14. Hi, I have done this // START DELETE RANK function remove ($id) { if (isset($HTTP_GET_VARS['id'])) { $rank_id = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['id'] : addslashes($HTTP_GET_VARS['id']); } include("../includes/config.php"); $remove="DELETE FROM ranks WHERE rank_id=$rank_id"; $remove_rank=mysql_query($remove,$db); } // END DELETE RANK and changed the link to be base.php?crl=rank.php&do=remove&id=3 but it's stell not removing that record ...
  15. Wide, i know that .. The thing that the add works, but the remove is not working .. i have used a java script to tell me that the remove was done, but it doesn't ... Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.