RE: [PHP] Best way to...
> $numMonths += ( 12 + ( $endMonth - $startMonth )); This last line should have read: $numMonths += ( 12 + ( $endYear - $startYear )); Too much cutting and pasting... :p Chris
RE: [PHP] best way to approach dates
Never worked with mysql but I would assume there's something like 'NOW' or now() or something similar, don't know how you'd put a different date in though :( timestamps are handy within php, you can then convert it to whatever format you want with date() or, if you wanted to go even further, create a date class and do all your date manipulation using objects... I've found that easier since I've got a class already written, but don't know where I've put it now :( so I can't send it... Martin -Original Message- From: Justin French [mailto:[EMAIL PROTECTED]] Sent: Monday, January 21, 2002 10:43 AM To: php Subject: [PHP] best way to approach dates Hi all, I'm looking to normalise the way in which I work with dates and times, hopefully saving myself some time and effort along the way. Currently, for, say, a news post, i'm using a MySQL DATE column (-MM-DD), but since this isn't all that good (visually) for use on a site, I find myself converting it back out to something like DD-MM-YY or DD-MM for use on the site. Not exactly hard, but it's gotta be done every time. Now I find myself wanting to sort things by date (where the ID might be in the wrong order... so 2001-12-25 is listed before 2001-12-26, etc), and more importantly, comparing two dates (3 days away, 3 days ago, 3 hours ago, etc etc). Would I be better off using a unix timestamp for everything, then using it to: - convert to different formats - compare - sort in date order - etc etc Also, I've noticed there is a timestamp column type in MySQL... is there a way to cut down on PHP code by using MySQl alone to enter the timestamp (or date) for me? Any other suggestions on a sensible method of implementing dates & times accross many sites and many bits of code? Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] best way to approach dates
Gidday Justin, For us guys that don't get dates very often, the subject is one of intense fascination! I answered a bunch of these questions a couple of weeks back, and reproduce that discussion below. Also some comments/responses to you interspersed:- > I'm looking to normalise the way in which I work with dates and times, > hopefully saving myself some time and effort along the way. > > Currently, for, say, a news post, i'm using a MySQL DATE column > (-MM-DD), but since this isn't all that good (visually) for use on a > site, I find myself converting it back out to something like DD-MM-YY or > DD-MM for use on the site. Not exactly hard, but it's gotta be done > every time. =to ease the effort of repeated activities employ/implement a function (as you say, saves time). Fortunately PHP and SQL/MySQL provide us with plenty, out of the box. > Now I find myself wanting to sort things by date (where the ID might be > in the wrong order... so 2001-12-25 is listed before 2001-12-26, etc), > and more importantly, comparing two dates (3 days away, 3 days ago, 3 > hours ago, etc etc). =the reason many people find ISO-format dates confusing is simply that they've grown up with something else (presumably in your case dd/mm/yy). If you sit down and think about the sequence of data, running from the largest unit to the smallest, consistently, you will see that it makes good sense. These have been adopted as local/national standards in various places, eg the EU, but we still don't see them too much - guess we're still smarting from KM vs miles and KG vs pounds-weight (I'm still paying off the bill for that 1KM of sausages I ordered...) =the reason it makes good sense in a computer is because it will fulfil basic functions in both use of a date: (1) to document some date/time, and (2) to be used in basic computations. The best example I can think of is a logging function, eg OpSys tools and Apache. Take a look at the native output any of these and you'll see ISO dates left, right, and center. Other date formats will fulfill one or other of these functions, but will not compromise between both so well. =if you want to sort an ISO date column, go ahead and do it. ISO dates can be compared, just as they are: 2001-12-25 < 2001-12-26 = true thus Christmas Day came before Boxing Day, last year (and most other years...) =This also applies to ISO dates expressed as an integer 20011225 < 20011226 = true =If you want to perform calculations on ISO-dates then check out the date functions section in the MySQL manual for DATE_ADD, DATE_DIFF, etc. They will achieve your comparisons, adjustments by period of time (days), etc. =In the same way, PHP has a rich set of date calculation functions, also well covered in their manual. However these are complementary and deal in the PHP prefered date formats. =Sadly, there is no substitute for hitting the books (see advice on this below). > Would I be better off using a unix timestamp for everything, then using > it to: > > - convert to different formats > - compare > - sort in date order > - etc etc > > Also, I've noticed there is a timestamp column type in MySQL... is there > a way to cut down on PHP code by using MySQl alone to enter the > timestamp (or date) for me? =see comments below about selecting the date format to suit the usage/purpose intended (if you don't want to spend all day converting back and forth - spending time, re-making time?). =There is no ONE right answer - that's why we've been given choices. BEWARE of the word "timestamp" in that a UNIX timestamp is not the same thing as a MySQL timestamp! > Any other suggestions on a sensible method of implementing dates & times > accross many sites and many bits of code? =here they come... one of your respondents talked about doing subtraction on ISO dates. This will not work - the discussion (below) started off with this question "why doesn't it work?":- RE: [PHP] counting with dates (help!) > $today = date("Ymd", mktime(0,0,0, date(m),date(d),date(Y))); > $last_week = date("Ymd", mktime(0,0,0, date(m),date(d)-7,date(Y))); > echo ($today - $last_week); > The result is a number like 8876 (20020107-20011231 = 8876) > But in date thinking it should be 7! No, that's the difference in time represented by the number of seconds. You still need to work with it a little more. 8876 / 60 = number of hours /* 60 = number of seconds in an hour */ 8876 / 60 / 24 = number of days. /* 24 = number of hours in a day */ =I'm sorry but neither the above, nor the suggestion of Julian dates was correct (in all cases). The two numbers ($today and $last_week) generated in the PHP code above are in CCYYMMDD format (as used by MySQL to store dates, BTW). =So you are correct (Sander): 20020107 less 20011231 equals 8876 =but this number is meaningless. If the formulae proposed above are applied, the answer is not 7 days. =Similarly (Julian dates = CCYYDDD format) 2002007 less 2001365 equals 642
Re: [PHP] best way to flush stdout?
I am not sure that it is the best way to do it but here is my solution: I redirect the page with: header("Location: page1.php); to page1.php which contains a message about the process in progress then after a few moments redirecting to page2.php with javascript: setTimeout("redirect()", 500) function redirect() { window.location = "page2.php" } In this case it redirects in 500msecs, ie half second. Then page2.php done the real job which is MySql query but does not display results or send anything to browser untill query completed. In that case the previous output stays on screen until the query completed. I know that it is not a efficient method but a solution. If anyone knows how to refresh a browser at anytime I will glad to know. And if someone knows if there is a way to refresh only one part of browser (I mean just inside a layer or so..) I really want to know. In that case one can show results as they come from database. It is really good if you have a huge database and searching on multiple tables and/or databases. yours, -- Tolga 'thorr' Orhon "Phil Glatz" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I have a page that displays a few lines, then runs a database query that > takes five or six seconds. I'd like to flush stdout and display the first > text while the query is running, so the user doesn't think the site is > down. What's the best way to accomplish this? thanks > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] best way to flush stdout?
On Mon, May 21, 2001 at 10:03:33AM -0700, Phil Glatz wrote : > I have a page that displays a few lines, then runs a database query that > takes five or six seconds. I'd like to flush stdout and display the first > text while the query is running, so the user doesn't think the site is > down. What's the best way to accomplish this? thanks Make sure output is not buffered via ob_* functions and just call 'flush()'. But note there's no real world fix because browsers can refuse to display immdiatly (depending on its rendering engine, etc) and apache can cache the output, too. - Markus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] best way to flush stdout?
For almost every browser there is, no data inside a will be displayed until the browser get's the matching , so that's one thing to remember. flush() "requests" that any buffered data be sent to the client, but most browsers have their own internal buffer. So in other words, you can't. ;) Plutarck "Phil Glatz" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I have a page that displays a few lines, then runs a database query that > takes five or six seconds. I'd like to flush stdout and display the first > text while the query is running, so the user doesn't think the site is > down. What's the best way to accomplish this? thanks > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Best Way to set cookies
you could print "Set-Cookie: name=value; etc. etc. etc." but setcookie(); is really what you want. > -Original Message- > From: Gonyou, Austin [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 02, 2001 12:40 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Best Way to set cookies > > > Id like to discuss what the best params are for setting cookies using PHP. > Specifically the expirey. Anyone? > > -- > Austin Gonyou > Systems Architect, CCNA > Coremetrics, Inc. > Phone: 512-796-9023 > email: [EMAIL PROTECTED] > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] best way to include html?
Just include() it. Duke wrote: > I'm setting up an html "shell" for my webpage that I include with my php > code so I don't have to see html crap and whatnot. > I'm wondering what the best way is to insert the html "shell" into my code? > Should I just echo the file, should I include(), require(), include_once(), > or require_once()?? > One section of the shell, which is in a separate file, is an html form - > would that change the way I include that particular section of html? > Thanks. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] best way to include html?
Easiest way I've possibly found is to shove it inside of a function which will echo it out, but with all the variables in their proper place. When I want to display something I just use: $front_page .= 'Text goes here'; In the function outout_html() I just put $front_page wherever I want it to be displayed (in the main table). If I'd like to change the format a page is displayed in I can just adjust the function or make a new one entirely, and I can avoid making a call to string replacement functions. Seems to work pretty well. I stick the declaration in a global file that all my scripts use to keep things simple. I haven't used a tag other than , , and in weeks. -- Plutarck Should be working on something... ...but forgot what it was. ""Duke"" <[EMAIL PROTECTED]> wrote in message 002301c0c87d$9f1e3c80$[EMAIL PROTECTED]">news:002301c0c87d$9f1e3c80$[EMAIL PROTECTED]... > I'm setting up an html "shell" for my webpage that I include with my php > code so I don't have to see html crap and whatnot. > I'm wondering what the best way is to insert the html "shell" into my code? > Should I just echo the file, should I include(), require(), include_once(), > or require_once()?? > One section of the shell, which is in a separate file, is an html form - > would that change the way I include that particular section of html? > Thanks. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Best way to frequently check database?
To timeout users after 20 minutes, use a cookie which is set for 20 minutes. I'm not exactly sure what you are attempting to limit on database: 100 entries per hour, per day, per year, concurrently? -Original Message- From: Hawk [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 31, 2002 3:58 PM To: [EMAIL PROTECTED] Subject: [PHP] Best way to frequently check database? Let's say I have a database that recieves new information about 6 times/minute and I want the database to be checked to frequently to limit the maximum entrys to the database to.. let's say 100. And also timeout users if their session has been inactive for, let's say 20 minutes. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Best way to frequently check database?
On Thu, 31 Jan 2002, Rick Emery wrote: > To timeout users after 20 minutes, use a cookie which is set for 20 minutes. But once again you can have problems with cookies, they're not reliable (user can have cookies support turned off) and they tend to be good for CSS attacks :( You could have a timestamp updated in every access to a page, and then a cron job to delete the entries with timestamps older than some interval of time. But I guess that if your app will have tons of load, this is not a very good solucion :) Regards. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] best way to read a file
Actually if you have output buffering active then the easiest hassle free way to read a file into a variable is like this.. Pretty cool eh? Hope that helps. -- Kevin Stone [EMAIL PROTECTED] -Original Message- From: Erik Price [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 5:03 PM To: [EMAIL PROTECTED] Subject: [PHP] best way to read a file This is a really simple question that I've wondered for a while now... what is the best way to read a file? There are so many different functions for reading files that I have no idea which I should use. readfile() returns its values to standard output -- I don't want to use this, since my script needs to load the data in the file into a variable (it's a .xsl file). fgets() looks like it could work if I made an array out of each line read and then imploded them. fread() looks like the 'main' function for reading from files. fpassthru() -- I guess if you're already in the middle of a file it's a good way to finish? There are other functions for reading files, but they are less ambiguous, with purposes like reading from sockets or certain kinds of files. I'm not interested in those -- I just want to know which function I should use to simply read a file and store the file's contents in a variable (for later actions to be performed on/with this variable). Thank you. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] best way to read a file
you didn't mention file() that one can be pratical because it returns an array of lines (linefeed intact, implode with empty string), but can be memory consuming for large files, because the entire file is in memory the at the same time. some times you don't need the entire file (at a time) .. for example fread() allows you to read a specific length fgets() one text line at a time with max length fgetss() ..and strip HTML.. fgetcsv() or return a line from a .csv as an array.. not really ambiguous, and I think these functions being flexible enough to handle other resource types can hardly be seen as a disadvantage.. bvr. Erik Price wrote: > This is a really simple question that I've wondered for a while now... > > what is the best way to read a file? There are so many different > functions for reading files that I have no idea which I should use. > > readfile() returns its values to standard output -- I don't want to > use this, since my script needs to load the data in the file into a > variable (it's a .xsl file). fgets() looks like it could work if I > made an array out of each line read and then imploded them. fread() > looks like the 'main' function for reading from files. fpassthru() -- > I guess if you're already in the middle of a file it's a good way to > finish? > > There are other functions for reading files, but they are less > ambiguous, with purposes like reading from sockets or certain kinds of > files. I'm not interested in those -- I just want to know which > function I should use to simply read a file and store the file's > contents in a variable (for later actions to be performed on/with this > variable). > > Thank you. > > > Erik > > > > > > > > Erik Price > Web Developer Temp > Media Lab, H.H. Brown > [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] best way to read a file
On Thursday, March 28, 2002, at 07:34 PM, bvr wrote: > not really ambiguous, (actually, that's what I was saying, that they are -less- ambiguous, and more specific, but no big deal on that little matter). > and I think these functions being flexible enough to handle other > resource types can hardly be seen as a disadvantage.. Every time I try to use one of these functions, I get an error message from my browser (not from PHP) that the attempt to load the URL failed. Is this a sign of running into memory problems? If so, what can I do about it? It seems that the only file-reading function that doesn't create this error message in my script is fgets(), but as soon as I try to implode the lines I pulled with fgets() into one string, I get the error message again. In other words, every time I try to pull my XSL file into my script, it happens. (I would not have imagined I would run out of memory b/c I have php.ini set to 16M per script and the XSL file is only 8kB, though the script does do a lot of things.) Anybody know what's going on here? Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] best way to read a file
>> not really ambiguous, > > (actually, that's what I was saying, that they are -less- ambiguous, > and more specific, but no big deal on that little matter). ok, misunderstood > > Every time I try to use one of these functions, I get an error message > from my browser (not from PHP) that the attempt to load the URL > failed. Is this a sign of running into memory problems? If so, what > can I do about it? It seems that the only file-reading function that > doesn't create this error message in my script is fgets(), but as soon > as I try to implode the lines I pulled with fgets() into one string, I > get the error message again. In other words, every time I try to pull > my XSL file into my script, it happens. > > (I would not have imagined I would run out of memory b/c I have > php.ini set to 16M per script and the XSL file is only 8kB, though the > script does do a lot of things.) > > > Anybody know what's going on here? Try not to use MSIE when developing or install the debug thingie, otherwise you will not get sensible feedback on what went wrong during page load.. Anyway, it's probably not the memory limit, because in that case PHP reports an error.. Did you even enable-memory-limit ?? If you did, use can try this with your httpd.conf : Add somewhere global : LogFormat "%h %l %u %t \"%r\" %>s %b %{mod_php_memory_usage}n" php Add to mainserver/virtualhost: CustomLog /usr/local/apache/logs/access_log php This adds an extra value to the access log entries that indicates the largest number of bytes of memory used by the script at a time. bvr. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] best way to read a file
while we're on the topic, what's the best way to append an CSV line onto the end of a text file? ---mail.csv--- Justin,French,[EMAIL PROTECTED]\n Fred,Flintstone,[EMAIL PROTECTED]\n Barny,Rubble,[EMAIL PROTECTED]\n --- I'd like to append a new line:: $newline = "Hank,Foo,[EMAIL PROTECTED]\n"; ...onto the end of file. I guess the process is, but I'm keen to hear improvements :) I can't find fulock(), so I guess closing the $fp unlocks the lock. Many thanks, Justin French Creative Director http://Indent.com.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] best way to read a file
On Thursday, March 28, 2002, at 08:14 PM, bvr wrote: > Try not to use MSIE when developing or install the debug thingie, > otherwise you will not get sensible feedback on what went wrong during > page load.. Good advice, I'll try with Mozilla. > Anyway, it's probably not the memory limit, because in that case PHP > reports an error.. I'm starting to suspect the same, read on... > Did you even enable-memory-limit ?? If you did, use can try this with > your httpd.conf No, I didn't... I just noticed that in php.ini there is a setting for max memory per script (default was 8M, I raised it to 16 before, when I thought this was the problem). I believe the problem is the xslt_process() function. I actually was able to read the file in my script after all, so I'm almost positive that it's not a problem with that. No, what happened in fact was that if the file was read successfully, it was passed as an argument to the xslt_process() function. If xslt_process() was the source of my problem, then that would explain why it crapped out every time I included file-reading functions -- because I wasn't testing in isolation, rather, I was testing with the xslt_process() function and couldn't see the forest for the trees. I'm going to try some of the other methods for using xslt_process() listed at the man page, I was trying the simpler 3-argument version. There's a more complex 6-argument function that I will try now, and see if that works. But it seems that I only get this error when attempting a successful xslt_process(). (I know that it is successful because I am testing its success in the script.) Thanks, bvr. I'll continue to bug test. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best way to store login data?
Hello Leif, My opinion is 1.First do md5 encoding for passwords. 2.Store the username and encoded passwords in database as well as in two cookies. Note:But storing the passwords in a cookie is a security issue. regards, SenthilVelavan.P, KovaiTeam Softwares. - Original Message - From: "Leif K-Brooks" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, June 15, 2002 10:39 AM Subject: [PHP] Best way to store login data? > I have a site with logins. I am planning to recode logins soon (right > now the username and password are stored in cookies with no encoding). > In your opinion, which of these is a better idea: > 1. Storing in two cookies with md5 encoding for the password > 2. Use sessions > 3. Store logins in a database, and put an id from there into a cookie > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best way to store login data?
Hi I would suggest you use a DB for the logins and use the id Avoid using cookies use sessions that way u have nothing on the client end Pradeep - Original Message - From: "Leif K-Brooks" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, June 15, 2002 10:39 AM Subject: [PHP] Best way to store login data? > I have a site with logins. I am planning to recode logins soon (right > now the username and password are stored in cookies with no encoding). > In your opinion, which of these is a better idea: > 1. Storing in two cookies with md5 encoding for the password > 2. Use sessions > 3. Store logins in a database, and put an id from there into a cookie > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best way to describe Doc as HTML
Addressed to: "Karl J. Stubsjoen" <[EMAIL PROTECTED]> [EMAIL PROTECTED] ** Reply to note from "Karl J. Stubsjoen" <[EMAIL PROTECTED]> Thu, 25 Jan 2001 08:36:43 -0700 > > Hello, So I think I've found 3 ways to describe the HTML Doc as > "HTML". Which one is the best? > > 1) Via MetTag (this was generated in Dreamweaver): > > > > 2) Print Statement at top of page: > > print "Content-type: text/html\n\n"; > > 3) Using the PHP Header command: > > header( "Content-type: test/html" ); > > What do you think? > 4) Do nothing. text/html is the default content type for php. A Content-type: text/html header is sent for you unless you specify something else. Rick Widmer Internet Marketing Specialists http://www.developersdesk.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Best way to describe Doc as HTML
> print "Content-type: text/html\n\n"; That's the "perl" method, because perl doesn't have any native functions for adding stuff to the response header, so you just print it :) > header( "Content-type: test/html" ); The above is correct. _alex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Best way to put text on image
Todd, I'm not sure if you can write text to an existing image as I add to a new one but here is the code I use... $updateTime = date("F d, Y - h:ia"); $text = "New Movie Reviews @hyrum.net ".$updateTime; $image = ImageCreate(500, 70); $bg = ImageColorAllocate($image, 255, 255, 255); $blue = ImageColorAllocate($image, 0, 0, 255); $black = ImageColorAllocate($image, 0, 0, 0); $himage= ImageCreateFromPNG("/home/hyrum/public_html/images/topics/hyrum.png"); ImageRectangle($image, 0, 0, 500, 70, $white); ImageCopy($image, $himage, 410, 5, 1, 1, 89, 64); ImageString($image, 4, 0, 0, $text, $blue); ImageString($image, 3, 0, 20, $title1, $black); ImageString($image, 3, 0, 35, $title2, $black); ImageString($image, 3, 0, 50, $title3, $black); ImagePNG($image, "signature.png"); ImageDestroy($image); So you could create a new image and copy your jpg to the new canvas or (and preferably) someone will know if you can add text to an already existing image... Jeff > -Original Message- > From: Todd Cary [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, July 04, 2001 6:30 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Best way to put text on image > > > If I have a JPEG image, what is the best way to put text or another > image at a certain place using the gd library? > > Todd > > -- > Todd Cary > Ariste Software > [EMAIL PROTECTED] > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Best way to get the remote IP address?
I can't seem to find any references to HTTP_X_FORWARDED_FOR in the PDF PHP documentation from January 2001, so you should probably best stick with either $HTTP_SERVER_VARS['REMOTE_ADDR'] or simply $REMOTE_ADDR (if you use $REMOTE_ADDR in functions make sure you do a global on it first) - I personally use $REMOTE_ADDR, but you should read the docs for details... Bogdan Alan McFarlane wrote: > I'm trying to get the remote IP address of a user in a (PHP) version and > server-software independant way, but am having a few problems. > > Obviously, I've seen $HTTP_SERVER_VARS['REMOTE_ADDR'], but Ive also seen > references to $HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR']. > > Is there any generic solution to this problem (and if so, what is it?) > > Cheers > -- > Alan McFarlane > [EMAIL PROTECTED] > ICQ: 20787656 > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Best way to get the remote IP address?
> I can't seem to find any references to HTTP_X_FORWARDED_FOR in the PDF PHP > documentation from January 2001, so you should probably best stick with > either $HTTP_SERVER_VARS['REMOTE_ADDR'] or simply $REMOTE_ADDR (if you use > $REMOTE_ADDR in functions make sure you do a global on it first) - I > personally use $REMOTE_ADDR, but you should read the docs for details... That's because it's probably not so much a PHP thing. X-Forwarded-For is normally used when going through a proxy. Say my internal IP is 192.168.1.15, and my proxy's official IP address is 132.248.10.2, then we'd have this: REMOTE_ADDR=132.248.10.2 X_FORWARDED_FOR=192.168.1.15 That way, even when going through a proxy, there's information about who originally submitted the request. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Best way to get the remote IP address?
> either $HTTP_SERVER_VARS['REMOTE_ADDR'] or simply $REMOTE_ADDR (if you use > $REMOTE_ADDR in functions make sure you do a global on it first) - I > personally use $REMOTE_ADDR, but you should read the docs for details... using $REMOTE_ADDR directly is fine as long as the "register_global" setting is off. otherwise, it's wiser to use getenv('REMOTE_ADDR') instead of $REMOTE_ADDR directly. -- Jimmy Failure doesn't mean you'll never make it. It just means it may take longer. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Best way to get the remote IP address?
here is a piece o fcode that looks up user ip from env vars recursively 22/01/2002 04:57:50, Jimmy <[EMAIL PROTECTED]> wrote: >> either $HTTP_SERVER_VARS['REMOTE_ADDR'] or simply $REMOTE_ADDR (if you use >> $REMOTE_ADDR in functions make sure you do a global on it first) - I >> personally use $REMOTE_ADDR, but you should read the docs for details... > >using $REMOTE_ADDR directly is fine as long as the >"register_global" setting is off. > >otherwise, it's wiser to use getenv('REMOTE_ADDR') instead of >$REMOTE_ADDR directly. > >-- >Jimmy > >Failure doesn't mean you'll never make it. It just means it may take longer. > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Best way to get the remote IP address?
Hi, Simply... test for HTTP_X_FORWARDED_FOR if it exists, then your client are behind a proxy server, the REMOTE_ADDR is the proxy IP, and HTTP_X_FORWARDED_FOR is the client IP (if not faked by the proxy). hope this helps, Antonio. On Mon, 21 Jan 2002, Bogdan Stancescu wrote: > I can't seem to find any references to HTTP_X_FORWARDED_FOR in the PDF PHP > documentation from January 2001, so you should probably best stick with > either $HTTP_SERVER_VARS['REMOTE_ADDR'] or simply $REMOTE_ADDR (if you use > $REMOTE_ADDR in functions make sure you do a global on it first) - I > personally use $REMOTE_ADDR, but you should read the docs for details... > > Bogdan > > Alan McFarlane wrote: > > > I'm trying to get the remote IP address of a user in a (PHP) version and > > server-software independant way, but am having a few problems. > > > > Obviously, I've seen $HTTP_SERVER_VARS['REMOTE_ADDR'], but Ive also seen > > references to $HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR']. > > > > Is there any generic solution to this problem (and if so, what is it?) > > > > Cheers > > -- > > Alan McFarlane > > [EMAIL PROTECTED] > > ICQ: 20787656 > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Antonio S. Martins Jr. - System Analist | "Only The Shadow Knows | | WorldNet Internet Maringa - PR - Brasil | what evil lurks in the | | E-Mail: [EMAIL PROTECTED] | Heart of Men!" | | [EMAIL PROTECTED] | !!! Linux User: 52392 !!! | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ This e-mail message is 100% Microsoft free! /"\ \ / CAMPANHA DA FITA ASCII - CONTRA MAIL HTML X ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL / \ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Best way to check if a query succeeded
On Thursday 29 March 2001 13:00, you wrote: > Hi, > i was just wondering what you guys do to check if a wquery suceeded or > not? I know about mysql_num_rows() and mysql_affected_rows(), just > wondered what you guys do? Check the return code of mysql_query(). The only safe method. -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) Pretty cool, the kind of power information technology puts in our hands these days. - Securityfocus on probing 3600 hosts for known problems in 3 weeks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Best way to check if a query succeeded
What about: $sql = "SELECT something FROM table"; $result = mysql_query($sql) or die ("Query failed!"); do_something(); //the query has succeeded if we get to this line HTH Jon -Original Message- From: Jordan Elver [mailto:[EMAIL PROTECTED]] Sent: 29 March 2001 12:00 To: PHP Database Mailing List; PHP General Mailing List Subject: [PHP] Best way to check if a query succeeded Hi, i was just wondering what you guys do to check if a wquery suceeded or not? I know about mysql_num_rows() and mysql_affected_rows(), just wondered what you guys do? I normally do something like: $sql = "SELECT something FROM table"; $result = mysql_query($sql); if(@mysql_num_rows($result) > 0) { echo'Query Suceeded'; } else { echo'Query failed'; } Cheers, Jord -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] ** 'The information included in this Email is of a confidential nature and is intended only for the addressee. If you are not the intended addressee, any disclosure, copying or distribution by you is prohibited and may be unlawful. Disclosure to any party other than the addressee, whether inadvertent or otherwise is not intended to waive privilege or confidentiality' ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Best way to store 1000 char in a database
What do you mean "the best way"? Do you mean which data type you should give the field? A bit more info please. :-) Tyler Longren Captain Jack Communications www.captainjack.com [EMAIL PROTECTED] - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 06, 2002 8:50 PM Subject: [PHP] Best way to store 1000 char in a database What is the best way to store text with up to 1000 characters in a mySQL database? Sorry for the slightly of topic posting but I am not going to join another mailing list unless I have to. I am going to create a weekly qoute generator thingy for my site. JJ Harrison [EMAIL PROTECTED] www.tececo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best way to store 1000 char in a database
On Fri, Jun 07, 2002 at 11:50:10AM +1000, [EMAIL PROTECTED] wrote: > What is the best way to store text with up to 1000 characters in a > mySQL database? http://mysql.com/doc/C/o/Column_types.html --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best way to pass SQL TEXT field via a link
Yes it would be a lot better to just passed the id in the url. py - Original Message - From: Fates <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, March 11, 2001 5:12 PM Subject: [PHP] Best way to pass SQL TEXT field via a link > I'm trying to update an existing record based on a link that represents > the record to update. > > I have a link and I am passing variables that were assigned from a SQL > database to another php form page which will be used to update the > record. I'm passing variable like so: href='addupdate.php?name=$name&category=$category&description=$etc. > > This works fine for variables that contain values of only a few lines > but what about passing a couple paragraphs stored in variable > $description assigned via database value as TEXT. > > Would it be better just to pass the database record ID to the > destination page and then query the record in the destination form page > and populate the form with the current values and update the record or > is there another way I don't know about? > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Best way to pass SQL TEXT field via a link
Actually the best would be if you would remain in the page so you dont have to pass any variables along the url but just in a submit form to the current page. There you could include your addupdate.php with a trigger like and just ask that value of that field in an if-clause. if true just include the addupdate and execute it along. Hope that helps, Jens Nedal on 11.03.2001 18:12 Uhr, Fates at [EMAIL PROTECTED] wrote: > I'm trying to update an existing record based on a link that represents > the record to update. > > I have a link and I am passing variables that were assigned from a SQL > database to another php form page which will be used to update the > record. I'm passing variable like so: href='addupdate.php?name=$name&category=$category&description=$etc. > > This works fine for variables that contain values of only a few lines > but what about passing a couple paragraphs stored in variable > $description assigned via database value as TEXT. > > Would it be better just to pass the database record ID to the > destination page and then query the record in the destination form page > and populate the form with the current values and update the record or > is there another way I don't know about? > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Best way to pass SQL TEXT field via a link
I'm passing the ID in the url, as recommended, and then having other problems that may or may not really be pertinent to this list: 1) The mySQL text data ($description) won't populate my form. I'm using input, and it just won't accept and display the value of $description. It's empty, and when the form is re-submitted after editing, it empties the $description variable. 2) I also have image uploads in my form, and the inputs will not accept values, either. Same problem as above .. the empty input areas cause the image names to be deleted from my database when the form is edited and re-submitted. I can think of a few kludgy workarounds, but I'd rather have a way to get these and inputs to accept values. Any help would be wonderful! ms -Original Message- From: Pierre-Yves Lemaire <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] <[EMAIL PROTECTED]> Date: Sunday, March 11, 2001 6:52 AM Subject: Re: [PHP] Best way to pass SQL TEXT field via a link >Yes it would be a lot better to just passed the id in the url. > >py > >- Original Message - >From: Fates <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Sent: Sunday, March 11, 2001 5:12 PM >Subject: [PHP] Best way to pass SQL TEXT field via a link > > >> I'm trying to update an existing record based on a link that represents >> the record to update. >> >> I have a link and I am passing variables that were assigned from a SQL >> database to another php form page which will be used to update the >> record. I'm passing variable like so:> href='addupdate.php?name=$name&category=$category&description=$etc. >> >> This works fine for variables that contain values of only a few lines >> but what about passing a couple paragraphs stored in variable >> $description assigned via database value as TEXT. >> >> Would it be better just to pass the database record ID to the >> destination page and then query the record in the destination form page >> and populate the form with the current values and update the record or >> is there another way I don't know about? >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> To contact the list administrators, e-mail: [EMAIL PROTECTED] >> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Best way to pass SQL TEXT field via a link
> 1) The mySQL text data ($description) won't populate my form. I'm using > input, and it just won't accept and display the value of > $description. It's empty, and when the form is re-submitted after editing, > it empties the $description variable. How are you printing the value? With textarea you need to do: instead of: http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Best way to duplicate tables to another DB using PHP
mysqldump would work pretty well if the source DB is mysql, but it's a DB I have to access via ODBC on a windows box instead. And this particular DB doesn't seem to have a command line interface to export a table that I can call from PHP. David - Original Message - From: sagar N Chand To: David Yee Sent: Wednesday, October 03, 2001 6:09 AM Subject: Re: [PHP] Best way to duplicate tables to another DB using PHP use mysql statement mysql_dump thru php. /sagar - Original Message - From: David Yee To: [EMAIL PROTECTED] Sent: Wednesday, October 03, 2001 2:52 AM Subject: [PHP] Best way to duplicate tables to another DB using PHP Hi guys. What do you suggest is the best (fastest, most efficient) way to duplicate a table from one database to another using PHP? I have a windows machine setup with ODBC for this old school DB (Pervasive SQL 7) and I would like to duplicate some of the tables into a Linux box with MySQL for some datawarehousing purposes. The largest table is about 30K records. I'm not sure if something like a "select *" and then doing a foreach record insert into MySQL would be the best way. Thanks for any suggestions. David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Best way to duplicate tables to another DB using PHP
Nope- nothing useful yet anyways :-). I guess maybe the only thing to do is to select different ranges for the table (if it's too big) instead of a select with no where clause. Now to think of it I guess you can even select one record at a time sequentially if the pk is integer based. Then you can do something like: for ($i=0; i++; i<$num_rows_in_table){ $q="select * from my_table where id = $i"; $result=odbc_exec($connect, $q); etc. (e.g. insert into the target mysql DB/table) } David - Original Message - From: "Joseph Koenig" <[EMAIL PROTECTED]> To: "David Yee" <[EMAIL PROTECTED]> Sent: Wednesday, October 03, 2001 6:47 AM Subject: Re: [PHP] Best way to duplicate tables to another DB using PHP > David, > > Did you get any responses on this post? I'm actually looking at a very > similiar situation and thinking the exact same thing. I've done a > "select *" and then a while loop before to accomplish this, but with dbs > where the largest table was about 1K rows. Big difference. Please let me > know if you get any responses or find anything out. Thanks, > > Joe > > David Yee wrote: > > > > Hi guys. What do you suggest is the best (fastest, most efficient) way to > > duplicate a table from one database to another using PHP? I have a windows > > machine setup with ODBC for this old school DB (Pervasive SQL 7) and I would > > like to duplicate some of the tables into a Linux box with MySQL for some > > datawarehousing purposes. The largest table is about 30K records. I'm not > > sure if something like a "select *" and then doing a foreach record insert > > into MySQL would be the best way. Thanks for any suggestions. > > > > David > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Best way to take a copy of a Database from Server to server
>How can i take a dump of first database (which is about 1MB) and restore >that dump on the second one? If you have Telnet access use the mysqldump and mysql clients to export then import. Regards Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Best way to take a copy of a Database from Server to server
This might be of some use? http://www.mysql.com/doc/m/y/mysqlhotcopy.html == Karl Phillipson PHP SQL Programmer Saffron Hill Ventures 67 Clerkenwell Road London EC1R 5BL Saffron Hill: 0207 693 8300 Direct Line: 0207 693 8318 -Original Message- From: elias [mailto:[EMAIL PROTECTED]] Sent: 07 August 2001 14:53 To: [EMAIL PROTECTED] Subject: [PHP] Best way to take a copy of a Database from Server to server Hello. I have two MySql databases running on different servers. I have no root access and only PHP + Mysql and MysqlAdmin. How can i take a dump of first database (which is about 1MB) and restore that dump on the second one? Actually, I'm doing a structure dump, but the outputed SQL text is very big!..I'm not able to paste it all in the second server's sql query textbox. Any ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Best way to take a copy of a Database from Server to server
Hello elias, Tuesday, August 07, 2001, 3:52:57 PM, you wrote: e> Hello. e> I have two MySql databases running on different servers. I have no root e> access and only PHP + Mysql and MysqlAdmin. e> How can i take a dump of first database (which is about 1MB) and restore e> that dump on the second one? e> Actually, I'm doing a structure dump, but the outputed SQL text is very e> big!..I'm not able to paste it all in the second server's sql query textbox. You can do it from your machine with mysqldump. syntax is: mysqldump --host=here_write_sql_server_1 --user=user --password=hassword name_of_database > file.txt On the second server you can do it with command mysql --host=here_write_sql_server_2 --user=user --password=hassword name_of_database < file.txt I hope it helps -- Best regards, Danielmailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Best way to take a copy of a Database from Server to server
No I don't really have Telnet accessI have only access to phpMyAdmin 2.0.1 via my Hosting Control Panel... And it happens that both servers have this tool to access the database. How can I copy from a server to another? Please Help! "Jon Farmer" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > >How can i take a dump of first database (which is about 1MB) and restore > >that dump on the second one? > > > If you have Telnet access use the mysqldump and mysql clients to export then > import. > > Regards > > Jon > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Best way to take a copy of a Database from Server to server
Just a very big guess. Can you use system or exec command to run one of those telnet commands from a PHP script? Or even better idea, can you ask your hosts to do it for you :) Andrew - Original Message - From: "elias" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, August 07, 2001 3:26 PM Subject: Re: [PHP] Best way to take a copy of a Database from Server to server > No I don't really have Telnet accessI have only access to phpMyAdmin > 2.0.1 via my Hosting Control Panel... > And it happens that both servers have this tool to access the database. > > How can I copy from a server to another? > > Please Help! > > > "Jon Farmer" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > >How can i take a dump of first database (which is about 1MB) and restore > > >that dump on the second one? > > > > > > If you have Telnet access use the mysqldump and mysql clients to export > then > > import. > > > > Regards > > > > Jon > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]