Jump to content

JonnoTheDev

Staff Alumni
  • Posts

    3,584
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by JonnoTheDev

  1. You mean a conditional statement. A case is something completely different Check your logic carefully <?php include 'dbconn.php'; $result = mysql_query("SELECT * FROM picks WHERE expiredate = CURDATE() AND CURTIME() < expiretime AND starttime < CURTIME()" ,$conn); $showResults = true; if(!mysql_num_rows($result)) { unset($result); // there are no matches echo "<div align=\"center\">There is no pick available at this time ".$edate."</div>"; // run a second query $result = mysql_query("SELECT * FROM picks WHERE expiredate > CURDATE() ORDER BY expiredate ASC LIMIT 1",$conn); // check results if(!mysql_num_rows($result)) { $showResults = false; } } // display the results from either the first or second query if($showResults) { while ($row = mysql_fetch_assoc($result)){ } } ?>
  2. invalid syntax. you should always check the function manual on php.net for correct usage you cannot pass an array of words into the function as the last parameter only the search & replace so you will have to use per word foreach($words as $key => $word) { $word= str_replace($punc, "", $word); print $word; }
  3. There is a timeout you can set on the webserver. Apache httpd.conf Timeout xxx
  4. Overkill. All you need radio - image radio - image radio - image update button
  5. At this point (ifnull (SELECT SUM(amount) FROM
  6. no, just gives a query error near the subquery. I may just put the collection total in the same table as the bookings as opposed to logging each individual collection
  7. I cant inner join the collection table as it may contain 0 records for some bookings i.e the sum of b.rate is still owed - no collections have been made by the user
  8. Having difficulty with this query. What I have is a booking system where a user can be assigned to a booking (many bookings). There is a comission rate for each booking that is to be paid to the user. The administrator can see the amount owed per booking and make payments, however they can pay in parts i.e 50 - 2 installments of 25. What I need is the total amount in comission minus the amount paid for all bookings giving the total owed to the user. tables bookings ======== bookingId userId price rate payMethod user ======== userId name collection ======== id bookingId amount Query: SELECT u.userId, u.name, SUM(b.rate), (SELECT SUM(amount) FROM collection c WHERE b.bookingId=c.bookingId) FROM users u INNER JOIN bookings b ON (u.userId=b.userId) WHERE b.payMethod='cash' GROUP BY u.userId ORDER BY u.name ASC This gives the correct information but I need to minus the results of (SELECT SUM(amount) FROM collection c WHERE b.bookingId=c.bookingId) from SUM(b.rate). A simple minus operator gives me a null result.
  9. Use a radio button next to the image
  10. You cannot do this as far as I am aware (and have also tested). This is invalid HTML. Select lists are for text.
  11. Not unless you want to keep having to submit the form every time an item is selected from a list. Remember PHP is server side. Data must be sent to the server before it can be processed (i.e. submit the form). This is where AJAX comes in. You can run server side scripts without the need to submit and reload the page, obtain data and change page elements based on user actions / selections. Here is a simple tutorial to get you going: http://www.tizag.com/ajaxTutorial/ajax-mysql-database.php If I were you I would look into recreating the system in your own fashion if you cannot add to the existing codebase.
  12. Nothing in this post suggests it has anything to do with database access privileges. This person must think we are psychic!
  13. agreed, nice solution
  14. As your error clearly states: failed to open stream: Permission denied Either you have not set the path to the folder correctly in the script, the folder has the wrong ownership i.e it should not be owned by root, and or the permissions on the folder are incorrect.
  15. This just looks like a simple directory (not even that good to be honest). There are tons of scripts that can do this. You could manipulate a link directory. Search hotscripts: http://www.hotscripts.com/listing/k-links-directory/
  16. No. Are you sure you are not just refreshing the page. This will resubmit the form.
  17. How can anyone help you without you posting your code and displaying where the problematic area is!
  18. This comes from your SQL query so: $employee_info = mysql_query("SELECT * FROM employee_info WHERE employee_info.myusername = '$myusername'") or die(mysql_error()); $rows = mysql_fetch_assoc($employee_info); // you can then use the result set i.e print $rows['state'];
  19. Using a session is not possible in this case because you would never know the value to store in the session. That is why it is passed in the URL. Hence multiple parameters for 1 page. URL parameters are an essential part of web programming - used correctly and properly validated there are no issues.
  20. <?php $Response = httpsPost($url, $strRequest); // create xml object from response $xmlObj = simplexml_load_string($Response); ?> You can then work through the elements as an array. Checkout some of the examples http://uk2.php.net/manual/en/function.simplexml-load-string.php
  21. You need to change the directory permissions on the folder where the files are saved to i.e. new_tech/ (as in your script). Allow write permissions 777
  22. It is an online text editor like MS Word only in your web browser. You type the text, copy from MS Word, etc. Add a submit button and then save the text to your database, a text file or whatever. When it needs to be edited you get the record from the database, text file etc and then put it back into the editor. When it is submitted you update the record.
  23. <?php if(is_numeric($_COOKIE["numCount"]) ){ $_COOKIE["numCount"]++; } else { setcookie("numCount",1); } echo $_COOKIE["numCount"]; ?>
  24. This would be really difficult as reading a word doc requires a DOM object and a MS server. However you can get a variety of text editors that work through your web browser. If a user copies a document from MS Word it has the ability to preserve any formatting. http://www.fckeditor.net/
  25. Have you set write permissions on the directory where the files will be moved to?
×
×
  • 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.