Re: [PHP] data move from mssql to mysql via php
blackwater dev wrote: I have an app with a requirement to hit an external mssql db and move the data to a local mysql database. What's the best way to do this? I was thinking of querying the mssql db and writing the contents to a flat file then using mysql load data from infile query to pump it in but I am not sure if this is the best option so am looking for suggestions Thanks! You can easily do this; you could also cut out the middleman and use the ODBC driver to import/export directly. HTH Matt Darby -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image resizing...
Sonia wrote: Hi All I've been working on finishing a project SGML2IMAGE and I am sort of having trouble with resizing of images. I am trying to just use the GD library so when I distro the package it will not need any other things installed to be used. Now I am using... imagecreatetruecolor (); imagecreatefrom___ (); imagecopyresampled (); image___ (); But the thumbnails look blurry for any image less than 50% of the original image created by the PHP SGML parser. So my question seeing I am not very good with the GD library. Am I using the best functions to do the resize or should I be using some other image function(s) that may give better results! To give you a idea of what I am doing see the demo running on my note book http://24.218.192.217/capture.php Thanks sonia Here is the method I use: $destimg=imagecreatetruecolor($aspect_w, $aspect_h); $srcimg=imagecreatefromjpeg($path.$files[$i]); imageantialias($destimg,true); imagecopyresized($destimg,$srcimg,0,0,0,0,$aspect_w,$aspect_h,ImageSX($srcimg),ImageSY($srcimg)); imagejpeg($destimg,$dest_dir.$image_name); imageantialias() might do some good in your case. HTH! Matt Darby -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image resizing...
Sonia wrote: Hi All I've been working on finishing a project SGML2IMAGE and I am sort of having trouble with resizing of images. I am trying to just use the GD library so when I distro the package it will not need any other things installed to be used. Now I am using... imagecreatetruecolor (); imagecreatefrom___ (); imagecopyresampled (); image___ (); But the thumbnails look blurry for any image less than 50% of the original image created by the PHP SGML parser. So my question seeing I am not very good with the GD library. Am I using the best functions to do the resize or should I be using some other image function(s) that may give better results! To give you a idea of what I am doing see the demo running on my note book http://24.218.192.217/capture.php Thanks sonia Actually, imagecopyresized() would be what you're looking for; imageantialias() can't hurt either ;) Matt Darby -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PDF Thumbnails
I wrote a script for this; it's designed to run from the command line in *nix, but can be triggered via exec(): Usage: ./pdf2thumb.php source_dir out_dir [code] #!/usr/local/bin/php ? function getDirFiles($dirPath){ $filesArr=array(); if ($handle = opendir($dirPath)){ while (false !== ($file = readdir($handle))) if ($file != . $file != ..){$filesArr[] = trim($file);} closedir($handle);} return $filesArr; } function usage(){ echo(USAGE: pdf2thumb source_folder_path destination_folder_path\n\n); exit; } if(!isset($argv[1])){usage();} substr($argv[1],-1)==/?$path=$argv[1]:$path=$argv[1]./; isset($argv[2])?$dest_path=$argv[2]:$dest_path=$path; substr($dest_path,-1)==/?$dest_path=$dest_path:$dest_path.=/; $total_time=0; $total_files=0; if(!file_exists($dest_path)){`mkdir $dest_path`;} $files=getDirFiles($path); for($i=0;$icount($files);$i++){ if(substr($files[$i],-3)==pdf){ echo(Converting .$files[$i] ); $time_start = microtime(true); $old_name=$path.$files[$i]; $new_name=$dest_path.str_replace(.pdf,.jpg,$files[$i]); `/usr/bin/convert '$old_name' -thumbnail 240x160 '$new_name'`; $time_end = microtime(true); $convert_time=round($time_end-$time_start,2); echo(Done. ($convert_time seconds)\n); $total_time+=$convert_time; $total_files++; } } echo(\n---\n); echo($total_files files converted in .round($total_time/60,2). $minutes (AVG: .round($total_time/$total_files,2).s)\n\n); ? [/code] [EMAIL PROTECTED] wrote: You would haven't happen to have an example? I am new to imagemagick. Any help would be greatly appreciated. On 9/26/05, Jim Moseby [EMAIL PROTECTED] wrote: -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, September 26, 2005 1:43 AM To: php-general@lists.php.net Subject: [PHP] PDF Thumbnails I give my users an option to upload pdf files to my site and would like them to see a thumbnail view of the file once uploaded. Has anyone heard of a way how to do this? The 'convert' function of ImageMagick will do it. JM
Re: [PHP] Fast count of recordset in php...
$num=mysql_num_rows($sql); Gustav Wiberg wrote: Hello there! How do i get a fast count of a recordset in php? Look at this code: $sql = SELECT COUNT(IDVara) cn FROM tbvara WHERE Varunamn LIKE '$checkLev%'; $querys = mysql_query($sql); //Count products in db // $dbArray = mysql_fetch_array($querys); $nrOfProducts = $dbArray[cn]; It's slow... Why? Any suggestions? /mr G @varupiraten.se -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error Suppression with '@'
Justin Burger wrote: Good Morning, I was having a discussion with a fellow PHP Developer this morning and he mentioned that he put's an '@' sign in front of all function calls, and every time he accesses an array; I know that this is sloppy, and dangerous, but I don't know exactly what this exposes him to, can any one give me any real world examples of why this is bad, so I can relate it to his code? php.net does not have much information about this. It seems like suppressing errors, rather then catching them is problematic. Thanks Again. Justin. This is a Bad Idea. A Very Bad Idea actually. If he's just looking to hide error output, he should at least edit php.ini to log to an error file. Otherwise, debugging his code would be horrible. The @ is total slop. Matt Darby -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirect with referer info
Dotan Cohen wrote: Hi list, I need to redirerect a page, and send the referer information along with the redirect. I have tried: header(Location: $url); and printhtmlheadmeta http-equiv='refresh' content='0; URL=$url' //head/html; Both of them redirect as expected, but the browser (Firefox and Opera) do not send referer information along with the request. As this is for link affiliates, I need that referer info sent with the request. How to do that? Thanks. Dotan Cohen Song Lirics http://song-lirics.com/sl/artists.php/b Song Lirics URL parameters. $url=www.somesite.org?id=asdfreferrer=2345; header(Location: $url); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Running a PHP script everyday
[EMAIL PROTECTED] wrote: In my pevious hunt through cron I didn't even notice the PHP CLI. So I will be figuring that out today probably. My server runs on Linux. Not sure which distro though. I'll have to ask. My script will be getting e-mail addresses from my SQL db and sending them a pic of the day. I got the HTML MimeMail 2.5.1 to work perfectly, now I just need to figure out how to make it run without me doing anything. Thanks! Andrew Darrow Kronos1 Productions www.pudlz.com - Original Message - From: James Kaufman [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Saturday, July 30, 2005 10:07 AM Subject: Re: [PHP] Running a PHP script everyday On Sat, Jul 30, 2005 at 09:17:20AM -0700, [EMAIL PROTECTED] wrote: I have a PHP script that I need to run once a day. I have it currently setup so that I just run it from my cell phone, but I would prefer something automated. I'd looked into a cron job, but that just looks like it's for doing linux command line stuff on my host. I also thought about writing a never ending while loop with an if statement that checks to see if it's time to run the script, then when it is time, it runs. Then checks to see if it's time again. But even assuming I could get it working, do I really want to have a PHP script that runs all the time. This could be bad if it ate up all the CPU on my server. I'm not even sure I have access rights to kill the process once I start it. Any suggestions? Andrew Darrow Kronos1 Productions www.pudlz.com You don't state what OS you are using, but you certainly can use cron under Linux to run a PHP script. What really matters is what does the PHP script do? For example, I have a PHP script that I run periodically that retrieves data from a database and updates a text file on the disk. What does your script do? -- Jim Kaufman Linux Evangelist public key 0x6D802619 CCNA, CISSP# 65668 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.338 / Virus Database: 267.9.7/60 - Release Date: 7/28/2005 http://www.redhat.com/docs/manuals/linux/RHL-7.2-Manual/custom-guide/cron-task.html Unless you have a shebang line (#!/path/to/php/binary)at the top of your script, you will have to preface your script's path in your cron entry with the location of the PHP binary: 0 1 1,15 * * /path/to/php/binary /root/scripts/System_Dump.php Matt Darby -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is it possible.
jenny mathew wrote: hello group, i have a problem and hope anybody here will be able to hep me out. i have a downloads folder in my server which contains all the files in zipped form to be downloaded by members.members are authenticated by entering username and password.and when they click to download the files ,they are forwarded to the the full file url by using header function of php.But the problem is that ,when the users click once to download a file ,they can see the whole url and so next time they can easily download the file by entering the full url in the browser ,so there is no use of authentication next time and this leads to bandwidth theft and the urls of files are circulating in the emails and users are downloading the files without becoming the user of the site and without authenticating themselves.I know there are many professionals in this group who are very experienced and have helped me earlier.this is a very serious problem and i need a solution to this.What are your views? Is there any solution for it? waiting for your replies. Thanks, Jenny Route the email link through a script that checks for availability based on a user name, or email address; have the link as such: http://www.somesite.org/download.php?file=filenameuser=login name When this user clicks this email, it will direct them to download.php, where you could setup a call to a database. If this is the first time this user has accessed this file, set a flag in the database that this link is no longer valid, and redirect the user's browser to the file (check out the header function). The link in the email will only be valid once (or as many times as you allow). You could even tie this in with a login/password form. HTH! Matt Darby -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Prepopulating form fields afer an error
select name=user $_REQUEST['user']==$curr_user?$select=selected:$select=; echo(option $select$curr_user/option); /select Jack Jackson wrote: Hi, I have a form and it does basic error checking after submission; when the user omits required fields it kicks back the form with highlighted errors telling them the error of their ways. I've sussed out that by populating the value of the field with $fieldvalue I can have that form field populated with the data the user *did* enter for that field: something like input type=text name=email_address value=?php echo $email_address? That works great. But how can I do the same thing for drop down boxes, when they select an option? I tried the unwieldy, select name='blah' ?php if (!empty(blah)) { echo option value='; echo $blah; echo ' echo $blah; echo /option\n; } ? And that, lo and behold, didn't work. Can anyone offer a suggestion? Thanks in advance JJ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How would you create a tracking pixel?
A blank (transparent) pixel would be more difficult, but a simple colored pixel would be easy: In target file: img src=pixel.php pixel.php ? $im=imagecreate(1,1); $white=imagecolorallocate($im,255,255,255); imagesetpixel($im,1,1,$white); header(content-type:image/jpg); imagejpeg($im); imagedestroy($im); ? I guess this begs the question, why not use session variables to track activity?? Matt Darby Brian Dunning wrote: I want to create a pixel that can be used to track certain activity on the site. I've got it working fine: I just mod_rewrite spacer.gif to a PHP app that does what I want it to do; but then I don't know how to actually return a blank pixel. Can anyone point me in the right direction? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Affiliate Tracking [Management] program
Eugene Voznesensky wrote: I' looking for free PHP/MySQL Affiliate Tracking [Management] program. Would appreciate any advice/idea fd. Have you looked over sourceforge.net? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Konqueror does not like my Website
The easiest way to fix this is to validate your output. Konqueror is likely more picky about correct code. Here is validator output: http://validator.w3.org/check?uri=http%3A%2F%2Fmichelle.konzack.home.tamay-dogan.homelinux.net%2Ftdlandmap%2F Michelle Konzack wrote: Hello *, I an developing a tool which let me scroll in a very big (some 1000 kmĀ²) topographical map. For testing I have installed a citymap of Offenburg/Germany but I get only en empty HTML-Page in Konqueror, but ist works in Mozilla, Firefox and InfernalExploder. The Link is: http://michelle.konzack.home.tamay-dogan.homelinux.net/tdlandmap/ Does anyone know this Bug ? Greetings Michelle -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Rate to charge
timothy johnson wrote: I have been asked to look in toprogramming a PHP system for someone, and while I have been programming for a while this will be the first time it will be for someone other then a friend. Just wanted to get some ideas on how much you charge for program PHP/Mysql. Any ideas on how to charge would be great. Thanks I charge $50/hr. Be very careful when you specify a timeline, it will always take at least 10-25% more than you estimate! It's better to over estimate and complete earlier. At least it makes you look good ;) Good Luck! Matt Darby -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] My Project
It *is* a great book (I cut my teeth with it as well): PHP and MySQL Development (Welling and Thomson) http://www.amazon.com/exec/obidos/tg/detail/-/0672326728/qid=1121869940/sr=8-1/ref=pd_bbs_1/002-5827183-4477639?v=glances=booksn=507846 Read it, learn it, live it. Matt Darby Jay Blanchard wrote: [snip] Hey, Look I made a new database just for this money testing stuff. This is the table: CREATE TABLE `money` ( `money` varchar(255) NOT NULL default '' ) TYPE=MyISAM; Now, I use this code $sqlUpdate = UPDATE `myDatabase`.`myTable` SET `myMoney` = (`myMoney`-10) WHERE `myCharacter` = `characterName` ; $doUpdate = mysql_query($sqlUpdate, $myConnection); And it should work, And it gives no error but it is not writing anything into the database. [/snip] Anyone else want to go for shorter? :) The reason is George, as someone so aptly pointed out, it appears that you have jumped in without any basic knowledge. And thus far we have all been nice (because we usually get chided for our terseness). So let me be the first to say RTFM, STFW and STFA and get a better book such as PHP and MySQL Development (Welling and Thomson) or one of a dozen others. Google for PHP tutorials. Read them, try them, learn them. Now let me explain where you went wrong above Your table needs two columns, one for money and one for characterName. Make money decimal(8,2) and characterName char(64) then do the following query INSERT INTO `money` (`money`, `characterName`) VALUES ('100.00', 'Village_Id10t'); Now do a select from the table to see the values entered. See them? Good! Now perform the following query; $sqlUpdate = UPDATE `money` SET `money` = (`money`-10) WHERE `characterName` = `Village_Id10t` ; $doUpdate = mysql_query($sqlUpdate, $myConnection); Now do a select again and look at the values, did it work? Excellent! Run this query; $sqlUpdate = UPDATE `money` SET `money` = (`money`-10) WHERE `characterName` = `Town_Drunk` ; $doUpdate = mysql_query($sqlUpdate, $myConnection); Now do a select from the table and note that the value of money did not change. The reason is because there is no Town_Drunk in the money table. Does that make sense? Wonderful!
Re: [PHP] redirecting some values from one page to other in php
babu wrote: It will become a big mess up for me if i combine all the files as they are large files. Matt Darby [EMAIL PROTECTED] wrote: babu wrote: I am using header method for redirecting to another php file.I also want to pass some variables to the redirected file. for example: file1.html where i have a dropdown menu. the user selects the options... this form has a action to file2.php file2.php--- i get the values of the form by using $_POST. In this file i will do some processing on data and redirect to file3.php file3.php here i need the user select menu items. i think i can use require_once(file2.php) in file3.php and get the values.But i want to get the values selected by user from html form. Thanks for the help. babu - Why not just combine all three files into one? So long as you place the form processing code over the actual HTML PHP code that generates your webpage, all will be fine.. To do this all you need to do is set your form action= Matt Darby Yahoo! Messenger NEW - crystal clear PC to PCcalling worldwide with voicemail - Yahoo! Messen Sorry -- Hit Reply instead of Reply to All :) ger NEW - crystal clear PC to PCcalling worldwide with voicemail
Re: [PHP] redirecting some values from one page to other in php
babu wrote: does session.auto_start should be set to 1 for sessions to work. Mikey [EMAIL PROTECTED] wrote:babu wrote: I am using header method for redirecting to another php file.I also want to pass some variables to the redirected file. for example: file1.html where i have a dropdown menu. the user selects the options... this form has a action to file2.php file2.php--- i get the values of the form by using $_POST. In this file i will do some processing on data and redirect to file3.php file3.php here i need the user select menu items. i think i can use require_once(file2.php) in file3.php and get the values.But i want to get the values selected by user from html form. Thanks for the help. babu - Yahoo! Messenger NEW - crystal clear PC to PCcalling worldwide with voicemail You could put them in session vars - http://uk.php.net/manual/en/ref.session.php Mikey So long as you call session_start(); at the very top of your scripts, sessions will work. session.auto_start is fine if your entire site will be using sessions. Matt Darby
Re: [PHP] PHP and MySQL and resouce limits
John Hinton wrote: I don't get it... I have been upping my memory limit for PHP. 32megs now... and am making calls to a database on a different server. I see the loads run up on the other server as it cruches the numbers.. and PHP is in the process of creating a single little page with about 40 numbers on it, from these returns. Now, I do know I'm crunching a LOT of data in this instance, but it seems like MySQL is doing the work and that PHP shouldn't be hitting 32 my 32meg wall. Running the same query on a smaller dataset doesn't hit this limit, so I know it's not a function of the PHP code itself. So, I must be missing something, why is PHP somehow tied to the work MySQL is doing? As in memory usage seems that MySQL should be simply sending PHP the returns on its commands... hm Thanks, John Hinton Are you sure your query is correct? This happens to me sometimes if the query is rather crazy... Matt Darby -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] My Project
George B wrote: Jay Blanchard wrote: [snip] $money -= 10; saves some chars ;) [/snip] This actually requires two trips to the database, once to get $money and once to update $money. Do it in the query instead...once. $sqlUpdate = UPDATE `myDatabase`.`myTable` SET `myMoney` = (`myMoney`-10) WHERE `myCharacter` = `characterName` ; $doUpdate = mysql_query($sqlUpdate, $myConnection); saves lots of characters ;) Hey, Look I made a new database just for this money testing stuff. This is the table: CREATE TABLE `money` ( `money` varchar(255) NOT NULL default '' ) TYPE=MyISAM; Now, I use this code $sqlUpdate = UPDATE `myDatabase`.`myTable` SET `myMoney` = (`myMoney`-10) WHERE `myCharacter` = `characterName` ; $doUpdate = mysql_query($sqlUpdate, $myConnection); And it should work, And it gives no error but it is not writing anything into the database. Lots of extra characters in that one... try this: $q=mysql_query(update myTable set myMoney=(myMoney-10) where myCharacter='characterName'); if(!$q){echo mysql_error();} -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need help with PHP / MySQL connect problem
Using this at the top of your script will allow PHP and MySQL to interact. $_POST['dbconn']=mysql_select_db(database_name, mysql_connect(server_name,user_name,password)); It does sound like you have notices and warnings turned off in php.ini: Find php.ini (not sure where it installs to in Windows version), and set error_reporting = E_ALL. This will show all notices and warnings generated by your PHP code; extremely usefull in debugging. Matt Darby Linda H wrote: Hi, I'm running MySQL 4.0.21, Apache 2.0.52 and PHP 5.0.2 on a Windows XP system. I can run scripts with PHP and HTML statements and see correct output in my browser. But when I try to connect to MySQL I get nothing, including no error messages. One book I have says to run the following scrip to test the connection. It should print either the Resource name or an error message: ?php echo mysql_connect ('localhost','calendar','pass1234'); # host, user, password ? I get no output at all, and if the statement is placed in a larger script, above html/PHP output, it suppresses that as well. Using the mysql monitor from the DOS command prompt, I can connect as user 'calendar' with password 'pass1234', select a database and execute SQL statements successfully. Can anyone help me figure out why I can't seem to connect, please? Linda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need help with PHP / MySQL connect problem
Try this just for kicks: ? aslkdjfalsd; ? See if this will output errors. It's rather hard to debug without error messages ;) If I remember correctly, isn't php.ini supposed to be in c:/PHP? Linda H wrote: Thanks for the advice, Matt, but it doesn't seem to solve my problem. php.ini is in the C:Program Files/WINDOWS directory and error_reporting was set to E_ALL. I found php5ts.dll in the WINDOWS/system32 directory. I copied it to WINDOWS/system, just in case. My install instructions said to put it with my other dlls, which might be in either directory. Most of them are in system32. Using this at the top of your script will allow PHP and MySQL to interact. $_POST['dbconn']=mysql_select_db(database_name, mysql_connect(server_name,user_name,password)); I put this in my script (changing parameters as appropriate) but got no results and no error messages. Any other ideas. I've spent hours on this, trying everything I could think of and I'm very frustrated. The rest of my output is still suppressed if I put the connect script above it in the file. It does sound like you have notices and warnings turned off in php.ini: Find php.ini (not sure where it installs to in Windows version), and set error_reporting = E_ALL. This will show all notices and warnings generated by your PHP code; extremely usefull in debugging. Matt Darby Linda H wrote: I'm running MySQL 4.0.21, Apache 2.0.52 and PHP 5.0.2 on a Windows XP system. I can run scripts with PHP and HTML statements and see correct output in my browser. But when I try to connect to MySQL I get nothing, including no error messages. One book I have says to run the following scrip to test the connection. It should print either the Resource name or an error message: ?php echo mysql_connect ('localhost','calendar','pass1234'); # host, user, password ? I get no output at all, and if the statement is placed in a larger script, above html/PHP output, it suppresses that as well. Using the mysql monitor from the DOS command prompt, I can connect as user 'calendar' with password 'pass1234', select a database and execute SQL statements successfully. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need help with PHP / MySQL connect problem
You should definitely see a listing for MySQL in phpinfo()... What order did you install MySQL/PHP/Apache? Linda H wrote: I added the following to the top of my script: ?php echo phpinfo(); ? Got all sorts of environment and path info. Not anything about MySQL, but I didn't see anything that looked obviously wrong, though I don't understand a lot of it. I ried reinstalling MySQL, Apache, and PHP. No change. Linda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy Remote File to Local Server
Wouldn't something like rsync be better suited for this? I only ask because I've run something like this before... Matt Darby Richard Davey wrote: Hello Matt, Saturday, July 16, 2005, 3:04:29 AM, you wrote: MP I am writing a script that will read a file from a remote server MP and write it to the local server. It works fine except when large MP files are attempted. It times out and gives the error that the MP maximum execution time has been reached and the file will only be MP partially copied to the local server. Is there a way around MP something like this? Or perhaps could the script keep time of how MP long it has been running will reading/writing and then be able to MP continue writing to the partial file? Does anyone have any MP suggestions for this problem? Providing you feel it's safe / user friendly to do so, just increase the time-out: set_time_limit() Best regards, Richard Davey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Refresh
Put this between the page's head tags: meta http-equiv=REFRESH content=1;url=http://somesite_to_refresh_to; The 1 in the above line controls the time to refresh; the higher the number, the longer to refresh. Matt Darby Miguel Guirao wrote: Hello people, I need to have a web page (PHP) that displays a status about electric facilities, this status is read from a database (MySQL), the thing is that these status may change from time to time in the DB so I need to re read the DB and display the according status on the web page. So, Is there a way to refresh or reload the page every 10 minutes automatically? Regards, --- Miguel Guirao Aguilera Logistica R8 TELCEL Tel. (999) 960.7994 Cel. 9931 600. Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta dirigido; contiene informacion estrictamente confidencial y legalmente protegida, cuya divulgacion es sancionada por la ley. Si el lector de este mensaje no es a quien esta dirigido, ni se trata del empleado o agente responsable de esta informacion, se le notifica por medio del presente, que su reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio este comunicado por error, favor de notificarlo inmediatamente al remitente y destruir el mensaje. Todas las opiniones contenidas en este mail son propias del autor del mensaje y no necesariamente coinciden con las de Radiomovil Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos. This message is for the sole use of the person or entity to whom it is being sent. Therefore, it contains strictly confidential and legally protected material whose disclosure is subject to penalty by law. If the person reading this message is not the one to whom it is being sent and/or is not an employee or the responsible agent for this information, this person is herein notified that any unauthorized dissemination, distribution or copying of the materials included in this facsimile is strictly prohibited. If you received this document by mistake please notify immediately to the subscriber and destroy the message. Any opinions contained in this e-mail are those of the author of the message and do not necessarily coincide with those of Radiomovil Dipsa, S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries companies. No part of this message or attachments may be used or reproduced in any manner whatsoever. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tired and feeling dumb...maths question....
$average = round(($votes/$pts),2); ;) Ryan A wrote: people vote on a scale of 1-5, so the average should be between 1-5 (right?? am not even sure of this!) Yes. I was thinking of rounding it with a 2 decimal point...eg: round(5.045, 2) Just need to solve this and them am hitting the sack, any help appreciated. Solve what? I must have missed the problem. Oops, sorry guys...girlfriends on holiday so have not had my medicine :-) and am also braindead right now... basically...how do I get the average? $pic_no_of_votes --- holds the total number of votes (eg: 212) $vote_total_pts holds the total points from all those votes (eg: 1027) how do i get the average down to something like: 3.23 or 1.02 or 4.11 etc Thanks, Ryan
[PHP] Echo array string index?
I have an array setup as such: *$arr['generated text']='generated number';* What would be the best way to echo the key in a loop? Seems pretty easy but I've never attempted... Thanks all! Matt Darby