Jump to content

SpireLink

Members
  • Posts

    41
  • Joined

  • Last visited

    Never

Everything posted by SpireLink

  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
  16. Hi, Could you please upload the index.php file so i may be able to have a look at it .. Thanks
  17. I got it, you mean the $id it was a typo, cause i got tired of trying so i changed $id to $zaim, any how i have updated the file [attachment deleted by admin]
  18. Hi all, i am working on a script which will allow me to add, list, update, and remove recordsfrom database Untile now i was able to add, but i cant delete.. the code usage ADD: base.php?crl=rank.php&do=add LIST:base.php?crl=rank.php&do=modify UPDATE:base.php?crl=rank.php&do=update&id= DELETE: base.php?crl=rank.php&do=delete&id= sorry, its rank.php not ranl.php Thanks [attachment deleted by admin]
  19. Hi, I have made a script to edit an article in a list, the thing thet the article category (Author Name) is brought from another table, and to modify the data I get the catigories list from that table and list it all , i want to make the current value selected.. <table border='0' width='100%'> <form name='edit_news' method='post' action='base.php?crl=article_edit.php'> <tr> <td align='right'><b>Title:</b> </td> <td align='right'><input name='title' type='text' value='<? echo "$title"; ?>' > </td> </tr> <tr> <td align='right' valign='top'><b>intro :</b> </td> <td align='right'><textarea rows='5' cols='60' name='intro'><? echo $intro ?></textarea> </td> </tr> <tr> <td align='right' valign='top'><b>Article :</b> </td> <td align='right'><textarea rows='30' cols='60' name='article'><? echo $article ?></textarea> </td> </tr> <tr><td align='right'><b>Author :</b></td> <td align='right'> <select name='category'> <? $artcat = mysql_query("SELECT * FROM artcat ORDER BY id DESC",$db); while ($artcat_data = mysql_fetch_array($artcat)) { $artcat_id=$artcat_data["id"]; $artcat_title=$artcat_data["title"]; ?> <option value='<? echo "$artcat_id"; ?>'><? echo "$artcat_title"; ?></option> <? } ?> </select> </td></tr> <tr><td align='right'></td><td align='right'><input name='id' type="hidden" value='<? echo "$id"; ?>'></td></tr> <tr><td align='left'><input type='submit' name='submit' value='Update'></td><td align='right'></td></tr> </form> </table>
  20. thanks a bunch worked like a charm
  21. Hi again, I am making a site that will show data accourding to the type of data, I am passing the type with the link sample links show.php?do=comany&id= (to show company data) show.php?do=news&id= (to show news data) show.php?do=sponsor&id= (to show sponsor data) show.php?do=event&id= (to show event data) I would like to use one file insted of making 4 files, notice that each type have its own table, i have tried to make a file news.php and it containes this code <?php include("includes/config.php"); $news = trim($HTTP_GET_VARS[id]); $query_news_rs = "SELECT * FROM news WHERE id=$news"; $news_rs = mysql_query($query_news_rs, $db) or die(mysql_error()); $row_news_rs = mysql_fetch_assoc($news_rs); // *** Get News Details *** $id=$row_news_rs['id']; $channel_id=$row_news_rs['channel_id']; $news_title=$row_news_rs['news_title']; $news_url=$row_news_rs['news_url']; $news_pic=$row_news_rs['news_pic']; $news_date=$row_news_rs['news_date']; $news_content=$row_news_rs['news_content']; $news_display=$row_news_rs['news_display']; echo " <TABLE WIDTH='100%' id='News Details'> <TR> <TD> $id <BR/> $channel_id <BR/> $news_title <BR/> $news_url <BR/> $news_pic <BR/> $news_date <BR/> $news_content <BR/> $news_display <BR/> </TD> </TR> </TABLE>"; // *** Free Database *** mysql_free_result($news_rs); ?> now in show.php i have this code <?php include("includes/config.php"); $id= trim($HTTP_GET_VARS[id]); // function company { // company actions // } function news ($id) { $query_news_rs = "SELECT * FROM news WHERE id=$id"; $news_rs = mysql_query($query_news_rs, $db) or die(mysql_error()); $row_news_rs = mysql_fetch_assoc($news_rs); // *** Get News Details *** $id=$row_news_rs['id']; $channel_id=$row_news_rs['channel_id']; $news_title=$row_news_rs['news_title']; $news_url=$row_news_rs['news_url']; $news_pic=$row_news_rs['news_pic']; $news_date=$row_news_rs['news_date']; $news_content=$row_news_rs['news_content']; $news_display=$row_news_rs['news_display']; echo " <TABLE WIDTH='100%' id='News Details'> <TR> <TD> $id <BR/> $channel_id <BR/> $news_title <BR/> $news_url <BR/> $news_pic <BR/> $news_date <BR/> $news_content <BR/> $news_display <BR/> </TD> </TR> </TABLE>"; // *** Free Database *** mysql_free_result($news_rs); } // function sponsor { // sponsor actions // } // function event { // event actions // } ?> when I use the link show.php?do=news&id=1 to show the data of id 1 it show me a blank page, please correct me, notice that when i use news.php it shows me the data as i want, but not in show.php
  22. Hi, i like your calendar script , could you please attache the database schema and all the related calendar files? add event, delete event , update event, show event, display calendar and any other files you use, more over i wana ask you, does it need to have the user setup his starting day ? becaue my site doesnt need login ..
  23. Sir, You are totaly right, but I am using some functions many times in the project, and including or calling the functions will make it easier for me to fix bugs, more over regarding that value that i pass it will be used in many other files, because once you call the channel.php file, it will call functions_channel.php functions_news.php functions_calendar.php functions_adserv.php which will make some queries accourding to the $channel value.
  24. i fixed it another way 1st in the function_channels.php i changed include("config.php"); $channel = trim($HTTP_GET_VARS[channel]); if ($channel == "main") to be include("config.php"); if ($channel == "main") than , in channels.php i changed the code to be $channel = trim($HTTP_GET_VARS[id]); include("includes/function_channels.php"); so in this case , i defined the channel vriable, and after that i included the function_channels.php , and while the $channel is predefined it will not ask for it again it will contenue to work and run the SQL command using the defined value thanks for assistance
×
×
  • 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.