Re: [PHP-DB] ADDING DATES
Yep, maybe it is, but when a post starts with " ... but i am getting lazy", I get a bit peeved. The implication is "Do my work for me." It's different when the context is I want to do this ... tried this ... results aren't right ... please help. Miles At 06:04 PM 1/13/2002 -0800, Daniel Barton wrote: >Miles, >Hmm... "RTFM!" .. >That's a pretty unproductive post. > >Pedro, >There are two PHP functions that will suffice. date() and mktime(). > >I've cut and pasted this from the PHP manual: > >$tomorrow = mktime (0,0,0,date("m") ,date("d")+1,date("Y")); >$lastmonth = mktime (0,0,0,date("m")-1,date("d"), date("Y")); >$nextyear = mktime (0,0,0,date("m"), date("d"), date("Y")+1); > >That should do the trick. > >-db > >Miles Thompson wrote: > > > RTFM! > > > > At 12:17 AM 1/14/2002 +, Pedro M. S. Oliveira wrote: > > > > >Hi all, first of all i'm sorry to ask this but i am getting lazy and i bet > > >you all can answer me in a couple of code lines. > > >i want to add some days to the the result of the date php function. > > >how can i had lets say 3 days? > > >ex: > > >(pseudo code) > > > > > > > >$date =date(,mm,dd); > > >$date =date(,mm,dd) + 3days; > > >echo $date; > > >echo "thank you all"; > > >?> > > > > > >Thanks > > >Pedro > > > > > > > > >-- > > >PHP Database 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 Database 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] > >-- >-- >Dan Barton >Terrestrial Program Biologist >Asst. Data Manager >Point Reyes Bird Observatory >http://www.prbo.org >[EMAIL PROTECTED] >[EMAIL PROTECTED] -- PHP Database 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-DB] Sanitizing user input for interaction with DB.
I've started a thread on the topic some time ago on the php list, after some extensive reading and testing and these were the main conclusions: 1.1. ALWAYS pass "addslashed" values and always pass them quoted in the SQL statement. That is "insert into table1 set id='$id'" even if $id is known to always have numeric values. That's because you may get an $id='; delete where 1=1'. This specific situation results in an error message in MySQL, but... better safe than sorry. If you do this, make sure you addslshes($id) beforehand - otherwise you may get an $id="'; delete where 1=1" and that would still be potentially dangerous. An alternative to this would be 1.2. addslashes() to text values and for numeric values just do an "$id=abs($id)" beforehand - this elimiates text from $id, evaluating it to an integer/float. 2. Make sure you are extra careful with delete statements. In generic statements, your main concern should be general security, so that people can't access data they're not supposed to (that's because, as I said, passing two SQL statements usually issues an error). In delete statements however, you may get for your "delete from table1 where id=$id" a $id of the form "1 or 1=1" which would delete you whole table. 3. OT, but you should be very extra super careful when using exec() Well, that's about all there is to it (in my opinion anyways). The big problem is sticking to it and always use these. The problem is even bigger if you develop for open-source because... You get it... Bogdan PS. Only now have I noticed you are using PostgreSQL. Never worked with it but it seems it's able to accept multiple queries from a single PHP call, so you should seriously consider points 1.1 and 1.2. -- PHP Database 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-DB] Sanitizing user input for interaction with DB.
Hi Benny, I know this is a bit of a run-around again, but try the annotated manual on php.net, it has some good examples of using things here and there. Specifically useful functions are htmlspecialentities() htmlspecialchars() addslashes() stripslashes() nl2br() also, as far as using regexps goes, you would probably normally want to do something like (pseudo-esqu :P) if (!eregi("", "")) { fail; } hope something in there helps :) /beau // -Original Message- // From: C. Bensend [mailto:[EMAIL PROTECTED]] // Sent: Monday, 14 January 2002 10:49 AM // To: [EMAIL PROTECTED] // Subject: [PHP-DB] Sanitizing user input for interaction with DB. // // // // Hey folks, // // Let me preface this with the fact that I know // information like this exists online, but it's a bear // trying to find good examples. I checked the list archives, // and got minimal information. Also, I'm posting to this list // rather than the -users because this does target a database // environment. // // I am working on a very basic project to put a bunch // of computer-related information into a searchable PostgreSQL // database. I'm using PHP 4.0.6 to connect to PostgreSQL // 7.1.2, via Apache 1.3.20. // // I'm a sysadmin, so one of my first concerns is for // my site to be as secure as I can make it, without crippling // my ability to do anything. Hence, I have taken reasonable // steps to minimize the chances of problems, like connecting // to the database with an unprivileged user (SELECT privs // on only the necessesary tables). The user can't DROP, or // INSERT, or anything. // // I'm now looking for real, working examples for scrubbing // input submitted via a form. I've gone over code snippets, read // security-related articles, and haven't been able to find any // real (read - targetted at beginning developers) examples for // this. I want to take the safer approach, and only allow a set // of characters, rather than trying to weed out the "evil." // // I would greatly appreciate it if you folks could // pass me some URL's for this, or some small blurbs of code... // I've read dozens of 'use regex' hints, but I need to understand // a bit more about how to _use_ them, not how to _form_ them. // // Sorry to be so long winded... I appreciate any tips/tricks/URLs // you can give me. :) Thanks! // // Benny // // // ~~ // A 'good' landing is one from which you can walk away. A 'great' // landing is one after which they can use the plane again. // --Rules of the Air, #8 // // // // -- // PHP Database 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 Database 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-DB] Sanitizing user input for interaction with DB.
Hey folks, Let me preface this with the fact that I know information like this exists online, but it's a bear trying to find good examples. I checked the list archives, and got minimal information. Also, I'm posting to this list rather than the -users because this does target a database environment. I am working on a very basic project to put a bunch of computer-related information into a searchable PostgreSQL database. I'm using PHP 4.0.6 to connect to PostgreSQL 7.1.2, via Apache 1.3.20. I'm a sysadmin, so one of my first concerns is for my site to be as secure as I can make it, without crippling my ability to do anything. Hence, I have taken reasonable steps to minimize the chances of problems, like connecting to the database with an unprivileged user (SELECT privs on only the necessesary tables). The user can't DROP, or INSERT, or anything. I'm now looking for real, working examples for scrubbing input submitted via a form. I've gone over code snippets, read security-related articles, and haven't been able to find any real (read - targetted at beginning developers) examples for this. I want to take the safer approach, and only allow a set of characters, rather than trying to weed out the "evil." I would greatly appreciate it if you folks could pass me some URL's for this, or some small blurbs of code... I've read dozens of 'use regex' hints, but I need to understand a bit more about how to _use_ them, not how to _form_ them. Sorry to be so long winded... I appreciate any tips/tricks/URLs you can give me. :) Thanks! Benny ~~ A 'good' landing is one from which you can walk away. A 'great' landing is one after which they can use the plane again. --Rules of the Air, #8 -- PHP Database 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-DB] ADDING DATES
> At 12:17 AM 1/14/2002 +, Pedro M. S. Oliveira wrote: > > > >Hi all, first of all i'm sorry to ask this but i am getting lazy and > >i bet you all can answer me in a couple of code lines. i want to add > >some days to the the result of the date php function. how can i had > >lets say 3 days? ex: (pseudo code) > > > > >$date =date(,mm,dd); > >$date =date(,mm,dd) + 3days; > >echo $date; > >echo "thank you all"; > >?> Try this: $today = date("F j, Y, h:i a"); $tomorrow = date ("F j, Y, h:i a", mktime(0,0,0,date(m) ,date(d)+3,date(Y))); echo " today is $today Tommorow will be $tomorrow "; from function.date.html in the manual that came from the website and I use a search tool to search the manual for keywords, so rtfm is valid here. Peter --- "Reality is that which, when you stop believing in it, doesn't go away". -- Philip K. Dick -- PHP Database 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-DB] Can't use field names in print
you should be able to just change the mysql_fetch_row to a mysql_fetch_array and then use the names rather than the numbers in your print (modified below, not tested :) // "); // } // ?> /beau -- PHP Database 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-DB] Can't use field names in print
Thanks for the quick response. I left out the part you mention, here is the whole code (the one that works); "); } ?> I just can't seem to be able to access the array using the column names from the table. Pete "Beau Lebens" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > you need to use the *_fetch_array() functions > > i.e. if you are using MySQL > > $SQL = "something"; // build SQL query > $result = mysql_query($SQL); // execute query, save all results in $result > $firstResult = mysql_fetch_array($result); // create an array containing > each returned record > > // subsequent calls to mysql_fetch_array($result) will get each record > > HTH > > Beau > PS please excuse email butchering my single-line comments :) > > > // -Original Message- > // From: planomax [mailto:[EMAIL PROTECTED]] > // Sent: Monday, 14 January 2002 10:13 AM > // To: [EMAIL PROTECTED] > // Subject: [PHP-DB] Can't use field names in print > // > // > // To output each row, this works: > // > // print("$row[0] - $row[1] - $row[2]"); > // > // But using the table's field names, I don't see anything: > // > // $ID=$row["ID"]; > // $test1=$row["test1"]; > // $test2=$row["test2"]; > // print ("$ID - $test1 - $test2"); > // > // I'm used to using Cold Fusion and want to learn PHP. Any > // help would be > // appreciated. Thanks. > // Pete > // > // > // > // -- > // PHP Database 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 Database 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-DB] Can't use field names in print
you need to use the *_fetch_array() functions i.e. if you are using MySQL $SQL = "something"; // build SQL query $result = mysql_query($SQL); // execute query, save all results in $result $firstResult = mysql_fetch_array($result); // create an array containing each returned record // subsequent calls to mysql_fetch_array($result) will get each record HTH Beau PS please excuse email butchering my single-line comments :) // -Original Message- // From: planomax [mailto:[EMAIL PROTECTED]] // Sent: Monday, 14 January 2002 10:13 AM // To: [EMAIL PROTECTED] // Subject: [PHP-DB] Can't use field names in print // // // To output each row, this works: // // print("$row[0] - $row[1] - $row[2]"); // // But using the table's field names, I don't see anything: // // $ID=$row["ID"]; // $test1=$row["test1"]; // $test2=$row["test2"]; // print ("$ID - $test1 - $test2"); // // I'm used to using Cold Fusion and want to learn PHP. Any // help would be // appreciated. Thanks. // Pete // // // // -- // PHP Database 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 Database 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-DB] Can't use field names in print
To output each row, this works: print("$row[0] - $row[1] - $row[2]"); But using the table's field names, I don't see anything: $ID=$row["ID"]; $test1=$row["test1"]; $test2=$row["test2"]; print ("$ID - $test1 - $test2"); I'm used to using Cold Fusion and want to learn PHP. Any help would be appreciated. Thanks. Pete -- PHP Database 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-DB] ADDING DATES
Miles, Hmm... "RTFM!" .. That's a pretty unproductive post. Pedro, There are two PHP functions that will suffice. date() and mktime(). I've cut and pasted this from the PHP manual: $tomorrow = mktime (0,0,0,date("m") ,date("d")+1,date("Y")); $lastmonth = mktime (0,0,0,date("m")-1,date("d"), date("Y")); $nextyear = mktime (0,0,0,date("m"), date("d"), date("Y")+1); That should do the trick. -db Miles Thompson wrote: > RTFM! > > At 12:17 AM 1/14/2002 +, Pedro M. S. Oliveira wrote: > > >Hi all, first of all i'm sorry to ask this but i am getting lazy and i bet > >you all can answer me in a couple of code lines. > >i want to add some days to the the result of the date php function. > >how can i had lets say 3 days? > >ex: > >(pseudo code) > > > > >$date =date(,mm,dd); > >$date =date(,mm,dd) + 3days; > >echo $date; > >echo "thank you all"; > >?> > > > >Thanks > >Pedro > > > > > >-- > >PHP Database 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 Database 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] -- -- Dan Barton Terrestrial Program Biologist Asst. Data Manager Point Reyes Bird Observatory http://www.prbo.org [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP Database 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-DB] The New Guy
I do a lot of work with Perl and have decided to see what this PHP is all about. The best way for me to do that, is to just do a project. Here is what I am looking to do. I would like to use PHP and the SQL language on a CSV or Flat File Database. A lot of my work is on unix system that people want to work with Access. They do not want to pay the extra amount of money fora MySQL database. The answer to this issue is access with exports to CSV files for some of the simplier stuff like shopping carts and members and stuff like that. Here's the thing, can PHP interact with a flat file databse like perl and the DBD::CSV? If so can someone point me in the right idrection to get started. I have a server for development and it now has 4.0 PHP. -- PHP Database 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-DB] ADDING DATES
RTFM! At 12:17 AM 1/14/2002 +, Pedro M. S. Oliveira wrote: >Hi all, first of all i'm sorry to ask this but i am getting lazy and i bet >you all can answer me in a couple of code lines. >i want to add some days to the the result of the date php function. >how can i had lets say 3 days? >ex: >(pseudo code) > >$date =date(,mm,dd); >$date =date(,mm,dd) + 3days; >echo $date; >echo "thank you all"; >?> > >Thanks >Pedro > > >-- >PHP Database 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 Database 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-DB] ADDING DATES
Hi all, first of all i'm sorry to ask this but i am getting lazy and i bet you all can answer me in a couple of code lines. i want to add some days to the the result of the date php function. how can i had lets say 3 days? ex: (pseudo code) Thanks Pedro -- PHP Database 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-DB] Re: Defining Arrays
(Well, actually $text[1] should be "e" ;-) ) Bogdan Bogdan Stancescu wrote: > Why don't you try > $denc[]=substr($text,$i,1); > > Not to mention that $text[1] already is "h". > > Bogdan -- PHP Database 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-DB] Re: Defining Arrays
Why don't you try $denc[]=substr($text,$i,1); Not to mention that $text[1] already is "h". Bogdan Thomas \"omega\" Henning wrote: > Something i forgot > when i echo("$denc[1]"); then it types Array out !!! > "Thomas "Omega" Henning" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hello, > > > > I'm curently working on an Encryption Bot for IRC that sends encrypted > > messages to other bots linked 2 it and users that are log into it. > > How i define an Array so i can use something like this > > > $text="hello"; > > for ($i=0;$i > $denc[$i]=substr($text,$i,1); > > } > > echo("$denc[1]"); > > ?> > > Theoraticly (in C++ point of view) that should print out "h". > > Any idias helps alot > > > > Thanks > > > > Thomas "omega" Henning > > > > > > > > -- > PHP Database 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 Database 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-DB] Re: Moving from MySQL to MSSQL Server 2000
Hello, Boaz Yahav wrote: > > You realize that what they did will never work with an Ecommerce auction > site where everything must be in real-time... Why do you say that? Because you think you will need to handle as much requests as they do but always with upto date information? AFAIK, most of e-commerce site requests are content publishing of front store pages. Most of that can be handled with no real time database access either with static pages or cached content. Unless you are going to sell 30 million items like Amazon did in X-Mas, you won't need great hardware for that. Anyway, for busy sites is always a good idea to avoid read only database accesses or else your site will not scale. Besides content caching, it is always important to avoid database accesses for simple but repetitive things like session authentication. Regards, Manuel Lemos -- PHP Database 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-DB] Re: Moving from MySQL to MSSQL Server 2000
Hello, Boaz Yahav wrote: > My main problem is that MySQL is not "Cluster Aware". > I never heard of a MySQL server being able to perform a "Fail Over" to > another node. > > Did you? I never used MySQL in a cluster myself, but AFAIK, if it would not do fail-over, what good a cluster would be for when a cluster server is too busy? I think you should address these questions directly to MySQL AB. Regards, Manuel Lemos -- PHP Database 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-DB] Re: Moving from MySQL to MSSQL Server 2000
Hello, Boaz Yahav wrote: > > It's not just that... > For example, when I want to backup the MySQL server (and we are talking > of a few GB of data) the server is practically dead while making the > dump. MSSQL Server 2000 (for example) does that in the background and > you can keep working... > > Any ideas? You don't have that problem if you use MySQL with Gemini tables of NuSphere. Regards, Manuel Lemos -- PHP Database 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-DB] Re: [PHP] convert yyyy/mm/dd to mm/dd/yyyy, how?
You use the right tool for the job. MySQL is going to have to format the date field for the return anyway. It makes sense to simply tell MySQL your preferred format instead of having it returned to you in the wrong format and then you having to apply more gear to get it into the right one. -Rasmus On Sun, 13 Jan 2002, DL Neil wrote: > Rasmus, > > I have held several datetime-related conversations with people recently, and another >series about 'when'/whether > to use PHP or MySQL functionality. > > Here you are, "the man" of PHP, advising Sander to use MySQL functionality! (and in >marked contrast to the > (biased) advice one might expect on PHP lists, eg JDEW's reply) I'm grinning at the >apparent incongruity, but > with no insult to yourself. > > Would you care to comment further on when one should consider using SQL commands in >favor of implementing > identical functionality in PHP (and possibly in some situations, vice-versa)? > > Regards, > =dn > > > > - Original Message - > From: "Rasmus Lerdorf" <[EMAIL PROTECTED]> > To: "Sander Peters" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: 13 January 2002 19:52 > Subject: [PHP-DB] Re: [PHP] convert /mm/dd to mm/dd/, how? > > > > MySQL has plenty of functions to return dates to you in any format you > > specify. Please read > > >http://mysql.com/documentation/mysql/bychapter/manual_Reference.html#Date_and_time_functions > > and pay special attention to the DATE_FORMAT() function. > > > > -Rasmus > > > > > > > > On Sun, 13 Jan 2002, Sander Peters wrote: > > > > > Hello everybody, > > > > > > convert /mm/dd to mm/dd/, how? > > > > > > MYSQL does everything in /mm/dd. > > > I live in the Netherlands and we are use to the format dd/mm/. > > > > > > What's the best way to display it as mm/dd/ in a table on a query? > > > > > > My first idea whas to split the date up in vars in php and then print > > > the vars in the way I like it > > > Is this a bad idea? Or are there better sollutions? > > > > > > Thanx in advance for answering! > > > > > > > > > > > > -- > > > Met vriendelijke groet / With Greetings, > > > > > > Sander Peters > > > > > >site: http://www.visionnet.nl/ > > > email: mailto:[EMAIL PROTECTED] > > > webmail: mailto:[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 Database 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 Database 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-DB] Re: Moving from MySQL to MSSQL Server 2000
Yes. PostgreSQL. On Sun, 13 Jan 2002, Boaz Yahav wrote: > It's not just that... > For example, when I want to backup the MySQL server (and we are talking > of a few GB of data) the server is practically dead while making the > dump. MSSQL Server 2000 (for example) does that in the background and > you can keep working... > > Any ideas? -- PHP Database 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-DB] Re: Moving from MySQL to MSSQL Server 2000
Hi! InnoDB is multiversioned. You can start a transaction, dump all your tables inside a single transaction using SELECT INTO OUTFILE and you get a snapshot of your database at a precise point of time. Because of multiversioning, your tables are not locked during the dump. I am also writing a (non-free) hot incremental binary backup program for InnoDB which will be even faster than SELECT INTO OUTFILE. It will run in background. Regards, Heikki -Original Message- From: Boaz Yahav <[EMAIL PROTECTED]> To: Heikki Tuuri <[EMAIL PROTECTED]> Cc: Manuel Lemos <[EMAIL PROTECTED]>; [EMAIL PROTECTED] <[EMAIL PROTECTED]> Date: Sunday, January 13, 2002 10:45 PM Subject: RE: [PHP-DB] Re: Moving from MySQL to MSSQL Server 2000 >It's not just that... >For example, when I want to backup the MySQL server (and we are talking >of a few GB of data) the server is practically dead while making the >dump. MSSQL Server 2000 (for example) does that in the background and >you can keep working... > >Any ideas? > >-Original Message- >From: Heikki Tuuri [mailto:[EMAIL PROTECTED]] >Sent: Sunday, January 13, 2002 10:42 PM >To: Boaz Yahav >Subject: RE: [PHP-DB] Re: Moving from MySQL to MSSQL Server 2000 > > >Hi! > >If you are not happy with MyISAM's lack of transactions or row level >locking >or crash recovery, you could try InnoDB type tables in MySQL. > >You can use MySQL's master -> slave replication to get failover >capability. > >Best regards, > >Heikki Tuuri >Innobase Oy >--- >InnoDB - transactions, row level locking, and foreign key support for >MySQL >See http://www.innodb.com, download MySQL-Max from http://www.mysql.com > > -- PHP Database 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-DB] Re: Moving from MySQL to MSSQL Server 2000
It's not just that... For example, when I want to backup the MySQL server (and we are talking of a few GB of data) the server is practically dead while making the dump. MSSQL Server 2000 (for example) does that in the background and you can keep working... Any ideas? -Original Message- From: Heikki Tuuri [mailto:[EMAIL PROTECTED]] Sent: Sunday, January 13, 2002 10:42 PM To: Boaz Yahav Subject: RE: [PHP-DB] Re: Moving from MySQL to MSSQL Server 2000 Hi! If you are not happy with MyISAM's lack of transactions or row level locking or crash recovery, you could try InnoDB type tables in MySQL. You can use MySQL's master -> slave replication to get failover capability. Best regards, Heikki Tuuri Innobase Oy --- InnoDB - transactions, row level locking, and foreign key support for MySQL See http://www.innodb.com, download MySQL-Max from http://www.mysql.com -- PHP Database 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-DB] Re: Moving from MySQL to MSSQL Server 2000
You realize that what they did will never work with an Ecommerce auction site where everything must be in real-time... -Original Message- From: Manuel Lemos [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 12, 2002 11:25 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Re: Moving from MySQL to MSSQL Server 2000 Hello, Boaz Yahav wrote: > > Well, > > My Site runs now on Solaris. Both the front end (Web Server / php code / > Apache) and the Database (Backend server). > We had some problems with Mysql and we don't find it 100% reliable for > such a busy site. We also want to use a db cluster > for high availability (we are talking about $200,000 of hardware and > software for the change). > > The code will still run on Apache / PHP / Solaris so there is no change > in that. Only the access to the Database will change. Well, I can't speak from experience, but I was told that MySQL replication is very good. For the amount of money that you have as budget, I am sure you can pay a lot of MySQL AB certified consulting hours. I don't know what you mean that MySQL is not reliable. Does that have to do with scalability? There is a whole set of smart decisions to make regarding scalability before you decide to waste you money on commercial solutions. Anyway, before you jump on throw a lot of money to it and expect to do it, I think you would like to read (if you haven't already) this very compeling article on how the AmIHotOrNot.com site developers made it so scalable with just LAMP (Linux-Apache-MySQL). One of the things he states is that it seems that MySQL is much more optimized for Open Source platforms such as Linux than for instance Sun. http://www.webtechniques.com/archives/2001/05/hong/ Maybe that is the way to go. If you make it that way, I would not mind getting half of your budget above for the advice. :-) Regards, Manuel Lemos -- PHP Database 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 Database 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-DB] Re: [PHP] convert yyyy/mm/dd to mm/dd/yyyy, how?
Rasmus, I have held several datetime-related conversations with people recently, and another series about 'when'/whether to use PHP or MySQL functionality. Here you are, "the man" of PHP, advising Sander to use MySQL functionality! (and in marked contrast to the (biased) advice one might expect on PHP lists, eg JDEW's reply) I'm grinning at the apparent incongruity, but with no insult to yourself. Would you care to comment further on when one should consider using SQL commands in favor of implementing identical functionality in PHP (and possibly in some situations, vice-versa)? Regards, =dn - Original Message - From: "Rasmus Lerdorf" <[EMAIL PROTECTED]> To: "Sander Peters" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: 13 January 2002 19:52 Subject: [PHP-DB] Re: [PHP] convert /mm/dd to mm/dd/, how? > MySQL has plenty of functions to return dates to you in any format you > specify. Please read > >http://mysql.com/documentation/mysql/bychapter/manual_Reference.html#Date_and_time_functions > and pay special attention to the DATE_FORMAT() function. > > -Rasmus > > > > On Sun, 13 Jan 2002, Sander Peters wrote: > > > Hello everybody, > > > > convert /mm/dd to mm/dd/, how? > > > > MYSQL does everything in /mm/dd. > > I live in the Netherlands and we are use to the format dd/mm/. > > > > What's the best way to display it as mm/dd/ in a table on a query? > > > > My first idea whas to split the date up in vars in php and then print > > the vars in the way I like it > > Is this a bad idea? Or are there better sollutions? > > > > Thanx in advance for answering! > > > > > > > > -- > > Met vriendelijke groet / With Greetings, > > > > Sander Peters > > > >site: http://www.visionnet.nl/ > > email: mailto:[EMAIL PROTECTED] > > webmail: mailto:[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 Database 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 Database 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-DB] Re: [PHP] convert yyyy/mm/dd to mm/dd/yyyy, how?
MySQL has plenty of functions to return dates to you in any format you specify. Please read http://mysql.com/documentation/mysql/bychapter/manual_Reference.html#Date_and_time_functions and pay special attention to the DATE_FORMAT() function. -Rasmus On Sun, 13 Jan 2002, Sander Peters wrote: > Hello everybody, > > convert /mm/dd to mm/dd/, how? > > MYSQL does everything in /mm/dd. > I live in the Netherlands and we are use to the format dd/mm/. > > What's the best way to display it as mm/dd/ in a table on a query? > > My first idea whas to split the date up in vars in php and then print > the vars in the way I like it > Is this a bad idea? Or are there better sollutions? > > Thanx in advance for answering! > > > > -- > Met vriendelijke groet / With Greetings, > > Sander Peters > >site: http://www.visionnet.nl/ > email: mailto:[EMAIL PROTECTED] > webmail: mailto:[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 Database 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-DB] Re: [PHP] convert yyyy/mm/dd to mm/dd/yyyy, how?
Hiya, Personally, I use the following bit of code. All it does is take a 14 digit timestamp and convert it into a unix timestamp: function date($date) { //Extract the parts from the date $year = substr($date, 0, 4); $month = substr($date, 4, 2); $day = substr($date, 6, 2); $hour = substr($date, 8, 2); $min = substr($date, 10, 2); $sec = substr($date, 10, 2); //return the unix timestamp for the date passed return (gmmktime($hour, $min, $sec, $month, $day, $year)); } From then on, you can use the date function in PHP to manage the date. There are also ways to do it using the SQL command (DATE_FORMATE() I think is one), but you'll have to read the manual for into on that. At 20:56 13/01/2002 +0100, Sander Peters wrote: >Hello everybody, > >convert /mm/dd to mm/dd/, how? > >MYSQL does everything in /mm/dd. >I live in the Netherlands and we are use to the format dd/mm/. > >What's the best way to display it as mm/dd/ in a table on a query? > >My first idea whas to split the date up in vars in php and then print >the vars in the way I like it >Is this a bad idea? Or are there better sollutions? > >Thanx in advance for answering! > > > >-- >Met vriendelijke groet / With Greetings, > >Sander Peters > >site: http://www.visionnet.nl/ > email: mailto:[EMAIL PROTECTED] >webmail: mailto:[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] // Jonathan Wright // [EMAIL PROTECTED] // GCS d- s: a-- C++(+) US> P+++ L+> E> W+++ !N w !O M- V- PS+@ PE+ //Y PGP t+ !5 X R- tv(-) b(+) DI> D+(++) G h-- r-- z--(++) -- PHP Database 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-DB] convert yyyy/mm/dd to mm/dd/yyyy, how?
Hello everybody, convert /mm/dd to mm/dd/, how? MYSQL does everything in /mm/dd. I live in the Netherlands and we are use to the format dd/mm/. What's the best way to display it as mm/dd/ in a table on a query? My first idea whas to split the date up in vars in php and then print the vars in the way I like it Is this a bad idea? Or are there better sollutions? Thanx in advance for answering! -- Met vriendelijke groet / With Greetings, Sander Peters site: http://www.visionnet.nl/ email: mailto:[EMAIL PROTECTED] webmail: mailto:[EMAIL PROTECTED] -- PHP Database 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-DB] Re: Defining Arrays
Something i forgot when i echo("$denc[1]"); then it types Array out !!! "Thomas "Omega" Henning" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello, > > I'm curently working on an Encryption Bot for IRC that sends encrypted > messages to other bots linked 2 it and users that are log into it. > How i define an Array so i can use something like this > $text="hello"; > for ($i=0;$i $denc[$i]=substr($text,$i,1); > } > echo("$denc[1]"); > ?> > Theoraticly (in C++ point of view) that should print out "h". > Any idias helps alot > > Thanks > > Thomas "omega" Henning > > > -- PHP Database 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-DB] Defining Arrays
Hello, I'm curently working on an Encryption Bot for IRC that sends encrypted messages to other bots linked 2 it and users that are log into it. How i define an Array so i can use something like this Theoraticly (in C++ point of view) that should print out "h". Any idias helps alot Thanks Thomas "omega" Henning -- PHP Database 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-DB] properly a simple question
Barry, You're 3/4 of the way there. You understand how data is normalized, and you have the proper keys so that you can link your tables in a multi-table join. For specific syntax you should check the MySQL manual, but what you want is roughly this ..and I'll make up some field names. (Because I'm too lazy to check back to the msg which contained the table structure.) select table1.artist as artist, table3.image as image, table2.song as song from table1, table2, table3 where table3.art_id = table2.art_id and table2.art_id = table1.art_id and table1.art_id = $whch_artist? If there are 20 songs this will return 20 rows. In your PHP code you will have to weed out the duplicate fields as you loop though the returned record set. Alternately, you could break this into two queries - one to return the artist name and image, the other to fetch the songs. The third alternative would be to GROUP the results. I've not tested this, but if it can be properly processed by mysql_fetch_array(), then we're doing the work in SQL, not PHP. Add this line after the where: group by group by artist, image, song Again, if you can test this at the mysql console it will be faster than making changes to a script and re-running it. You may not need to group on image. A very brief test script to see how mysql_fetch_array() handles a grouped record set is a good idea. Might be worthwhile to check Google for "mysql_fetch_array group" Regards - Miles PS Where is "cx"? /mt At 12:38 AM 1/14/2002 +1300, Barry Rumsey wrote: >This is properly a simple question but I can't figure it out. >Lets say I've got there tables: table1(art_id,artist), >table2(song_id,art_id,song), table3(image_id,art_id,image). >What I'm trying to do is get 1 image displayed with the songs on that >album displayed next to it. All I can get is 1image,1 song or 1 image per >song (20 songs = 20 images). -- PHP Database 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-DB] properly a simple question
Barry, This is properly a simple question but I can't figure it out. =please don't ask im-proper questions, this is a family environment!!! Lets say I've got there tables: table1(art_id,artist), table2(song_id,art_id,song), table3(image_id,art_id,image). What I'm trying to do is get 1 image displayed with the songs on that album displayed next to it. All I can get is 1image,1 song or 1 image per song (20 songs = 20 images). =insufficient information. One (or a fourth) table will need to be populated with "album" data. =Have I misunderstood? Perhaps you could clarify your question with the code that you have already attempted for yourself (regardless of the fact that it isn't (yet) working), and maybe a demonstration of how you would like the result to appear from a set of sample data. =As you say, it is probably quite simple. If you haven't RTFM, then try throwing "join" at the manual's search facility. Most of the examples show two-table joins, but a three-table join can be set up by extending the WHERE clause to relate two-pairs of tables (and so on...) joined by an AND. =Regards, =dn -- PHP Database 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-DB] properly a simple question
This is properly a simple question but I can't figure it out. Lets say I've got there tables: table1(art_id,artist), table2(song_id,art_id,song), table3(image_id,art_id,image). What I'm trying to do is get 1 image displayed with the songs on that album displayed next to it. All I can get is 1image,1 song or 1 image per song (20 songs = 20 images).
RE: [PHP-DB] Re: Moving from MySQL to MSSQL Server 2000
I will read this article and let you know :) My main problem is that MySQL is not "Cluster Aware". I never heard of a MySQL server being able to perform a "Fail Over" to another node. Did you? -Original Message- From: Manuel Lemos [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 12, 2002 11:25 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Re: Moving from MySQL to MSSQL Server 2000 Hello, Boaz Yahav wrote: > > Well, > > My Site runs now on Solaris. Both the front end (Web Server / php code / > Apache) and the Database (Backend server). > We had some problems with Mysql and we don't find it 100% reliable for > such a busy site. We also want to use a db cluster > for high availability (we are talking about $200,000 of hardware and > software for the change). > > The code will still run on Apache / PHP / Solaris so there is no change > in that. Only the access to the Database will change. Well, I can't speak from experience, but I was told that MySQL replication is very good. For the amount of money that you have as budget, I am sure you can pay a lot of MySQL AB certified consulting hours. I don't know what you mean that MySQL is not reliable. Does that have to do with scalability? There is a whole set of smart decisions to make regarding scalability before you decide to waste you money on commercial solutions. Anyway, before you jump on throw a lot of money to it and expect to do it, I think you would like to read (if you haven't already) this very compeling article on how the AmIHotOrNot.com site developers made it so scalable with just LAMP (Linux-Apache-MySQL). One of the things he states is that it seems that MySQL is much more optimized for Open Source platforms such as Linux than for instance Sun. http://www.webtechniques.com/archives/2001/05/hong/ Maybe that is the way to go. If you make it that way, I would not mind getting half of your budget above for the advice. :-) Regards, Manuel Lemos -- PHP Database 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 Database 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-DB] Dumb Question??
Look at the filemtime() function that should do the trick Greetz Whosnext "Russ Michell" <[EMAIL PROTECTED]> wrote in message news:SIMEON.10112131234.B@k1c. anglia.ac.uk... > Sorry! just read-read my post, it should have been: > > particular column ('modified') *NOT* to appear under specific circumstances, somewhere along... > > Cheers. > Russ > > On Thu, 13 Dec 2001 12:03:09 + (GMT Standard Time) Russ Michell <[EMAIL PROTECTED]> wrote: > > > Hi there everyone: > > > > I have a genericphp/MySQL search+retrival mechanism. Generic in that it takes table names, > > fieldnames and fieldtypes as form lables and element names. However, because of this I cannot > > hard-code my SQL queries as they need to be as generic (univerally useful) as possible. > > > > I therefore have a lot of "SELECT * FROM ..." queries. However I would like to be able > > to specify a particular column ('modified') to appear under specific circumstances, somewhere along > > the lines of: "SELECT *,!modified FROM .." I scanned TFM and couldn't find anything > > specific to my problem. I have an incling this may not be as easy as I think, so does anyone know > > of a bodge,kludge or workaround?? > > > > Thanks for your time. > > Russ > > > > #---# > > > > "Believe nothing - consider everything" > > > > Russ Michell > > Anglia Polytechnic University Webteam > > Room 1C 'The Eastings' East Road, Cambridge > > > > e: [EMAIL PROTECTED] > > w: www.apu.ac.uk/webteam > > > > www.theruss.com > > > > #---# > > > > > > -- > > PHP Database 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] > > > > #---# > > "Believe nothing - consider everything" > > Russ Michell > Anglia Polytechnic University Webteam > Room 1C 'The Eastings' East Road, Cambridge > > e: [EMAIL PROTECTED] > w: www.apu.ac.uk/webteam > > www.theruss.com > > #---# > -- PHP Database 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-DB] Re: Copying a MySQL Table
Try using phpmysqladmin then it is PLAIN EASY... Greet Whosnext "Spyproductions Support Team" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > How does one copy a Mysql table? > > I poked around on the mysql site and found conventions for renaming one, but > nothing for duplicating a table (to a new table with a different name). > > Thanks, > > -Mike > -- PHP Database 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]