Jump to content
Larry Ullman's Book Forums


  • Posts

  • Joined

  • Last visited

shaneg's Achievements


Newbie (1/14)



  1. The suggested cookie method has been implemented. It works great. Thanks.
  2. Both ideas are very helpful, and I think a combination of both may do what I need. I'm not sure exactly how to add an event handler to the close event (which is needed in both ideas). I've had difficulty with that before, but I can figure it out. I'll try it. Thanks!
  3. Yes, it is likely that the user would sometimes want multiple child windows open at one time. For example, while working on customer A in a child window, the phone rings with a call from customer B, so the user opens a second child window, but doesn't want to close the first child window that is in the process of being worked on.
  4. My site includes a parent-window that has a table of customers. By clicking on a customer, the user initiates the opening of a child-window that has a table of further data for that specific customer. Clicking on a customer in the parent-window runs the following code: if(window.varwins["study"+tcustid] && !window.varwins["study"+tcustid].closed){ alert('A study for this customer, '+tcust+', is already open.'); } else{ varwins["study"+tcustid]=window.open("crxindex.php?getcustid="+tcustid,tcustid); } This works very well. However, if there is a child-window open, and the parent-window is closed, when the parent-window is reopened there is no longer a connection between the 2 windows and the above code does not keep the child-window from being duplicated in a second child-window for the same customer. Is there a way to connect the re-opened parent-window with the already-opened child-window, so that the above code keeps the child-window from being duplicated? I think this all has to do with the same-origin policy, but I need to find a work-around. Thanks.
  5. I have used a couple of your books extensively to develop a couple websites. I don't recall seeing the following topic covered. On my current project, I need my users to be able to locate and open a spreadsheet, word, or pdf file that is located (via an in-common cloud server) on their individual, local desktop computer. I don't want the file to open within the website, but instead the spreadsheet file, for example, should open via the software on the desktop, thus allowing the user to be outside of the website and edit or view the file, and then resave it on the desktop (via the cloud server) as appropriate. My users all have identical acces to the list of files that are located on the cloud server. All users have access to the same files. The only thing that is centralized on the website is the file reference (that is the same for each user), and the ability to cause that file to be opened. Is there a way to do this via javascript? Thanks.
  6. Aaaah, that is slick! (And works exactly as I needed.)
  7. Function A has called function B, executed a few lines, and now I want to return to function A and execute the underlined part of this: function A(){ .... .... B(); } function B(){ .... .... return [return true]; } The first return is for function B. The second return is for function A. Of course, I can just put the underlined code in function A after calling function B, but in this case I want to assign the code as a part of the function B return. As written, the above code does not work; the second return on the line causes a syntax error. Is there a way to do this? Thanks.
  8. Per instructions and examples in the book, I am using javascript to initiate use of mysql within a php file to populate the data in a grid within my original javascript file. Everything works fine! However, sometimes, it takes a few seconds for the php file to complete running. I am finding that I need to disable the grid until the php file has completed. I know how to disable the grid using jquery $.blockUI(); and re-enable the grid using $.unblockUI(); using javascript commands in my javascript file. But I cannot figure out how to delay the $.unblockUI(); until the php file has completed. How can I do that? Thank you.
  9. Thank you! I think I have this resolved. And it seems to work great. (Yes, the grid plugin is already running ajax.) I gained knowledge from each of your replies and each time (after letting it sink in) added another piece to my understanding of how this can work. You have been thorough, and I really appreciate it!
  10. I bought the Ajax book, and you're right, it is very good. However, I still have not been able to figure out my problem. I'll try to restate it. Step 1: I am using javascript to display 2 grids that allow me to input variables into multiple columns of records in 2 tables of a MySQL database. Step 2: I am using php to apply math to variables from table 1 against variables from table 2 in the database and generate a mathematical product which is now saved in another field of the record in table 1. Step 3: I then use javascript to redisplay the grid showing table 1, but instead of the variables, I now see the columns of the table resulting from step 2. I know how to do step 1, and step 2, and step 3. And I know how to click a button in step 1 that initiates step 3 (three, not two). What I can't figure out is how to make that button initiate step 2 before initiating step 3. In other words, I don't know how to temporarily leave the javascript function of step 1, then briefly go into php to initiate step 2, then automatically return to the javascript function of step 3. Currently, I click on the button of step 1 and I do successfully go to step 3, however I haven't run the php in step 2, therefore, my product hasn't been calculated and step 3 shows outdated results if I have made changes in step 1. Thanks for your help. You guys are great!
  11. Within a javascript function, if certain conditions are true, I need to utilize MySQL for recalculating some fields, and then return right back into the javascript function. If I use location.href....... as a line in the function which refers to a php file that utilizes MySQL, I can get the calculating done, but I don't get returned back to the function. On the other hand, if go to php within my function and use include...... this will also get the calculating done, and I even then return to the function, but I don't want the php include... to run unless certain conditions are true within the javascript function. So, I either need to use something like location.href that also returns me to my javascript function, or I need to be able to keep the php logic from running unless the function conditions are true. I suppose I could do the latter by passing a javascript true/false variable to the php logic, but I can't figure out how to do this, and not even sure if this would work. Within javascript, don't php lines run first and regardless of what is in the function? I'm thinking the answer is probably in one of the 2 php/mysql books of yours I have, but I can't think of what it would be. Help?? Thanks!
  12. Thank you both so much! I'm digesting the suggestions. Summarizing my objective: There should be only 1 row resulting from $r1. I am then going to use that result to multiply it by a column in several rows resulting from $r2, using this product to update a second column in each of the $r2 rows. It looks like I have 3 ways to do this: 1) using "list" outside of mysql (I didn't know about this possibility.) , 2) using "select ... into" within mysql, or 3) using a select statement that includes both tables at once. As I try to figure out the best option, I have 1 other question for now: Which of these 3 would be most efficient? Thanks!
  13. Larry, I have 2 of your books: "PHP 6 and MySQL 5 for Dynamic Web Sites" and "Effortless E-Commerce with PHP and MySQL", but do not have your MySQL book. If I just need to get this book to answer my question, that's fine, but I wasn't sure that my answer would be found there. I have made a lot of progress, but can't figure this out: I am needing to get a value from a column in xacres table and multiply it by a value in xinputs table. But I can't figure out how to save the first value as a variable to be used by the SELECT statement for the second table. I have the following: $q1 = 'SELECT * FROM xacres WHERE user_id=' . $_SESSION['user_id'] . '&& filler=' . '"Acres owned"' . 'LIMIT 1'; $r1 = mysqli_query($dbc, $q1); if (mysqli_num_rows($r1) >= 1 ) { $q2 = 'SELECT * FROM xinputs WHERE user_id=' . $_SESSION['user_id'] . '&& user_id=' . $_SESSION['user_id']; $r2 = mysqli_query($dbc, $q2); if (mysqli_num_rows($r2) >= 1 ) { ..... As a test, the above works successfully, but I haven't yet saved the variable from $q1 to be used in $q2. To accomplish this, I have changed the code to the following (where "xacres01" is a column from xacres table and where "owned" is the name of the variable I am trying to save to): $q1 = 'SELECT xacres01 INTO owned FROM xacres WHERE user_id=' . $_SESSION['user_id'] . '&& filler=' . '"Acres owned"' . 'LIMIT 1'; $r1 = mysqli_query($dbc, $q1); if (mysqli_num_rows($r1) >= 1 ) { $q2 = 'SELECT * FROM xinputs WHERE user_id=' . $_SESSION['user_id'] . '&& user_id=' . $_SESSION['user_id']; $r2 = mysqli_query($dbc, $q2); if (mysqli_num_rows($r2) >= 1 ) { ..... All I did was replace "SELECT *" with "SELECT xacres01 INTO owned". And I now get the error: "mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given" for the 1st mysqli_num_rows line, which I think means I have an error in the preceding 2 lines. I don't know if my syntax is incorrect, or if I just need to do this in another way. Can you give me a suggestion? Or is the answer in the MySQL book? Thanks for your help!
  • Create New...