
stig1
Members-
Posts
107 -
Joined
-
Last visited
Never
Everything posted by stig1
-
I am access information from a ibm db2 (as400) database system. We have a field that stores dates but they are stored in a varchar (character) field type. When the data (date) come out, they are 'yyyymmdd'. How would I go to format that string into dd-mm-yyyy?
-
Solved!
-
In my terminal screen, I got permission denied for the users nobody and apache when typing in the following: nobody@/var/www/html/trail/$ lpr -o sides=two-sides-long-edge order2.pdf or apache@/var/www/html/trail/$ lpr -o sides=two-sides-long-edge order2.pdf
-
I installed it via the gui when installing centos 5.4. So it probably is default.
-
I am alittle confused, do you type that all in the php script? or the terminal screen? cause i run my server as root, no one else has access.
-
I am trying to build a php page, that will send a shell command to print a pdf. I am using a centos 5.4 with cups installed. I can print fine when I enter the shell command manually into the terminal screen and hit enter, but I would like a user to be able to go to load a page via the browser and it sends the print request. The following is the code I am using does not seem to work: <?php $cmd = 'lpr -o sides=two-side-long-edge order2.pdf'; echo "<pre>".shell_exec($cmd)."</pre>"; ?> Help would be great.
-
New to using mod_rewrite, but am wondering how this can be stopped, due to, if I can do it, wouldn't search engines be able to do it as well therefore creating duplicate content. I have a product.php?id=300 that I have used to display products on the site. However, on the site, I have built the link structure to display product/300 which equals to product.php?id=300. But i can type in my browser, product.php?id=300 and go directly to that page, how do I stop users typing in the actual page address on the server with the parameters? PS: I also have some sites already indexed in google with the parameters, but need to change them into more user friendly, but when i click on the google link, it does not seem to redirect to the new page with the better urls?
-
So how would i go about doing it? Looked at the mkdir function, bit confused... Cause i would put it in a while loop from the sql statement.
-
i have the drive mapped in windows on my local computer.. and i run php via xampp on my local computer. would it work? like the drive is mapped as x
-
Is it possible to do the following. 1. Run an sql script to get all the customer's numbers from our database. (this is possible, and i can do this part easy) 2. For each customer number pulled from the sql script, create a directory, if the directory does not exist already on the server. 3. Can the directory / directories be created on another server not running the php script, basically the webserver runs the script, and the directory is created on the other server? Help is apprecaited.
-
I currently use this as my connection function to mysql, however, if the database connection fails there no way of it telling me, instead of using the or die statments i would rather it email me, with the mysql related error no and error msg. Is this possible? class DB_MySQL { var $connection; function DB_MySQL(){ $this->connection = mysql_connect(MYSQL_SERVER, MYSQL_USR, MYSQL_PASS); mysql_select_db(MYSQL_DB, $this->connection); } };
-
the column name in the database is just keywords, not all the other information, that is actual sample data. nobody, sign, word, framed, frame, fire, text, house, flames, signage, burning nobody, spring, seasonal, holiday, season, colored eggs, young, chicks, colorful, occasion, Easter, rabbit ive done this, except it still gives me a duplicate values of the word nobody $data = ''; $a = "SELECT keywords FROM library"; $a_result = $DB_MYSQL->QUERY($a); while ($b = mysql_fetch_array($a_result)){ $data .= $b['keywords'].','; } echo $data; echo "<br /><br />"; $keywords = explode(',',$data); print_r($keywords); echo "<br /><br />"; $unique = array_unique($keywords); print_r($unique);
-
Wondering how I would go about creating a nice script which would do the following: Gather all the data from one column of a database for multiple rows, for example: nobody, sign, word, framed, frame, fire, text, house, flames, signage, burning nobody, spring, seasonal, holiday, season, colored eggs, young, chicks, colorful, occasion, Easter, rabbit Put the above into an one array with each value a new key in the array. (Please note, there would be alot more than 2 rows in the database table). I would assume you have to explode the comma out to put each word into a new key in the array. Array to look like the following: nobody sign seasonal word framed fire nobody etc... Secondly I would like to remove all the duplicate values from the array. Then I would print the array out into a combo box. Is this possible? If so, how would i go about doing it? Huge thankyou in advance.
-
Hey guys, Not sure if this can be done using php, or how hard it would be to develop in php. Basically the idea has come up due to a client, not trusting his employees with email (to many emails to mates, etc) I would like to create a php based script to receive all the email from an email address on an smtp server, put all the email data into mysql, in different records per each email. Would the above be able to handle attached files? I can manage the part once i get the data into mysql.
-
How do you count the number of value after the decimal point? For example 38.88 = 2 characters after the decimal point 38.88888 = 5 characters after the decimal point. Any ideas if this is possible?
-
The other method i just thought about, not sure if it's possible. What if i do the calculation first, if the number is only 2 decimal places or less do nothing, just format into 2 decimal places, else if the number equals more than 2 decimal places run the ceil function? Would that work? If so, how do you find out how many decimal places in number so I can write the if statement.
-
roopurt18 your calculation rounds everything up. The calculation works out to be 38.88 but it will round up to 38.89, how can i stop ceil() rounding up numbers that already equal whole numbers with 2 dec places. So 38.8800 will stay as 38.88 but 38.8810 will go to 38.89. That's just the rule I need to enforce.
-
Lonewolf217 your calculation rounds down calculations that are: For example 38.8810 to 38.88 when i need that to go to 38.89. but when the calculation equals just 38.8800 it needs to stay and not round up.
-
My function works for 95% of the calculations, just values that have .7000 that are whole in some way, round up to the next number. eg .7000 to .8000. or .8800 to .8900 for what is happening in the above example. Just want it to stay.
-
Lonewolf217 you are correct, I should be seeing 38.88 as the answer, however i need to round numbers up that are like 38.882 to 38.89 hence why the ceil() is in the function, but it automatically rounds up numbers that come out as whole numbers making it not match with another system. How can I get ceil() to only round up numbers that do no equal 2 dec places exactly?
-
The real version works as it does not have a syntax error. $uscos = 9.6000; $a = 4.0500; $aRate = number_format(($uscos * $a), 4, '.', ','); $aTotal = number_format((ceil(100 * $aRate) / 100), 2, '.',','); echo $aTotal;
-
The above will round up numbers that I require to be rounded up. For example 41.3820 will equal 41.39. It just struggles to not round up numbers that equal .1700 or 37.7000 basically numbers that do not require any rounding to happen.
-
The problem I am experiencing is numbers are rounding up when they do not require to be rounded up. For example 46.1700 would round up to 46.18, it should just stay at 46.17. Another example 37.7000 would round up to 37.71, it should just stay at 37.70. I have the following calculation: $uscos = 9.6000 $a = 4.0500; $aRate = number_format(($uscos * $a), 4, '.', ','); $aTotal = number_format((ceil(100 * $aRate) / 100), 2, '.',','); echo $aTotal; The above should return 46.17 not 46.18. How can I stop rounding up numbers, that do not require rounding up... Help is very appreciated.
-
I have a field in my database to hold product descriptions. I would like to put a carriage return in place after each 132 characters. How would i go about doing this?
-
How do i convert a date/time 0000-00-00 00:00:00 into a string, and then convert back to a date/time? Basically i would like to store date/time values in a varchar field instead of a date/time field in mysql.