-
Posts
3,584 -
Joined
-
Last visited
-
Days Won
3
Everything posted by JonnoTheDev
-
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)){ } } ?>
-
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; }
-
How Is A Simple Way To prevent Browser Timeout
JonnoTheDev replied to johnsmith153's topic in PHP Coding Help
There is a timeout you can set on the webserver. Apache httpd.conf Timeout xxx -
Overkill. All you need radio - image radio - image radio - image update button
-
At this point (ifnull (SELECT SUM(amount) FROM
-
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
-
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
-
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.
-
Use a radio button next to the image
-
You cannot do this as far as I am aware (and have also tested). This is invalid HTML. Select lists are for text.
-
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.
-
Nothing in this post suggests it has anything to do with database access privileges. This person must think we are psychic!
-
agreed, nice solution
-
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.
-
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/
-
No. Are you sure you are not just refreshing the page. This will resubmit the form.
-
How can anyone help you without you posting your code and displaying where the problematic area is!
-
[SOLVED] How to Repopulate Form Fields
JonnoTheDev replied to thesaleboat's topic in PHP Coding Help
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']; -
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.
-
<?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
-
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
-
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.
-
<?php if(is_numeric($_COOKIE["numCount"]) ){ $_COOKIE["numCount"]++; } else { setcookie("numCount",1); } echo $_COOKIE["numCount"]; ?>
-
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/
-
Have you set write permissions on the directory where the files will be moved to?