Jump to content

paruby

Members
  • Posts

    48
  • Joined

  • Last visited

About paruby

  • Birthday 08/19/1972

Contact Methods

  • AIM
    paruby
  • MSN
    peteruby72@hotmail.com
  • Website URL
    http://lpbj.net
  • Yahoo
    peteruby27

Profile Information

  • Gender
    Male

paruby's Achievements

Member

Member (2/5)

0

Reputation

  1. Thank you both for the help. I believe I can get to what I am envisioning from here. Pete
  2. Thank you for the reply mjdamato. ibelieve I have the first part done, not to have the user enter a number of items greater than what is currently available. For the part in question, I looking specifically at the case where the user will enter "3" for the item, the code will immediately run to subtract the inventory from 5 to 3, then they change their mind, and want to order 4, and change the value in the field to 4. The DB already has 2 available, and since it is running as AJAX, my number available is still 5, and allows them to change from 3 to 4.
  3. I have items in my DB as inventory. The table has 2 main fields for this, a total inventory # (per item), and a "remaining" field that will count down as the item is ordered. My problem is keeping track of the "remaining" number. There are two ways on the web page a user can change the # of an item they want, by entering a number in a form field which they can only enter a number up to the current # of items left at the time they load the page, and by using up and down arrows. Each click of the arrow is an addition or deduction of 1 item. In this case, I can keep track of how many are left, because I know it is always +1 or -1. The issue is with the manually entered field. For example, if item1 has 5 left, and a user types in 3, I can easily just subtract 3 from the inventory, and get 2. But, if the user then types in 4 for item1, I do not know that the last value they entered was 3, to get the difference of 1, and subtract 1 more from inventory, nor do I know that when they first started, there were 5 left, and subtract 4 to get 1. This gets even more confusing if there are 2 users trying to get the same item... This must be a common thing, but again, I cannot get it figured out... In advance, thank you to all who have replied and helped on my other posts lately. These questions all revolve around the same site I am building, and have maybe bit off more than I can chew at a reasonable pace... Pete
  4. OK, figured it out. I am already making a call to my database to get item details, and the starting value of the field, so I just added another variable for the max value, and set that along to my JS/Ajax call, and it f the value of the field is greater than my max value, I change the field value back to the max, and send an alert msgbox to the screen.
  5. I have form fields for the # of items of an object, ie. a shopping cart. I want to be able to restrict a user to only enter a specific number range for the quantity of an item in the form field box. I am not aware of a form field variable such as "maxvalue", but can I do it some other way? I want to get the max number out of the database. Not sure if this helps, but I am already using Ajax to set the form field values in database tables, but cannot seem to set a max value. If this is not clear enough, let me know. Thanks Pete
  6. I have a table of data I want to cycle through, that includes a field that can be 1 of 4 values (an id from a 2nd table - named "locationID"). I want to query the first table order by locationID. Then for each distinct value of locationID, do specific work on those rows (could be more than 1 row returned for each locationID). My initial thought is since I know how many different locationID's there are (4), I an just do 4 different queries, 1 for each locationID (WHERE locationID = 1 , 2, etc), and do the work on each, but this does not sound clean or fast. My next thought was to do one query, get all the rows - ORDER BY locationID, then work on each distinct value of locationID - but that would possibly be a subquery... Any thoughts on the best way to do this? The work I do on each distinct locationID set is the same except for setting values. Thanks Pete
  7. Gizmola, Thanks again for your help so far. Here is what I get when i try to print out the array (print_r($arr) :: Array ( [12] => Beverages [15] => Soda ) Array ( [12] => Beverages [15] => Soda [16] => Milk ) Array ( [12] => Beverages [15] => Soda [16] => Milk ) Array ( [12] => Beverages [15] => Soda [16] => Milk [13] => Frozen Foods [14] => Ice Cream ) Array ( [12] => Beverages [15] => Soda [16] => Milk [13] => Frozen Foods [14] => Ice Cream [17] => Popsicles ) Array ( [12] => Beverages [15] => Soda [16] => Milk [13] => Frozen Foods [14] => Ice Cream [17] => Popsicles ) Array ( [12] => Beverages [15] => Soda [16] => Milk [13] => Frozen Foods [14] => Ice Cream [17] => Popsicles ) Can you tell me how to just return the last set of array?
  8. Thank you gizmola. I will test it in a bit. My question now is, what does the "&" do before the variable name (&$arr)? I have seen it before, and tried googling it, but have not found it...?
  9. Hope this helps others - As a workaround, I just added the listbox code directly into my function, like this :: echo "<option value=\"$thisCatID\">$value</option>\n"; Then, when calling my function, I wrapped the <select> nodes, ie :: echo "<select name='catTree' size='10'>\n"; createCatTree(); echo "</select>"; But, I still would like to be able to hold the data in an array, so I can use it in different ways as needed. Thanks, Pete
  10. I have a database table with categories and subcategories, with the structure of :: categoryid, categoryname, parentid I have found numerous examples of printing out a tree structure of the table, and it works, but I would like to get all the data into an array, ultimately to print the array to a listbox to select from. The array structure would be categoryid => categoryname. The basic query I have now is as follows :: function createCatTree($thisParentCatID=0,$depth=0) { $catIDQ = mysql_query("SELECT * from category WHERE parentcatid = $thisParentCatID;"); while ( $catIDQRow = mysql_fetch_array($catIDQ) ) { $thisCatName = $catIDQRow['categoryname']; $thisCatID = $catIDQRow['categoryid']; for($i = 0; $i < $depth; $i++) $spcstr.= " "; // create spaces to mimic a tree structure $value = $spcstr.$thisCatName; // add spaces echo $value; createCatTree($thisCatID,$depth+1); } } I was hoping to send the categoryid and categoryname to an array, like $arr[$thisCatID] = $value; then change my function call to be createCatTree($thisCatID,$depth+1,$arr); to send the array as a variable back to the function to hold the data going forward. Also, I added a section at the top of the function to see if the array needed to be initialized, like if ($arr == "") { $arr = array(); } but this does not work. Is there any way to use this basic recursive code and save all the data to an array to be worked on at a later time?
  11. Thank you both for the suggestions. I actually found "strip_tags()" while looking at the first 2 suggestions. I am using that, as it seems "cleaner"... If not for your suggestions, i may not have found it...! Pete
  12. i have an admin page that lists all the rows from a table. One of the fields is generated using FCKEditor, so the field has HTML Code in it. I would like to only show the first 100 or so chars of the field, but if the 100 chars ends in the middle of HTML code, specifically in this case <a href>, it cuts off, and creates "havoc" in my page. Is there a way to avoid this by seeing that the 100 char is in the middle of an <a href> tag (or any tag for that matter? Here is what the generated html can look like :: <td class="tdresults">We are very excited to offer three great events at the <a href="http://www.mylongwebsite.c</td> <td class="tdresults">next field data</td> Thank you in advance. Pete
  13. Not sure if this is the correct forum, but I have a few FCKEditor questions that I have not found on the CKEditor site, and hoping someone here has any answers... I have 2 questions/issues - 1. relative links - I have a site like http://www.mydomain.com/myadmin/adminpage.php. In this page I have FCKEditor 2.6.5 that I can enter text for an article to place on a page in the root of the site, http://www.mydomain.com/, along with links to internal pages. When I create the link in FCKEditor, I click the "link" icon, and use the Protocol of "Other" and type in "test.html" for the URL. But my link then comes out as " http://www.mydomain.com/myadmin/test.html", when I really want "http://www.mydomain.com/test.html". I want to make the link relative to the basehref setting in the FCKConfig that is set to "http://www.mydomain.com", OR, just create the link as relative, the way I type it into FCKEditor. Is this possible? 2. Is it possible for FCKEditor, when pasting text into the textarea, have it ignore any predefined HTML code? I get a lot of info in Outlook, and if I copy it directly from there, I get all the MS crap formatting. I want to have it stripped out, as if i had copied the text from Notepad. I have no problem putting it into Notepad and then into FCK, but I am afraid regular users will not know how to do this... Thank You. Pete
  14. I really need to Google first! Sorry... Here is the link I am using... http://www.cstruter.com/blog/115
  15. Hello - I am trying to do the following, which I have seen on many web pages, but not sure if there is an easy way to do it... I have 2 list boxes, side by side with buttons in between, one pointing left, one pointing right. By clicking the appropriate arrow, the info selected in either box is moved over to the other - List 1 List 2 |---------| |---------| | | > | | | | | | | | < | | ----------- ----------- I can see doing it w/ PHP & XML, and although I have not coded it all, I can see it being very bulky, and wondering if there is something already written... Thanx! Pete
×
×
  • 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.