Re: [PHP-DB] Tree structure - how to show only current branch ??
> Not to mention that I hate using others code i dont agrre with that, i guess probably you write your own string/date handling functions, you write your own code to connect to database and other stuffs right? :-) > it will take about as long to convert that to something workable in PHP, as it > will figuring out how to do it in PHP the code is good, and is very easy to integrate it with PHP and with your table, you have all the data that is needed, the idea is not to port the code to php. Probably you didnt read the script documentation. If you don't want to use javascript for some reason like your browser doesn't support it (ex: lynx :-) ) or because you want to do a only server-side implementation that would only be usefull if you have a really big node list, in that case the php only version would be better or if you want a static tree menu. The PEAR::HTML_TreeMenu can be coded entirely in php but uses javascript to expand/contract the menus, this is transparent to the programmer, but uses javascript anyway. - Original Message - From: "-{ Rene Brehmer }-" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, March 30, 2004 4:32 PM Subject: RE: [PHP-DB] Tree structure - how to show only current branch ?? > Eh ... now, I dunno what part you missed ... but that's JavaScript, and I'm > working in PHP ... why would I care what's been done in JS ??? That won't > get me much further with what I'm trying to do... > > Not to mention that I hate using others code, and never have sofar, then it > will take about as long to convert that to something workable in PHP, as it > will figuring out how to do it in PHP > > > Rene > > At 14:15 30-03-2004, you wrote: > >Already been done: > > > >http://www.destroydrop.com/javascripts/tree/ > > > >Mark > > -- > Rene Brehmer > aka Metalbunny > > ~ If you don't like what I have to say ... don't read it ~ > > http://metalbunny.net/ > References, tools, and other useful stuff... > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] DATE_SUB Issues
sorry, i press Control+Enter and i send the unfinished mail, here is the continuation: it worked because it was monday, probably today you arent happy. try this sql, but i dont like the GROUP clause SELECT SUM(distance), DATE_FORMAT(time_upload, '%u'), WEEK(time_upload, 1) FROM TRAININGLOG WHERE (WEEK(NOW(), 1) <= WEEK(time_upload, 1)) GROUP BY time_upload LIMIT 1 - Original Message - From: "Craig Hoffman" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, March 29, 2004 9:48 PM Subject: Re: [PHP-DB] DATE_SUB Issues > WooHoo! I got it working! > Basically what I did is I changed this DATE_SUB( NOW(),INTERVAL 7 DAY > ) to DATE_SUB( NOW(),INTERVAL 1 DAY ) and it worked. I am not > entirely sure why. Anyone know? > __ > Craig Hoffman - eClimb Media > > v: (847) 644 - 8914 > f: (847) 866 - 1946 > e: [EMAIL PROTECTED] > w: www.eclimb.net > _ > On Mar 29, 2004, at 10:56 AM, Craig Hoffman wrote: > > > What is should doing is grabbing all entries of this week and return a > > total. Its returning the wrong results. > > > > SELECT SUM(distance), DATE_FORMAT(time_upload, '%u'), > > WEEK(time_upload, 1) FROM TRAININGLOG WHERE DATE_SUB( NOW(),INTERVAL 7 > > DAY ) <= time_upload GROUP BY time_upload LIMIT 1 > > > > => Results: (This is wrong) > > => Weekly Miles: (Week starts on Monday) 5.34 > > > > Correct Results should be this: > > Weekly Miles: 30.5 > > __ > > Craig Hoffman - eClimb Media > > > > v: (847) 644 - 8914 > > f: (847) 866 - 1946 > > e: [EMAIL PROTECTED] > > w: www.eclimb.net > > _ > > On Mar 29, 2004, at 10:29 AM, John W. Holmes wrote: > > > >> From: "Craig Hoffman" <[EMAIL PROTECTED]> > >>> On Mar 29, 2004, at 10:06 AM, John W. Holmes wrote: > From: "Craig Hoffman" <[EMAIL PROTECTED]> > > > still no luck - any other suggestions? > > Please define "no luck" > >>> > >>> Yes of course. Here is my new query. > >>> > >>> SELECT SUM(distance), DATE_FORMAT(time_upload, '%u'), > >>> WEEK(time_upload, '7') FROM TRAININGLOG WHERE DATE_SUB( > >>> NOW(),INTERVAL > >>> 7 DAY ) <= time_upload GROUP BY time_upload LIMIT 1 > >> > >> So how does it not work? What are you expecting? What is returned? Is > >> an > >> error occuring or the wrong results or no results?? > >> > >> ---John Holmes... > >> > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] DATE_SUB Issues
the first time i saw this post i get confused, let me see if i understand. you want the _CURRENT_ week stats OR the stats from the last 7 days if you want the first you cant use now the reason why that script works was because it was monday :) > SELECT SUM(distance), DATE_FORMAT(time_upload, '%u'), > > WEEK(time_upload, 1) FROM TRAININGLOG WHERE DATE_SUB( NOW(),INTERVAL 7 > > DAY ) <= time_upload GROUP BY time_upload LIMIT 1 - Original Message - From: "Craig Hoffman" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, March 29, 2004 9:48 PM Subject: Re: [PHP-DB] DATE_SUB Issues > WooHoo! I got it working! > Basically what I did is I changed this DATE_SUB( NOW(),INTERVAL 7 DAY > ) to DATE_SUB( NOW(),INTERVAL 1 DAY ) and it worked. I am not > entirely sure why. Anyone know? > __ > Craig Hoffman - eClimb Media > > v: (847) 644 - 8914 > f: (847) 866 - 1946 > e: [EMAIL PROTECTED] > w: www.eclimb.net > _ > On Mar 29, 2004, at 10:56 AM, Craig Hoffman wrote: > > > What is should doing is grabbing all entries of this week and return a > > total. Its returning the wrong results. > > > > SELECT SUM(distance), DATE_FORMAT(time_upload, '%u'), > > WEEK(time_upload, 1) FROM TRAININGLOG WHERE DATE_SUB( NOW(),INTERVAL 7 > > DAY ) <= time_upload GROUP BY time_upload LIMIT 1 > > > > => Results: (This is wrong) > > => Weekly Miles: (Week starts on Monday) 5.34 > > > > Correct Results should be this: > > Weekly Miles: 30.5 > > __ > > Craig Hoffman - eClimb Media > > > > v: (847) 644 - 8914 > > f: (847) 866 - 1946 > > e: [EMAIL PROTECTED] > > w: www.eclimb.net > > _ > > On Mar 29, 2004, at 10:29 AM, John W. Holmes wrote: > > > >> From: "Craig Hoffman" <[EMAIL PROTECTED]> > >>> On Mar 29, 2004, at 10:06 AM, John W. Holmes wrote: > From: "Craig Hoffman" <[EMAIL PROTECTED]> > > > still no luck - any other suggestions? > > Please define "no luck" > >>> > >>> Yes of course. Here is my new query. > >>> > >>> SELECT SUM(distance), DATE_FORMAT(time_upload, '%u'), > >>> WEEK(time_upload, '7') FROM TRAININGLOG WHERE DATE_SUB( > >>> NOW(),INTERVAL > >>> 7 DAY ) <= time_upload GROUP BY time_upload LIMIT 1 > >> > >> So how does it not work? What are you expecting? What is returned? Is > >> an > >> error occuring or the wrong results or no results?? > >> > >> ---John Holmes... > >> > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Stumped with proper query & display
i dont understand this part: "What's the smartest way to do the query ? I have 5 different tables I need to query. I guess I can get the data I want by selecting all from the 5 tables then parsing" Send your tables structure. - Original Message - From: "Mignon Hunter" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, March 26, 2004 3:07 PM Subject: Re: [PHP-DB] Stumped with proper query & display Can someone please help me or direct me to some scripts that might get me unstuck, as I've not done this kind of query before. To simplify: Table 1 id 1 Name John Doe company IBM Table 2 id1 choice choice #1 id1 choice choice #2 So I have 2 records in table 2 that I need to tie in with id # 1 in table 1. What's the smartest way to do the query ? I have 5 different tables I need to query. I guess I can get the data I want by selecting all from the 5 tables then parsing through like: while ($row = mysql_fetch_assoc($res)) { foreach Table1.id { if Table1.id == Table2.id{ echo }}} I could probably manage if I do 5 different queries with 5 different results sets, but that is obviously inelegant and would create more overhead I need to display as: John Doe IBM Choice #1, Choice #2 Am I even close ? Need some help with the logic... Thx for any guidance mignon -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] File upload bug
Hello Daniel, you said you change all the max_limit stuff in PHP/Apache, but did you change it on mysql ? by default the mysql_allowed_package is set to 1M, you have to add a line in your my.ini file (in my case this is in the windows directory, if you are using linux search google :)) In the section [mysqld] add set-variable = max_allowed_packet=10M or the value you want. I had a similar problem in a desktop application that inserted images into the database it gave the erro "mySQL has gone away" and this was the solution. Hope this Hepls. - Original Message - From: "Daniel Crespo" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, March 24, 2004 7:19 PM Subject: [PHP-DB] File upload bug > Hi all you there... > > I realized that when I try to upload a file of about 1MB or more, it doesn't > upload... Even changing all the max_limit stuff at the config files of > Apache and PHP... So, I don't now how to solve this. > > In the form, there are: > method="post"> > > > > > > In upload.php there are: > global $strDesc; > global $fileUpload; > global $fileUpload_name; > global $fileUpload_size; > global $fileUpload_type; > > $fileHandle = fopen($fileUpload, "rb"); > $fileContent = fread($fileHandle, $fileUpload_size); > $fileContent = addslashes($fileContent); > > $dbQuery = "INSERT INTO myBlobs VALUES "; > $dbQuery .= "(0, '$strDesc', '$fileContent', '$fileUpload_type')"; > db_query($dbQuery) or die("Couldn't add file to database"); > ?> > > With short files (up to 1MB aprox.), it works just perfect... But, more than > this, the variable $fileUpload_size, for example, is 0 (Zero)... So, anyone > know how to fix this? Thanks. > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Store a File (any type) in MySQL
As nobody seems to answer your question here, i will give you a pointer to an article i found i 30 seconds using google, i just searched for "insert blob mysql php" an i found this article in oReilly, and it seems that the article is based on a thread in the php mailing list. http://www.onlamp.com/pub/a/php/2000/09/15/php_mysql.html Be carefull with this because it can cause many troubles. If you got a message saying "mysql server gone away" or something like that is because your file if a little big, change the my.ini file and add: set-variable = max_allowed_packet=10M # or whatever you like i think that the default is 1 MB, You should consider changing the max upload size in your php.ini before asking questions about that and saying that it doesn't work :) if you really have to do this way do it if not consider doing this in another way. Any way of solving a problem is right if it is used in the right situation. - Original Message - From: "Daniel Crespo" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, March 23, 2004 4:24 AM Subject: Re: [PHP-DB] Store a File (any type) in MySQL > Ok, I'll consider it... But just, please, could you give me an example code > of what I want to do? > > Thanks a lot. > > "Bruno Santos" <[EMAIL PROTECTED]> escribió en el mensaje > news:[EMAIL PROTECTED] > > Daniel Crespo wrote: > > > > >Hi everybody... > > > > > >Anyone knows how to store a file (any type) in MySQL? > > > > > >Thanks > > > > > > > > > > > hello > > > > MySql has binary field types, but, are they long (in size) enough for > > your file ? > > if the file is small, i guess you could store the data in the mysql > > field, but, and if files are user choosen ??? > > > > why dont u consider storing the data, or the file, in some directory and > > just put the location (file name) in some field in the database ?? is > > more safe and overflow free > > > > cheers > > > > -- > > - > >.-'-. > > .' `. > > : : > >: : > >: _/| : Bruno Santos > > : =/_/ : [EMAIL PROTECTED] > > `._/ | .' > > ( / ,|...-'Pagina Pessoal > >\_/^\/||__ http://feiticeir0.no-ip.org > > _/~ `""~`"` \_ > > __/ -'/ `-._ `\_\__ > >/jgs /-'` `\ \ \-.\ > > > > > >"Written very small on the back poket of a girl's jeans > >- 'If you can read this, you're WAY too close.'" > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] How to simplify DB creation?
Yes, there are tools to do that. You could take a look at PEAR which have libraries to do that, that a look at HTML:HTML_Form (for making forms) and there are several others alternatives(http://phpformgen.sourceforge.net and http://www.hotscripts.com/PHP/Scripts_and_Programs/Form_Processors/), sorting and searching i don't know i have done that task manually but you have a Pager DB:Pager it does paging but doesnt do sorting. - Original Message - From: "Michal Masa" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, March 18, 2004 4:35 PM Subject: [PHP-DB] How to simplify DB creation? > Hi, > We plan to write a simple DB with app. 10 tables. Are there any tools that > simplify and automatize the creation of PHP scripts for the database? > Like automatic generation of PHP scripts that produce HTML input forms, > generation of value lists, validation, sorting and searching? > Well documented PHP library could be also useful. > > Regards, > Mike > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL - separating web and database servers
in your php.ini you have mysql.default_host, mysql.default_user and mysql.default_password which are used if: a) you are not in safe mode b) you supply no string for those parameters. But i guess this is not your case, i think this doesnt help, but i had an ideia, you could set your server (http) to work as a router and make something like a port-forwarding to the other server, like routers do, one ip could be used be several machines, depending on the port is accessed the data is forwarded to that port. This is just an idea i had right now, i dont know if it can be used or if it works but and least appears to logical and implementable. Good luck. - Original Message - From: "Operator" <[EMAIL PROTECTED]> To: "PHP DB" <[EMAIL PROTECTED]> Sent: Thursday, March 18, 2004 1:34 PM Subject: Re: [PHP-DB] MySQL - separating web and database servers > On 18 Mar 2004 at 11:15, Ricardo Lopes wrote: > > > What is the problem in changig localhost in houndreds of scripts, ou can do > > that with a script or a good text editor that has the function Replace in > > Files... can do the trick. > > Changing scripts is not a main factor here (but it's not as simple as it may > seem - consider some encoded php applications, cgi's or some not informed > users who will overwrite changed files with their local copies). > > I just wanted to know if it's possible to do this without touching > localhost. > > > > > I dont think that editing the host file to make localhost point to the other > > machine is a good practice. :) > > I agree. But it doesn't work anyway ;) > > PB > > > > > - Original Message - > > From: "Operator" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Thursday, March 18, 2004 8:57 AM > > Subject: [PHP-DB] MySQL - separating web and database servers > > > > > > > Hi everyone, > > > > > > I need to put my database server on the another machine - how can I > > > configure system(Debian Linux)/php/mysql etc. to make it work without > > > changing all 'localhost' in a hundreds of customer's scripts? > > > > > > The problem is, when localhost is specified as a host the connection is > > made > > > using unix socket, not TCP (is it possible to change this?). I tried to > > > export the socket from database server via NFS, but with no success: > > > > > > (...) > > > munmap(0x2e1f2000, 4096) = 0 > > > rt_sigaction(SIGPIPE, {SIG_IGN}, {SIG_DFL}, 8) = 0 > > > socket(PF_UNIX, SOCK_STREAM, 0) = 3 > > > fcntl64(3, F_GETFL) = 0x2 (flags O_RDWR) > > > connect(3, {sin_family=AF_UNIX, path="/var/run/mysqld/mysqld.sock"}, > > > 110) > > > = -1 ECONNREFUSED (Connection refused) > > > shutdown(3, 2 /* send and receive */) = 0 > > > close(3) = 0 > > > (...) > > > > > > Any ideas? > > > > > > Regards > > > Piotr Babula > > > > > > -- > > > PHP Database Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL - separating web and database servers
What is the problem in changig localhost in houndreds of scripts, ou can do that with a script or a good text editor that has the function Replace in Files... can do the trick. I dont think that editing the host file to make localhost point to the other machine is a good practice. :) - Original Message - From: "Operator" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, March 18, 2004 8:57 AM Subject: [PHP-DB] MySQL - separating web and database servers > Hi everyone, > > I need to put my database server on the another machine - how can I > configure system(Debian Linux)/php/mysql etc. to make it work without > changing all 'localhost' in a hundreds of customer's scripts? > > The problem is, when localhost is specified as a host the connection is made > using unix socket, not TCP (is it possible to change this?). I tried to > export the socket from database server via NFS, but with no success: > > (...) > munmap(0x2e1f2000, 4096) = 0 > rt_sigaction(SIGPIPE, {SIG_IGN}, {SIG_DFL}, 8) = 0 > socket(PF_UNIX, SOCK_STREAM, 0) = 3 > fcntl64(3, F_GETFL) = 0x2 (flags O_RDWR) > connect(3, {sin_family=AF_UNIX, path="/var/run/mysqld/mysqld.sock"}, > 110) > = -1 ECONNREFUSED (Connection refused) > shutdown(3, 2 /* send and receive */) = 0 > close(3) = 0 > (...) > > Any ideas? > > Regards > Piotr Babula > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] An old dog, with a new trick..
So you want to learn php with mysql, good for you, well if you don't know this is a mailing-list for questions to doubts and in your post you have none. If you want to learn php a good place to start is the PHPManual and another good place is google.com search for "php tutorials" you will get some good links. Is always good to look at the manual before asking questions. Good Luck. --- Spanish Version --- Asi que quieres aprender php y mysql, my bien, caso no sabes esta mailing-list es para esclarecer dubidas y preguntas y tu no publicaste ninguna. Si quieres aprender php um buen comienzo era ler el manual de php y otro buen lugar es google.com busca "php tutoriales" vas encontrar buenos apontadores para paginas. Es siempre una buena idea dar unas vista de ojos al manual antes de perguntar. Buena Suerte. - Original Message - From: "Felipe Eduardo Ortiz López" <[EMAIL PROTECTED]> To: "lPHP and Databases" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; "lPHP For Windows" <[EMAIL PROTECTED]>; "lPHP Para Todos" <[EMAIL PROTECTED]> Sent: Thursday, March 18, 2004 4:05 AM Subject: [PHP-DB] An old dog, with a new trick.. Bueno, héme aquí, un perro viejo tratando de aprender nuevos trucos. Comienzo a desarrollar en PHP, con la idea de conectar bases de datos MySQL y Firebird a las aplicaciones. ¿Me podrían orientar de por dónde comenzar, libros, sitios, algo así? Les estaré muy agradecido, y disculpen si comienzo a hacer preguntas tontas... Well, I'm here, an old dog trying to learn new tricks. I'm starting to develop in PHP, having the idea to connect MySQL and Firebord databases to the aplications. Can anyone lend me a hand to have a good starting, bokks, sites, something else? I'll be very grateful, and very sorry if I'm starting with the silly questions... _ Felipe Eduardo Ortiz López, Consultor. Tiammat Software. Yahoo! Messenger: tiammatsoftware MSN Messenger: [EMAIL PROTECTED] http://www.prodigyweb.net.mx/tiammat/default.html -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] BLOB
i think this is the right sintax: SELECT * FROM `MEMBER` WHERE ISNULL(`PASSWD`) Passwd is a blob, that is an interesting name for a blob field, what are you planing to do? - Original Message - From: "Ng Hwee Hwee" <[EMAIL PROTECTED]> To: "DBList" <[EMAIL PROTECTED]> Sent: Friday, March 12, 2004 4:39 AM Subject: [PHP-DB] BLOB Hi all, how do i find out if a BLOB field in my table is NULL? i tried: SELECT * FROM `MEMBER` WHERE `PASSWD` is NULL however, although there is one entry in my table that has nothing in my PASSWD field, the result set is empty.. how come? how do i search for entries that has password = [BLOB - 0 bytes] ?? thanx so much!! huihui -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Mysql MaxDB Support?
MaxDB is based on sapdb, try searching for that you probably get better results because sapdb is older that maxdb. In the near future maxdb will support the mysql protocol, so i guess you could then use the mysql functions with maxdb. - Original Message - From: "Carolyn Longfoot" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, March 11, 2004 8:57 AM Subject: [PHP-DB] Mysql MaxDB Support? > Does PHP natively support MaxDB? I have not seen any mention of it in the > manual anywhere. If not and anybody uses ODBC could you kindly post the > configuration? > > Cheers! > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Protecting mysql database
if you want to close the whole database for a period, and that _NOBODY_ have access, just shutdown the service, and prevent it from starting the next time you restart your operative system. :) you could make mysql to log more than it normaly does to the logs and then analyse the log. You can even monitor the logs and when something happend (like a login) send an email or sms to the administrator. I dont know how to change which information is store in the logs, look at the mysql documentation, it have to be there. - Original Message - From: "Piet from South Africa" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, March 03, 2004 2:41 PM Subject: [PHP-DB] Protecting mysql database > Hi > > Is there a way that an alert or something can be generated when a mysql > database is being accessed in any way. > > I want to close the whole database for a period, and nobody may access the > database via phpadmin or anything else > > Appreciate your input on this one. > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Bank Account Register
This is a simple normalized database that might work for you :), depends of the quantity of records you are going to register and other things. [Table Entities] idintauto_inrementPK entitty_namevarchar [Table HoursUsed] id int auto_inrementPK entity_id int FK daydate quantity int (you could use reals instead of integers if you work with 1/2 hour) [Table HoursPurchased] id int auto_inrementPK entity_id int FK daydate quantity int (you could use reals instead of integers if you work with 1/2 hour) --- OR ypu could have something like like this: [Table Entities] (Same as above) [Table Hours] id int auto_inrementPK entity_id int FK daydate hourtypeint (this could be 0 for purchased, 1 for used, or something like that) quantity int (you could use reals instead of integers if you work with 1/2 hour) For calculating the hours remaining you just have to do a simple query. You could have a table with the hous remaining initialy set to the value of the hours purchased and decremet the value each time you use hours, this might have some impact in performance, i dont know which might be better, you have to do some math to know :) Hope this helps. - Original Message - From: "rogue" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, March 02, 2004 3:23 PM Subject: [PHP-DB] Bank Account Register > Hi all, > > Please CC me on any reply - I get the digest :) > > I am working on a project where I need to implement something that most > resembles a checkbook register, where I am tracking pre-paid hours > bought vs. hours used on-site. > > I am getting a bit stuck on the best structure for the mysql table, and > would like some suggestions. > > In the end, I need to be able to run a report where by date it displays > hours purchased, and hours used like in a check register: > > > DATEDESC. BAL. > 2/23/04 Purchased 10 hours 10hrs. remaining > 2/24/04 Job 2 used 5 hours 5hrs. remaining > 2/24/04 Purchased 20 hours 25hrs. remaining > > > Like so... > > Would it be best to have 1 table with a field for transaction type and > keep all the ins and outs in one table, or have two tables one where I > track purchased hours and the other where I track used hours? > > Thanks, > Rogue > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] plain-text file (.txt) to mysql database
I know this might sound a little bad, but i would use Perl or an editor that supports regulars expresions to convert the data into insert statements and after that i would use a database administration tool (ex. myCC) to insert the data, you could put some statements before doing the inserts to disable foreign key checks and others things to speed up the process, but in your case i think this would have no effect in the speed. - Original Message - From: "JeRRy" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, March 01, 2004 9:08 AM Subject: [PHP-DB] plain-text file (.txt) to mysql database > Hi, > > Quick question, does anyone know of a program/site > that could do the following: > > I have a .txt file written in notepad. > > Bob Someone Mr > > Now I have a db with the fields: > > First Last Title > > Now the .txt file looks something like this: > > Bob Someone Mr > Susan Taylor Miss > Andrea Nothing Ms > ... > > Now I want to use a Program/site to put the names in > the right field. So each field is seperated by a > space as shown above. I have about 1000 entries to > put in and don't think doing each query per line is > going to be a 5 min job, any suggestions? > > Thanks! > > Find local movie times and trailers on Yahoo! Movies. > http://au.movies.yahoo.com > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] SQL File Import problem (Was: HELP!!!)
I have the same problem right now, after a very short search in google i found this: http://www.mysql.com/documentation/mysql/bychapter/manual_Problems.html#Gone _away In my case i get the message "max_allowed_packet is too small" because i was trying to insert an image > 1M into the database. - Original Message - From: "Doug Thompson" <[EMAIL PROTECTED]> To: "Robin 'Sparky' Kopetzky" <[EMAIL PROTECTED]> Cc: "Erwin Kerk" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, February 27, 2004 1:04 AM Subject: Re: [PHP-DB] SQL File Import problem (Was: HELP!!!) > On Fri, 27 Feb 2004 01:16:20 +0100, Erwin Kerk wrote: > > >Robin 'Sparky' Kopetzky wrote: > > > >> Good afternoon! > >> > >> I used SQLYOG to export the tables and data from a Mysql database. Now, when > >> i try to re-import the data back into a different database, I get an error > >> stating "Error : MySQL server has gone away". What is happening and how do I > >> fix this. I NEED this script to execute badly. I even tries running it under > >> mysql using source "filename.sql" and got the same error. One table is over > >> 75,000 entries. > >The queries are taking too long. Are this plain .sql files? If so, try > >to split them up in say, 10 separate files, and import them all > >separately. That should work. > > > >And in the futue, try putting a more descriptive text in youre subject. > > > > > >Erwin Kerk > >Web Developer > > > >-- > > Erwin is exactly right.That being said: > > You don't say and it's risky to assume if you can do any other tasks on the new server. In other words, is it running at all? > > You don't say which of SQLyog's methods you used to create the backup. In this case, I would have used > DB -> Export Database as Batch Scripts > and I would save the file as .sql and transfer that file to the mysql/bin directory on the new system. > > Assuming mysqld is running on the new system, cd to the mysql/bin subdirectory and type > ./mysql -uusername -ppassword < somefile.sql > > Of course, all the foregoing syntax for re-installing presumes *n*x. > > I move databases from my local windows system to a remote *n*x site frequently using the above process and it is very reliable and repeatable. > > hth, > Doug > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: call to undefined function mysql_connect() [PHP / MySQL / Red Hat 8]
Call to undefined function mysql_connect(), this means that php doesnt reconize mysql_connect() as a function, this could be because you use the wrong name for the function (in this case it seems ok, check your code), or because the mysql extension isn't loaded (it is loaded by default, and it should be if you didnt mess the php.ini file or the extensions directory). There is an easy way to check if the extension is loaded, create a phpinfo script: and serach for mysql to see extension is loaded. Hope this helps. - Original Message - From: "JeRRy" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 26, 2004 11:59 AM Subject: [PHP-DB] Re: call to undefined function mysql_connect() [PHP / MySQL / Red Hat 8] > To: [EMAIL PROTECTED] > From: "Jono" <[EMAIL PROTECTED]> > Date: Wed, 25 Feb 2004 20:50:37 - > Subject: call to undefined function mysql_connect() > [PHP / MySQL / Red Hat 8] > > > Hey. > > I've just installed Red Hat 8 from a downloaded > distribution and have > set up > Apache, PHP and MySQL. The problem I have is my old > code that I wrote > in a > Windows environment doesn't work. > > The error I get is: call to undefined function > mysql_connect() > > I know that Apache is running fine and I know that PHP > and MySQL run > okay > independantly of each other, but I can't work out how > to get them > working > together. > > Any Ideas? > > Thanks, Jono. > > > Hi, > > Generally you need to post your code to get help, > otherwise we can't show you where the problem is. So > could you please, unless you have found a solution, > post your code so we can see what's going on and point > you in the right direction? :) > > J > > > Find local movie times and trailers on Yahoo! Movies. > http://au.movies.yahoo.com > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: call to undefined function mysql_connect() [PHP / MySQL / Red Hat 8]
you probably have the mysql and the php installed and working correctly. check your php.ini file search for a section named extensions and check if the mysql extension is commented (if so uncomment it), check is the entensions directory is correct, check the apache logs to see if php load correctly, you could have a CANT LOAD MODULE in the log. - Original Message - From: "Jono" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 26, 2004 1:37 PM Subject: Re: [PHP-DB] Re: call to undefined function mysql_connect() [PHP / MySQL / Red Hat 8] > Yeah thanks for the phpinfo() tip. I guess I know that MySQL isn't working > with PHP cos I'd already checked that. Bit silly I presumed that installing > it all at the same time as installing Linux it would all work together. > > In the package manager for RedHat, under the Web Server Section, PHP is > listed for installation, along with a few modules to go with it (ie. LDAP > and IMAP, and some stuff to do with PostgreSQL), but there is no option to > install a MySQL module with it. Seems a bit silly really. > > The version of PHP is 4.22.2-8.0.5 (4.2 basically), and I don't know what > version MySQL was built into PHP from, but it doesn't seem to be on this > version. > > I simplified my code to just this, and got the same message, so I don't > think adding my own code will help: > > > if ($connection = mysql_connect("localhost", "[username]", "[password]")) > > echo "hooray!"; > > else > > echo "oopsie!"; > > ?> > > I don't know what you think about all this, maybe I should download > distributions and install them myself, but if I can sort it without having > to that would be great as I'm only just starting to get my head around Linux > after all these years. > > Thanks for your help guys :) > > Jono > > "Ricardo Lopes" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Call to undefined function mysql_connect(), this means that php doesnt > > reconize mysql_connect() as a function, this could be because you use the > > wrong name for the function (in this case it seems ok, check your code), > or > > because the mysql extension isn't loaded (it is loaded by default, and it > > should be if you didnt mess the php.ini file or the extensions directory). > > > > There is an easy way to check if the extension is loaded, create a phpinfo > > script: > > > > > phpinfo(); > > ?> > > > > and serach for mysql to see extension is loaded. > > > > Hope this helps. > > > > - Original Message - > > From: "JeRRy" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Thursday, February 26, 2004 11:59 AM > > Subject: [PHP-DB] Re: call to undefined function mysql_connect() [PHP / > > MySQL / Red Hat 8] > > > > > > > To: [EMAIL PROTECTED] > > > From: "Jono" <[EMAIL PROTECTED]> > > > Date: Wed, 25 Feb 2004 20:50:37 - > > > Subject: call to undefined function mysql_connect() > > > [PHP / MySQL / Red Hat 8] > > > > > > > > > Hey. > > > > > > I've just installed Red Hat 8 from a downloaded > > > distribution and have > > > set up > > > Apache, PHP and MySQL. The problem I have is my old > > > code that I wrote > > > in a > > > Windows environment doesn't work. > > > > > > The error I get is: call to undefined function > > > mysql_connect() > > > > > > I know that Apache is running fine and I know that PHP > > > and MySQL run > > > okay > > > independantly of each other, but I can't work out how > > > to get them > > > working > > > together. > > > > > > Any Ideas? > > > > > > Thanks, Jono. > > > > > > > > > Hi, > > > > > > Generally you need to post your code to get help, > > > otherwise we can't show you where the problem is. So > > > could you please, unless you have found a solution, > > > post your code so we can see what's going on and point > > > you in the right direction? :) > > > > > > J > > > > > > > > > Find local movie times and trailers on Yahoo! Movies. > > > http://au.movies.yahoo.com > > > > > > -- > > > PHP Database Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] What's wrong with this query?
What is the error? there i something i always do when i have this problem, try this: error_reporting(E_ALL); $sql = "INSERT INTO log SET term='$search', returns='$arrayword', time=CURTIME(), date=CURDATE(), ip='$ip'"); echo $sql; $logit = mysql_query($sql); This makes all kind of notice about uninitialized variables and other things that may cause problems, great for debugging, and the echo $sql prints the sql that is sent to the client, here you can see if one of the variable yo are sendding to the query have some kind of problem, like a ' in the middle, which could cause problems in your script. If you can't see the problem after this post the output of this code. - Original Message - From: "Axel IS Main" <[EMAIL PROTECTED]> To: "PHP-DB" <[EMAIL PROTECTED]> Sent: Thursday, February 26, 2004 9:05 AM Subject: [PHP-DB] What's wrong with this query? > I've just tried to do something I've done a thousand times. It does not > work. I've checked all of the syntax, made sure the field and variable > names are correct. No matter what I do it just doesn't work. The table > remains empty. Here's the query: > > $logit = mysql_query("INSERT INTO log SET term='$search', > returns='$arrayword', time=CURTIME(), date=CURDATE(), ip='$ip'"); > > Now that doesn't look too difficult does it? Well, apparently it's > impossible! I'm really hoping someone out there can see something that I > missed. > > Nick > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Embedded MySQL server (libmysqld)?
You can use: - txtSQL http://txtsql.sourceforge.net/ Is not provided in php, you have to install it to the folder were you have your scripts or reachable by it. The sintax is not exactly as sql but is similar, the documentation included seems to be very good. I dont know if it does everything you need but it appears to have an fairly complete list of features avaliable the main drawback is compatibility (the sql instructions are not sql standard) and speed (its slower, but probably you wont even notice it). Good Luck - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, February 23, 2004 3:29 PM Subject: Re: [PHP-DB] Embedded MySQL server (libmysqld)? > Ricardo Lopes wrote: > > The libmysqld is meant to be used as a database server embeded into > > application, not a replace or a lighter version of a database server, it > > can´t be used with php to provide a web page to the internet in the way i > > tink you want. > > > > The way of using libmysql is for what i read the same way you would use a > > mysql database. > > It could be used with php to create a dinamic webpage into a cdrom with a > > read-noly database. > > > > If you dont want to pay the extra $$$ you could use plain text files, or use > > a driver to treat text-files as databases, you can execute sql instructions > > as if you were using a database but the results asre saved/fetched from a > > textfile, is a slower but cheaper solution. > Ricardo -- > Thanks or you reply. > Unfortunitly the question of hostinga package is out of my hands. > If the PHP provides SQL ->text file pleae point me to the man page? > Is it sometihng like SQLcsv ? > > TIA, > David > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Embedded MySQL server (libmysqld)?
The libmysqld is meant to be used as a database server embeded into application, not a replace or a lighter version of a database server, it can´t be used with php to provide a web page to the internet in the way i tink you want. The way of using libmysql is for what i read the same way you would use a mysql database. It could be used with php to create a dinamic webpage into a cdrom with a read-noly database. If you dont want to pay the extra $$$ you could use plain text files, or use a driver to treat text-files as databases, you can execute sql instructions as if you were using a database but the results asre saved/fetched from a textfile, is a slower but cheaper solution. - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, February 23, 2004 2:53 PM Subject: [PHP-DB] Embedded MySQL server (libmysqld)? > Howdy -- > Would someone point or provide me with an example of PHP + libMysqld > (Embedded MySQL server)? > > My problem is my churchs web site doesn't provide a MySQL database as > a default package (add $15.95/mo)for a MySQL Db. > > TIA, > David > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Search results of a previous query?
You can concat to the 1º filter statement the 2º. ex: SELECT * FROM atable WHERE (fieldname = fieldvalue) AND (fieldname2 = fieldvalue2) For the user to search twice in the same field i think you have to use the LIKE operator instead of the = and use the % in the string as wildcard. ex: 1º Search: Name = "%Carlos%"// Will return all Carlos 2º Search: Name = "%Triana%"// Will return everybody that have Carlos and Triana in any part of their name if used a sql like the one above (with AND). This could be done how many times you want with only one field or several. Hope this Hepls. - Original Message - From: "Lic. Carlos A. Triana Torres" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, February 18, 2004 1:36 PM Subject: [PHP-DB] Search results of a previous query? Hi all, I am trying to build a script to make "nested" searches in a table. I have a form compossed of a text field and a select dropdown menu with all the fields in the table. The user can write in the text box and then select the field in which to perform the search. This works fine so far...now, I want to show the results of the query, but give the user the possibility of searching again BUT only make the search with the results shown, not the entire tablecan anyone give me any ideas of how to do this last part? I tried passing the new queries in the url...but this won't give the user the possibility to search twice in the same field... Any ideas? Thanks before hand. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Update Statement
you could use: for ($i=0; $i< max; $i++) { mysql_query("update Table1, Table2 set Table1.field1 = Table2.field2 where Table1.no = Table2.no"); } OR if you use mysqlt daemon (support for transactions, in this case is best) mysql_query('BEGIN'); for ($i=0; $i< max; $i++) { if (! mysql_query("update Table1, Table2 set Table1.field1 = Table2.field2 where Table1.no = Table2.no")) { mysql_query('ROLLBACK'); die('ERROR - in query nº: '.$i); } } mysql_query(COMMIT'); Execute all or not execute none. I personally use adodb to connect to databases and control transactions. If what you really want is to execute then all in just one function call to the database, i don't know how can you do it with your mysql version. HTH - Original Message - From: "Ng Hwee Hwee" <[EMAIL PROTECTED]> To: "DBList" <[EMAIL PROTECTED]> Sent: Wednesday, February 18, 2004 2:14 AM Subject: [PHP-DB] Update Statement hi all, I would like to do the following: update Table1, Table2 set Table1.field1 = Table2.field2 where Table1.no = Table2.no however, i found that multiple updates can only work for MySQL version 4.0.4 but mine is 3.23.54... can anyone enlighten me on how I can achieve the same results with this older MySQL version? or can PHP 4.2.2 help me in any way? Thank you so much! Hwee -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Brick Codes
Ignore the previous post it has an error. This is the corrected sql: SELECT * FROM Locations L, Brick B WHERE (LEFT(L.'Post Code', LOCATE(' ', L.'Post Code')) = B.Brick) This should do it. - Original Message - From: "Ricardo Lopes" <[EMAIL PROTECTED]> To: "Shaun" <[EMAIL PROTECTED]> Cc: "PHP DB" <[EMAIL PROTECTED]> Sent: Tuesday, February 17, 2004 10:32 AM Subject: Re: [PHP-DB] Brick Codes > SELECT * > FROM Locations L, Brick B > WHERE (LEFT(L.'Post Code', LOCATE(' ', L.'Post Code') = LEFT(B.Brick, > LOCATE(' ', L.'Post Code'))) > > The functions if locate gives you the position of the character in the > string, if this is not what you whant you can search the mysql string > functions documentation in: > > http://www.mysql.com/documentation/mysql/bychapter/manual_Functions.html#Str > ing_functions > > > - Original Message - > From: "Shaun" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, February 17, 2004 10:19 AM > Subject: Re: [PHP-DB] Brick Codes > > > > Thank you for your replies, > > > > The brick and postcode will never match so I need to compare the Postcode > in > > Locations to the Postcode in Brick. Something like: > > > > SELECT B.Brick > > FROM Locations L, Brick B > > WHERE (LEFT(L.Postcode,3) = LEFT(B.Postcode,3)) > > > > The problem is that some of the postcodes stored in Brick have three > digits > > and some have four, is there a way of capturing everything before the > first > > space in L.Postcode and compare that to B.Postcode? > > > > Thanks for your help > > > > "Ignatius Reilly" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > Hmmm... > > > > > > Better try: > > > WHERE (LEFT( Brick,3) = LEFT(`Post Code`,3)) > > > ^^ no quotes^^ back ticks (because of > the > > > space in the column name) > > > > > > HTH > > > Ignatius > > > _ > > > - Original Message - > > > From: "Ricardo Lopes" <[EMAIL PROTECTED]> > > > To: "Shaun" <[EMAIL PROTECTED]> > > > Cc: "PHP DB" <[EMAIL PROTECTED]> > > > Sent: Tuesday, February 17, 2004 10:23 > > > Subject: Re: [PHP-DB] Brick Codes > > > > > > > > > > That may depend of what database server you are using, for mysql you > can > > > > use: > > > > > > > > WHERE (LEFT('Brick',3) = LEFT(Post Code,3)) > > > > > > > > If you are using other dbserver, check your manual. > > > > > > > > - Original Message - > > > > From: "Shaun" <[EMAIL PROTECTED]> > > > > To: <[EMAIL PROTECTED]> > > > > Sent: Monday, February 16, 2004 10:45 PM > > > > Subject: [PHP-DB] Brick Codes > > > > > > > > > > > > > Hi, > > > > > > > > > > I have a table of Locations around the country. My system produces > > > reports > > > > > based on these Locations. I also have a table containing Brick Codes > > > e.g. > > > > > > > > > > BrickPost Code > > > > > AB51AB51 > > > > > AB52AB52 > > > > > AB55AB55 > > > > > AB56AB56 > > > > > AL01AL1 > > > > > AL02AL2 > > > > > AL03AL3 > > > > > AL04AL4 > > > > > > > > > > > > > > > How can I compare the first 3 or 4 letters of the postcode in the > > > > Locations > > > > > table to the corresponding entry in the Brick Codes table so I can > add > > > it > > > > to > > > > > my report? > > > > > > > > > > Thanks for your help > > > > > > > > > > -- > > > > > PHP Database Mailing List (http://www.php.net/) > > > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > > > > > > > -- > > > > PHP Database Mailing List (http://www.php.net/) > > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Brick Codes
SELECT * FROM Locations L, Brick B WHERE (LEFT(L.'Post Code', LOCATE(' ', L.'Post Code') = LEFT(B.Brick, LOCATE(' ', L.'Post Code'))) The functions if locate gives you the position of the character in the string, if this is not what you whant you can search the mysql string functions documentation in: http://www.mysql.com/documentation/mysql/bychapter/manual_Functions.html#Str ing_functions - Original Message - From: "Shaun" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, February 17, 2004 10:19 AM Subject: Re: [PHP-DB] Brick Codes > Thank you for your replies, > > The brick and postcode will never match so I need to compare the Postcode in > Locations to the Postcode in Brick. Something like: > > SELECT B.Brick > FROM Locations L, Brick B > WHERE (LEFT(L.Postcode,3) = LEFT(B.Postcode,3)) > > The problem is that some of the postcodes stored in Brick have three digits > and some have four, is there a way of capturing everything before the first > space in L.Postcode and compare that to B.Postcode? > > Thanks for your help > > "Ignatius Reilly" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Hmmm... > > > > Better try: > > WHERE (LEFT( Brick,3) = LEFT(`Post Code`,3)) > > ^^ no quotes ^^ back ticks (because of the > > space in the column name) > > > > HTH > > Ignatius > > _ > > - Original Message - > > From: "Ricardo Lopes" <[EMAIL PROTECTED]> > > To: "Shaun" <[EMAIL PROTECTED]> > > Cc: "PHP DB" <[EMAIL PROTECTED]> > > Sent: Tuesday, February 17, 2004 10:23 > > Subject: Re: [PHP-DB] Brick Codes > > > > > > > That may depend of what database server you are using, for mysql you can > > > use: > > > > > > WHERE (LEFT('Brick',3) = LEFT(Post Code,3)) > > > > > > If you are using other dbserver, check your manual. > > > > > > - Original Message - > > > From: "Shaun" <[EMAIL PROTECTED]> > > > To: <[EMAIL PROTECTED]> > > > Sent: Monday, February 16, 2004 10:45 PM > > > Subject: [PHP-DB] Brick Codes > > > > > > > > > > Hi, > > > > > > > > I have a table of Locations around the country. My system produces > > reports > > > > based on these Locations. I also have a table containing Brick Codes > > e.g. > > > > > > > > BrickPost Code > > > > AB51AB51 > > > > AB52AB52 > > > > AB55AB55 > > > > AB56AB56 > > > > AL01AL1 > > > > AL02AL2 > > > > AL03AL3 > > > > AL04AL4 > > > > > > > > > > > > How can I compare the first 3 or 4 letters of the postcode in the > > > Locations > > > > table to the corresponding entry in the Brick Codes table so I can add > > it > > > to > > > > my report? > > > > > > > > Thanks for your help > > > > > > > > -- > > > > PHP Database Mailing List (http://www.php.net/) > > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > > > -- > > > PHP Database Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Brick Codes
I think this is what you want: SELECT * FROM Locations L, Brick B WHERE (LEFT(L.'Post Code',3) = LEFT(B.Brick,3)) If you want to select 4 characters change the 3 to 4 :-) Avoid using spaces and special characters in your column it may give you problems. - Original Message - From: "Shaun" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, February 17, 2004 10:04 AM Subject: Re: [PHP-DB] Brick Codes > Thanks for your reply, > > but what I actually need to do is compare the first 3 or 4 digits of the > postcode stored in locations to the same in the Brick table... > > > "Ricardo Lopes" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > That may depend of what database server you are using, for mysql you can > > use: > > > > WHERE (LEFT('Brick',3) = LEFT(Post Code,3)) > > > > If you are using other dbserver, check your manual. > > > > - Original Message - > > From: "Shaun" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Monday, February 16, 2004 10:45 PM > > Subject: [PHP-DB] Brick Codes > > > > > > > Hi, > > > > > > I have a table of Locations around the country. My system produces > reports > > > based on these Locations. I also have a table containing Brick Codes > e.g. > > > > > > BrickPost Code > > > AB51AB51 > > > AB52AB52 > > > AB55AB55 > > > AB56AB56 > > > AL01AL1 > > > AL02AL2 > > > AL03AL3 > > > AL04AL4 > > > > > > > > > How can I compare the first 3 or 4 letters of the postcode in the > > Locations > > > table to the corresponding entry in the Brick Codes table so I can add > it > > to > > > my report? > > > > > > Thanks for your help > > > > > > -- > > > PHP Database Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Brick Codes
That may depend of what database server you are using, for mysql you can use: WHERE (LEFT('Brick',3) = LEFT(Post Code,3)) If you are using other dbserver, check your manual. - Original Message - From: "Shaun" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, February 16, 2004 10:45 PM Subject: [PHP-DB] Brick Codes > Hi, > > I have a table of Locations around the country. My system produces reports > based on these Locations. I also have a table containing Brick Codes e.g. > > BrickPost Code > AB51AB51 > AB52AB52 > AB55AB55 > AB56AB56 > AL01AL1 > AL02AL2 > AL03AL3 > AL04AL4 > > > How can I compare the first 3 or 4 letters of the postcode in the Locations > table to the corresponding entry in the Brick Codes table so I can add it to > my report? > > Thanks for your help > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] - Resizeing Images stored in mysql db
I havent used GD but i know it can make that, try: - the other mailing list you will get help. - read the docs (phpmanual) - you could use the pear package ImageTransform it looks like what you want :) http://www.pear.php.net/package/Image_Transform Here is the description of the package: --- This package was written to provide a simpler and cross-library interface to doing image transformations and manipulations. It provides : * support for GD, ImageMagick, Imagick and NetPBM * files related functions * addText * Scale (by length, percentage, maximum X/Y) * Resize * Rotate (custom angle) * Add border (soon) * Add shadow (soon) - Original Message - From: "Nikos Gatsis" <[EMAIL PROTECTED]> To: "PHP-mailist" <[EMAIL PROTECTED]> Sent: Monday, February 16, 2004 3:36 PM Subject: Re: [PHP-DB] - Resizeing Images stored in mysql db > Thank you Recardo > Is possible to know the dimensions (x, y) of the stored image? > > I try ImageCreateFromJPEG($mystoredpict) and ImagesX($mystoredpict) but > dosen't work > > - Original Message - > From: "Ricardo Lopes" <[EMAIL PROTECTED]> > To: "Nikos Gatsis" <[EMAIL PROTECTED]> > Cc: "PHP DB" <[EMAIL PROTECTED]> > Sent: Monday, February 16, 2004 4:41 PM > Subject: Re: [PHP-DB] - Resizeing Images stored in mysql db > > > > To know the size of the images you could use a library like GD or > something > > like that. > > > > You can also store one big image in your database and use the graphics > > library to create a temporary image that will be send to the client with > the > > size / scale you want to send to the client. This way your 50k or 5000k > > image will be used to create a small image ~5k that will be send to the > > client. > > > > Hope this helps > > > > - Original Message - > > From: "Nikos Gatsis" <[EMAIL PROTECTED]> > > To: "PHP-mailist" <[EMAIL PROTECTED]> > > Sent: Monday, February 16, 2004 2:23 PM > > Subject: Re: [PHP-DB] - Resizeing Images stored in mysql db > > > > > > > Thanx > > > but, first I dont know the real size of the stored pictures and second I > > > dont think that is a good idea to shrink a 50k photo. > > > > > > - Original Message - > > > From: "Frisley Velasquez" <[EMAIL PROTECTED]> > > > To: "Nikos Gatsis" <[EMAIL PROTECTED]> > > > Sent: Monday, February 16, 2004 4:16 PM > > > Subject: Re: [PHP-DB] - Resizeing Images stored in mysql db > > > > > > > > > > Hi, the only thing you need to do, is to add a varible where you > specify > > > the > > > > width and the height of the pics. then add the var in the query. This > to > > > be > > > > parsed not just as a but as > > > height="...">, so your images will be the width and height you want. > > > > > > > > Or if you would like dif. sizes, add a column in the table so you can > > > enter > > > > the width and height of each one, so you can call this ones(width and > > > > height) in each case. > > > > > > > > - Original Message - > > > > From: "Nikos Gatsis" <[EMAIL PROTECTED]> > > > > To: "PHP-mailist" <[EMAIL PROTECTED]> > > > > Sent: Monday, February 16, 2004 6:56 AM > > > > Subject: [PHP-DB] - Resizeing Images stored in mysql db > > > > > > > > > > > > > Hello list > > > > > > > > > > I store images in a mysql table and use then in a web site. > > > > > > > > > > Is possible to change the size of these images; > > > > > > > > > > > > > > > Following the code I'm allredy use. > > > > > > > > > > $query="SELECT photoxl FROM books WHERE books_id = '$books_id'"; > > > > > $result=mysql_db_query($database, $query, $conn) or Die > > > > > ("...".mysql_error()); > > > > > list($photoxl)=mysql_fetch_row($result); > > > > > $type = $photoxl_type; > > > > > if (!empty($photoxl)) { > > > > > header("Content-Type: {$type}"); > > > > > echo $photoxl; > > > > > } > > > > > > > > > > Thank you in advance > > > > > > > > > > -- > > > > > PHP Database Mailing List (http://www.php.net/) > > > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > > > > -- > > > PHP Database Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] - Resizeing Images stored in mysql db
To know the size of the images you could use a library like GD or something like that. You can also store one big image in your database and use the graphics library to create a temporary image that will be send to the client with the size / scale you want to send to the client. This way your 50k or 5000k image will be used to create a small image ~5k that will be send to the client. Hope this helps - Original Message - From: "Nikos Gatsis" <[EMAIL PROTECTED]> To: "PHP-mailist" <[EMAIL PROTECTED]> Sent: Monday, February 16, 2004 2:23 PM Subject: Re: [PHP-DB] - Resizeing Images stored in mysql db > Thanx > but, first I dont know the real size of the stored pictures and second I > dont think that is a good idea to shrink a 50k photo. > > - Original Message - > From: "Frisley Velasquez" <[EMAIL PROTECTED]> > To: "Nikos Gatsis" <[EMAIL PROTECTED]> > Sent: Monday, February 16, 2004 4:16 PM > Subject: Re: [PHP-DB] - Resizeing Images stored in mysql db > > > > Hi, the only thing you need to do, is to add a varible where you specify > the > > width and the height of the pics. then add the var in the query. This to > be > > parsed not just as a but as > height="...">, so your images will be the width and height you want. > > > > Or if you would like dif. sizes, add a column in the table so you can > enter > > the width and height of each one, so you can call this ones(width and > > height) in each case. > > > > - Original Message - > > From: "Nikos Gatsis" <[EMAIL PROTECTED]> > > To: "PHP-mailist" <[EMAIL PROTECTED]> > > Sent: Monday, February 16, 2004 6:56 AM > > Subject: [PHP-DB] - Resizeing Images stored in mysql db > > > > > > > Hello list > > > > > > I store images in a mysql table and use then in a web site. > > > > > > Is possible to change the size of these images; > > > > > > > > > Following the code I'm allredy use. > > > > > > $query="SELECT photoxl FROM books WHERE books_id = '$books_id'"; > > > $result=mysql_db_query($database, $query, $conn) or Die > > > ("...".mysql_error()); > > > list($photoxl)=mysql_fetch_row($result); > > > $type = $photoxl_type; > > > if (!empty($photoxl)) { > > > header("Content-Type: {$type}"); > > > echo $photoxl; > > > } > > > > > > Thank you in advance > > > > > > -- > > > PHP Database Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Optimize Table
sorry i have a great error in my last post, when i say: PhpmyAdmin or any other php script can be scheduled, i mean: PhpmyAdmin or any other php script _CAN_ _NOT_ be scheduled, it happends. - Original Message - From: "Ricardo Lopes" <[EMAIL PROTECTED]> To: "Ng Hwee Hwee" <[EMAIL PROTECTED]> Cc: "PHP DB" <[EMAIL PROTECTED]> Sent: Friday, February 13, 2004 10:30 AM Subject: Re: [PHP-DB] Optimize Table > For the overhead i can't tell you anything, probably you will have something > in the mysql manual. > > About the locking i supose that your users will be able to select from the > table, but wont be able to do updates, etc.. while the optimization ocurrs. > The database will probably put those instruction on hold till the > optimization ends, só you probably wont even have to care with that. > > But the optimization is an expensive operation (consume many resources), so > the best it to do it in a time when the operations on the database are > minimal or none. PhpmyAdmin or any other php script can be scheduled, they > only execute when a client request the page. But you can schedule a job in > you operative system to do that cron / at for *nix/linux, windows also have > schedule managers. > > Hope it helps. > Ricardo Lopes > > - Original Message - > From: "Ng Hwee Hwee" <[EMAIL PROTECTED]> > To: "DBList" <[EMAIL PROTECTED]> > Sent: Friday, February 13, 2004 2:04 AM > Subject: [PHP-DB] Optimize Table > > > Hi all > > I read that it is neccessary and good to optimize my DB tables frequently.. > I am using phpMyAdmin-2.5.4 to maintain my database and the program showed > me that my overhead for some tables is over 5000. Can i know when would be > good for me to optimise my tables? For example, once I have an overhead of > 1000, I should optimise my tables? > > Another of my concern is that, when I optimise tables, I read that my tables > will be locked. Does it mean that my customers cannot do a select statement > on the table? In this case, can I schedule phpMyAdmin to optimise the table > at a certain time, say 3am when there is very little traffic?? > > Thank you so much! > > kind regards, > hwee > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Optimize Table
For the overhead i can't tell you anything, probably you will have something in the mysql manual. About the locking i supose that your users will be able to select from the table, but wont be able to do updates, etc.. while the optimization ocurrs. The database will probably put those instruction on hold till the optimization ends, só you probably wont even have to care with that. But the optimization is an expensive operation (consume many resources), so the best it to do it in a time when the operations on the database are minimal or none. PhpmyAdmin or any other php script can be scheduled, they only execute when a client request the page. But you can schedule a job in you operative system to do that cron / at for *nix/linux, windows also have schedule managers. Hope it helps. Ricardo Lopes - Original Message - From: "Ng Hwee Hwee" <[EMAIL PROTECTED]> To: "DBList" <[EMAIL PROTECTED]> Sent: Friday, February 13, 2004 2:04 AM Subject: [PHP-DB] Optimize Table Hi all I read that it is neccessary and good to optimize my DB tables frequently.. I am using phpMyAdmin-2.5.4 to maintain my database and the program showed me that my overhead for some tables is over 5000. Can i know when would be good for me to optimise my tables? For example, once I have an overhead of 1000, I should optimise my tables? Another of my concern is that, when I optimise tables, I read that my tables will be locked. Does it mean that my customers cannot do a select statement on the table? In this case, can I schedule phpMyAdmin to optimise the table at a certain time, say 3am when there is very little traffic?? Thank you so much! kind regards, hwee -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Accessing my variables
you forget the last ' on your include string: didnt you see the error message of php ? if dont change you error reporting for development, this an error easy to find out if you have your error reporting set to E_ALL. - Original Message - From: "J. Kevin C. Burton" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, February 11, 2004 5:28 PM Subject: [PHP-DB] Accessing my variables > Hey all.. I am using PHP5 and apache 2.0 on windows xp pro. > > My problem is: > > I have an include file: global.inc.php > Inside that file I have: > > $myVariable = "xankjndckjnskncd"; > > now I have a index.php that has: > > Include('global.inc.php); > Print $myVariable; > ?> > > Anyone got a clue on this one? > > Kevin > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Run SQL-Server command using PHP
You can use something like: SELECT MyFunction(); Thinks works on mySQL, i'm not sure if it works on mssql but you can give it a try. Tanks to Alban Médici (NetCentrex) who told me this a month ago on this list :) - Original Message - From: "indra Siregar" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 12, 2004 12:47 AM Subject: [PHP-DB] Run SQL-Server command using PHP > How I can run sql-server using PHP, like sp (stored procedure) in SQL-Server > > ThankYou > -- > Indra Siregar > IF02008 > Politeknik Informatika Del > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] page hit tracking
you could create a counter table and store there the vegetable id and the hits. After that each time you search for a vegetable, make an update to the table. - Original Message - From: "js" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, February 06, 2004 8:18 AM Subject: [PHP-DB] page hit tracking i am using php MySQL and i want to know how i can make a hidden value for certain entries in a table and how many times they are called. for instance, say i have a table of vegetables people can look at. the page displays all of the vegetables, and then it generates links to each one and if the user clicks on one then the page just calls itself and displays more information about the vegetables. now, how do i make a counter where theres a field in the table where it increases by 1 everytime someone looks at a particular vegetable. i really am new to this so thank you for your help. thanks -james -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Acessing a excel worksheet from a php site
In my modest opinion it woul be much easier and faster to export the worksheet as a CSV file and parse the file in PHP than creating a macro in VBA to extract the data to a text file. - Original Message - From: "Griffiths, Daniel" <[EMAIL PROTECTED]> To: "Bruno Pereira" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, February 06, 2004 9:10 AM Subject: RE: [PHP-DB] Acessing a excel worksheet from a php site I dont know any way to actually open and read the file with php, havent come across any classes or methods that will do this. My solution when I had this problem was to do it in 2 parts, run a macro on the excel file that will extract the data to a text file and then use php to read that into the db. if there is a way to open excel files and read them with php i'd love to know about it. -Original Message- From: Bruno Pereira [mailto:[EMAIL PROTECTED] Sent: 06 February 2004 03:36 To: [EMAIL PROTECTED] Subject: [PHP-DB] Acessing a excel worksheet from a php site I'm making a site to a company and they have a excel worksheet where i have to get the data to a site in php. My question is simple, i think, how can i get it? Cumprimentos Bruno Pereira DSI [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP and mail forms
I would recomed you to use: $to_name=$myrow[3].$string; <-- Notice the dot . and no " instead of: $to_name="$myrow[3]$string"; > On hitting the submit button, I see the server being called and data being sent, but > nothing is being received. I'm just wondering if I've appended those two things correctly. If you mean the server sends the email but it isnt recived in the other server i can't help you i dont use the mail function, in this kind of questions you should use the other mailing list instead of this, this is only from database questions related to php. Good luck. BTW i guess there are other function you could use for sending email instead of mail consult the php documentation to know more. - Original Message - From: "Phil Matt" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, January 30, 2004 4:18 PM Subject: [PHP-DB] PHP and mail forms > Ricardo Lopes wrote: > > > There are several ways to do this. > > Some people like the approach: > > > > if ($submit) { send_email(); } > > > > or you can put a hidden field in your form, like op: > > > > > > > > and use: > > > > if (isset($HTTP_GET_VARS['op']) && ($HTTP_GET_VARS['op'] == 'send')) > > { > > send_email(); > > } > > Thanks again, Ricardo. I now have the form communicating with the server. > > I think that I might have an error in my script: > > Where I join together the value of the passed variable ("$myrow[3]") and the string > containing the domain ( $string="@somedomain.com") I used: > > $to_name="$myrow[3]$string" > > If the passed variable's value is, for instance, "smith", then does my $to_name become: > > [EMAIL PROTECTED] > > On hitting the submit button, I see the server being called and data being sent, but > nothing is being received. I'm just wondering if I've appended those two things correctly. > > TIA for your continued assistance. > > Cheers --- Phil > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP and mail forms
There are several ways to do this. Some people like the approach: if ($submit) { send_email(); } or you can put a hidden field in your form, like op: and use: if (isset($HTTP_GET_VARS['op']) && ($HTTP_GET_VARS['op'] == 'send')) { send_email(); } and there are many others. by the way in the code you wrote you have: and then you use: $id=$_GET['id']; <--- if this is the same than $HTTP_GET_VARS['id'] this wont work Where does that mail function (is it a function?) go? The function sends an email, for more details consult the php manual. - Original Message - From: "Phil Matt" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, January 29, 2004 7:10 PM Subject: [PHP-DB] PHP and mail forms > Hello to all. > > I am trying to write a simple (at least I thought it was simple...) "Contact Us" form that > sends an email when it is submitted. > > The $to_name variable was passed from a previous page. I am sure that the variable > was passed, as I can echo it and it is being passed correctly - thanks to this list! > > The problem I am having is this: I cannot quite figure out how an html form handles this > mail function when the "to" field is filled with an existing variable. > > This is what I've got: (I removed all of the table formatting to make it clearer here) > > > > > > id="message"> > > > > > So, I think that this sets up the form for processing, AFAIK. > > Then, I added the stuff that pulls the email address associated with the id in $to_name > from the MySQL database, and adds the string for the proper domain. I've left out the > connection stuff for clarity: > > $id=$_GET['id']; > $string="@somedomain.com"; > $result= mysql_query("SELECT * FROM mydatabase WHERE ID=$id",$db); > while ($myrow = mysql_fetch_row($result)){ > $to_name="$myrow[3]$string"; } ?> > > I know that the "thing" that actually sends mail looks like this: > > mail($to_name, $from_name, $subject, $message, "From: $from_email\nX-Mailer: PHP/" > .. phpversion()); > > But how do I get this all to happen when the user hits the submit button? Where does > that mail function (is it a function?) go? I have read a lot of stuff on the various PHP lists > and sources, but I just cannot figure out this piece of the puzzle. > > TIA for your suggestions, and for your patience with my lack of knowledge here. > > -- Phil Matt > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Unexpected Session Behavior on Mozilla
Both Internet Explorer and Mozilla browsers when you have multiple windows there is only one application instance running, this is done to save memory and make the program run faster. Probably (i'm not sure) Mozilla behaves diffent than Internet Explorer in this situation. My advice is that you contact the mozilla mailing list and they will give the answer you are looking for. - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, January 28, 2004 7:57 PM Subject: [PHP-DB] Unexpected Session Behavior on Mozilla > Hello PHP-DB listers, > > I've a PHP, MySQL Web Page script that branches according to browser > (e.g., MSIE, or Mozilla ) and which uses a small number of session > variables. I've noticed that when connecting through Explorer, for each > browser / page instance opened on the same machine, there is a new session > file created ( as I would expect ). Yet when connecting through Mozilla > on RH9, there is only one session file created per machine, which causes a > second instance of the page to inherit the values of the session variables > from the previously opened page. This is confusing to me, to say the > least. Anybody have any thoughts as to why this is occurring? > > MySQL 4.0.16 > PHP 4.3.4 > Apache 2.0.48 > Win2K IE 5.50x > RH9 Mozilla 1.2.1 > > Dave -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Problem with passing variables
Yes, the sintax is correct (if you are inside an echo or inside a print opened with ' and not with "). ex: echo '';<-- correct echo ""; <--- error !!! (parse error) I know that you must be using the first one, but just in case ... You can also do something different, put your html code as html not as php code as you are doing. This will save time, because you dont need to scape the slashes ' " , your code will have less errors and it will run faster because the server doesnt have to call the print or echo method from php. Example: instead of: class="imglink" alt="Click to send mail to this person" />'; ?> use: there is a shorter way to print but i dont remeber the sintax, if you want to know consult the php manual. it is something like i guess This way the php sintax is reduced to its minimun. - Original Message - From: Phil Matt To: Ricardo Lopes ; [EMAIL PROTECTED] Sent: Tuesday, January 27, 2004 4:27 PM Subject: Re: [PHP-DB] Problem with passing variables On 27 Jan 2004 at 15:56, Ricardo Lopes wrote: > If you have something like this: > > echo ' class="imglink" alt="Click to send mail to this person" />'; > > It wont work. Use instead: > > echo ' src="graphics/mail.gif" class="imglink" alt="Click to send mail to this > person" />'; > > Notice the '. before the $myrow[0] and the .' after, any doubt see the > documentation about operators. > > This is caused because the ' doesnt parse variables to values like the " > does. > Ricardo - That's it! I did read a lot of PHP docs and mailing list posts before I posted my question to this list, but never stumbled (and that's the word, I'm afraid!) on the syntax explanation that would untangle this for me. If I want to pass additional variables for processing on the second page, I'm assuming that the syntax would be (where $foo is another variable) Thanks again for restoring my sanity! Cheers --- Phil Matt -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Results with ledger stripes?
It isnt pretty, efficient or small, but it works... :) - Original Message - From: "Gary Every" <[EMAIL PROTECTED]> To: "Ryan Jameson (USA)" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, January 27, 2004 4:13 PM Subject: RE: [PHP-DB] Results with ledger stripes? Haven't been following this thread, but here's how we do it: If($bgc == '') { $bgc = "#DD"; } elseif($bgc == "#FF") { $bgc = "#DD"; } else { $bgc = "#FF"; } Gary Every Sr. UNIX Administrator Ingram Entertainment Inc. 2 Ingram Blvd, La Vergne, TN 37089 "Pay It Forward!" -Original Message- From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED] Sent: Monday, January 26, 2004 12:00 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Results with ledger stripes? $bg1 = "#dd"; $bg2 = "#ff"; While ... $bg3 = $bg2; $bg2 = $bg1; $bg1 = $bg3; echo " Makes sense? <>< Ryan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Sunday, January 25, 2004 6:43 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Results with ledger stripes? Hello all, I'm in the midst of creating an internet speed test system thingamabob for my website. It's basically finished...but ugly as sin. What I'd like to do is have the results (an average of each domain tested) listed in a nice pretty table with alternating background colors, kinda like a ledger. How on earth do I do this? Here's what I've got thus far: "; $mongo = @mysql_query ("SELECT substring_index(name,'.',-2),ROUND(AVG(speed),1) FROM `readings` GROUP BY substring_index(name,'.',-2) ORDER BY substring_index(name,'.',-2) ASC"); echo "DomainAverage Speed\n"; while ($mongorow = mysql_fetch_array($mongo, MYSQL_NUM)) { echo "$mongorow[0]$mongorow[1]\n";} echo ""; ?> And I'd like it to spit out something along these lines: domain1.com666.6 kbps domain2.com3000.0 kbps repeat until done The gizmo is up and running at http://www.dibcomputers.com/bandwidthmeter/index.php if you care to have a gander. Thanks a bunch, Dan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Problem with passing variables
If you have something like this: echo ''; It wont work. Use instead: echo ''; Notice the '. before the $myrow[0] and the .' after, any doubt see the documentation about operators. This is caused because the ' doesnt parse variables to values like the " does. - Original Message - From: "Phil Matt" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, January 27, 2004 3:08 PM Subject: [PHP-DB] Problem with passing variables > Hello to all. > > I am a relative newcomer to PHP. I am trying to pass the value of a variable from a > MySQL database from one PHP page to another PHP page. On the first page, I've made > the connection to the database, and the query works just fine, displaying the correct > values from the $myrow fields. > > This is the code to that point: > > $db = mysql_connect("ip address here","user here","password here") or die ("Unable to > connect to SQL server"); > mysql_select_db("databasename",$db); > ; > $result= mysql_query("SELECT * FROM databasename WHERE ID<20",$db); > echo' > NameTitlePhoneE-mail'; > while ($myrow = mysql_fetch_row($result)){ > echo' > '. $myrow[0].' > '. $myrow[1].' > '. $myrow[2].' > > This works just fine. Then I try to pass the variable $myrow[0] to a second page, where > the value of the variable (a string that contains a name) is supposed to appear. Here's > the line of code: > > alt="Click to send mail to this person" />'; > > > The page receiving this variable, email.php, uses this to retrieve the value of $myrow[0]: > > Send e-mail to > > > However, all this manages to do is to print out this: > > Send e-mail to $myrow[0] > > Instead of the VALUE contained in the variable! > > What am I doing wrong? > > TIA --- Phil Matt > > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Results with ledger stripes?
I dont see what is your problem, your code do almost anything. Is you pretend to generate the output in html as you show in the example, you just have to add the color property in the "td" or "tr" tag, take care with the " in the code. ex: $dummy_var = 0; $dummy_array = array("#dd", "#ff"); while ($mongorow = mysql_fetch_array($mongo, MYSQL_NUM)) { echo "$mongorow[0]$mongorow[1] \n"; $dummy_var++; } And thats is it. You could use css or other things, thats up to you. Hope thats solved. - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, January 26, 2004 1:42 AM Subject: [PHP-DB] Results with ledger stripes? > Hello all, > > I'm in the midst of creating an internet speed test system thingamabob for > my website. It's basically finished...but ugly as sin. What I'd like to do > is have the results (an average of each domain tested) listed in a nice > pretty table with alternating background colors, kinda like a ledger. How > on earth do I do this? > > Here's what I've got thus far: > > echo "Average speeds of each domain tested:"; > $mongo = @mysql_query ("SELECT > substring_index(name,'.',-2),ROUND(AVG(speed),1) FROM `readings` GROUP BY > substring_index(name,'.',-2) ORDER BY substring_index(name,'.',-2) ASC"); > echo "DomainAverage Speed\n"; > while ($mongorow = mysql_fetch_array($mongo, MYSQL_NUM)) { echo > "$mongorow[0]$mongorow[1]\n";} > echo ""; > ?> > > And I'd like it to spit out something along these lines: > > domain1.com666.6 kbps > domain2.com3000.0 kbps > repeat until done > > > The gizmo is up and running at > http://www.dibcomputers.com/bandwidthmeter/index.php if you care to have a > gander. > Thanks a bunch, > Dan > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Drop down box NOT populated
- Original Message - From: Larry Sandwick To: [EMAIL PROTECTED] Sent: Thursday, January 22, 2004 3:46 PM Subject: [PHP-DB] Drop down box NOT populated Can anyone tell me what I am missing here, The Select statement does not populate my drop down window? My drop down box is empty ! [snip] $how_many Accounts to pick from !!!"; $sql = mysql_query("SELECT distinct(Account) FROM Backlog")or die ("Something bad happened here: " . mysql_error()) ; echo "\n"; echo "\n";-- WHAT IS THIS DOING HERE ! while ($row = mysql_fetch_array($sql)) { echo ' '.$row["account"]."\n"; } echo "\n"; ?> [end snip] Larry Sandwick Sarreid, Ltd. Network/System Administrator phone: (252) 291-1414 x223 fax : (252) 237-1592
Re: [PHP-DB] breaking apart data
You probably have more luck in a regular expression mailing list. Just an opinion. - Original Message - From: "Larry R. Sieting" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, January 20, 2004 4:17 PM Subject: Re: [PHP-DB] breaking apart data > duh (me) > > okay... I am wanting to wrap the lines of text in bullets and perform some > text formatting on it (highlight, bold, underling, etc..) using css classes > > > At 11:12 AM 1/20/2004, you wrote: > >From: "Larry R. Sieting" <[EMAIL PROTECTED]> > > > > > what would be the most efficient way to rework this data in to what I am > > > after > > > > > > stored text: > > > asdf asdf sadl jf lsakdjf a \r\n asdfierw aweiufasd asiuwr \r\n > > > asdhfauiweuhrahsd \r\n > > > > > > displays text as: > > > asdf asdf sadl jf lsakdjf a > > > asdfierw aweiufasd asiuwr > > > asdhfauiweuhrahsd > > > > > > I would like to highlight parts of the above. > > > >What do you mean by "highlight" it? And how do you know what parts need to > >be highlighted?? > > > >---John Holmes... > > Larry R. Sieting > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: [PEAR] DB Module Extension Problem
In my windows PHP installation i have to uncomment i line in the php.ini file that has something like: ;extension=mssql.dll you have to configure your php ini file. Set extensions dir and uncomment the mssql.dll (you will probably have mssql.so or something like that) In my case the dll's where included by default in my installation. I remeber that there was a section in the php.ini in which you could configure some mssql params but i dont remeber if that was needed. it looks like: [mssql] mssql.x= mssql.x= I didnt need to do any compilation to make it work, just uncommented some lines and set the extensions dirs. See your phpinfo() and look if the mssql was loadded (of curse it wasnt because you had that error message.) hope it helps. - Original Message - From: "Stanley Chan" <[EMAIL PROTECTED]> To: "Robert Munteanu" <[EMAIL PROTECTED]> Cc: "Lukas Smith" <[EMAIL PROTECTED]>; "PEAR general list" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, January 19, 2004 3:18 PM Subject: [PHP-DB] Re: [PEAR] DB Module Extension Problem > Hi Robert, > > Thanks for your information. Does it mean that PEAR:DB > is not fully independent module? It still requires > some special compilation in PHP compiler. > > -stan > > --- Robert Munteanu <[EMAIL PROTECTED]> > 的郵件內容:> On Mon, 2004-01-19 at 10:40, Stanley > Chan wrote: > > > Hi Lukas, > > > > > > Do you mean that there are some tricky steps I > > should > > > follow? Might I know where I can get the > > information? > > > > > > Thanks, > > > -stanley > > > > > The manual helps, as always: > > http://www.php.net/manual/en/ref.mssql.php > > > > > > --- Lukas Smith <[EMAIL PROTECTED]> > > > ???隞嗅?摰對?> Stanley Chan wrote: > > > > > > > > > Hi friends, > > > > > > > > > > My program runs on a Linux Server (RH 7.3) > > with > > > > PHP > > > > > 4.3.2. I also installed a package of PEAR::DB > > > > > 1.5.0RC2. > > > > > > > > > > My program is supposed to connect to a remote > > > > > Microsoft SQL Server 2000, so I make a DSN > > like > > > > this > > > > > > > > > > mssql://user:[EMAIL PROTECTED]/dbname > > > > > > > > > > When I try to connect, it prompts: > > > > > > > > > > DB Error: extension not found > > > > > > > > this error tries to tell you that you are > > missing > > > > the needed extensions > > > > in your php installation. > > > > > > > > mssql installation is somewhat non trivial. > > either > > > > way its a question > > > > best asked on php-general@ or php-db@ > > > > > > > > regards, > > > > Lukas Smith > > > > [EMAIL PROTECTED] > > > > ___ > > > > BackendMedia > > > > www.backendmedia.com > > > > [EMAIL PROTECTED] > > > > > > > > Linn Zwoch Smith GbR > > > > Pariser Str. 44 > > > > D-10707 Berlin > > > > > > > > Tel +49 30 83 22 50 00 > > > > Fax +49 30 83 22 50 07 > > > > > > > > -- > > > > PEAR General Mailing List (http://pear.php.net/) > > > > To unsubscribe, visit: > > http://www.php.net/unsub.php > > > > > > > > > > > > > _ > > > Shining Friends??末敹?末?晞?革???甇?.. > > > 瘚芣憤?渲? ?鼠 > > > http://ringtone.yahoo.com.hk/ > > -- > > Robert Munteanu <[EMAIL PROTECTED]> > > > > _ > Shining Friends、好心好報、歲月如歌... > 浪漫鈴聲 情心連繫 > http://ringtone.yahoo.com.hk/ > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Windows 2003 Server
Please post this message in english or spanish or portuguese, those are the only languages i understand. Por favory enviari mensagi in español, ingles o portugues. Io no parlare italiano. - Original Message - From: "Andrea Fenilxxx" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, January 19, 2004 11:08 AM Subject: Re: [PHP-DB] Windows 2003 Server > Sto realizzando una pagina di invio mail per una mailing list. > La mail parte regolarmente. > Sul mio pc (Win Xp si vede bene, così come su molti altri pc) > Qualcuno sa spiegarmi perchè, su alcuni windows ('98), invece dell'html mi > genera una mail NON html (quindi si vede solo il codice... una > schifezza!!!). > Forse sbaglio charset=iso-8859??? > > Sono stressato! > $messaggio è una concatenazioni di header.$corpo.footer > Il corpo è generato da una textarea > --- > > > > $oggetto="Newsletter 4winds - OFFERTE di VIAGGIO"; > $messaggio= ' > > > Titolo > > > Corpo header > > > ' > .$corpo. > > ' > > > > > Corpo footer > > > '; > > // l'intestazione Content-type per inviare email in formato HTML > $intestazioni = "MIME-Version: 1.0\r\n"; > $intestazioni .= "Content-type: text/html; charset=iso-8859-1\r\n"; > > // intestazioni addizionali - From > $intestazioni .= "gestore mailing list "; > > //destinatari > $to = " - destinatari - "; > > mail($to, $oggetto, $messaggio, $intestazioni); > > ?> > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Windows 2003 Server
I use apache+php+mysql in a test environment in windowsXP and have no problems. Windows 2003 Server is a little new, but i think there are no problems. You could use more updated versions of apache and mysql, they are avaliable for some time and have some really nice new features. - Original Message - From: "Viorel Dragomir" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, January 19, 2004 10:43 AM Subject: Re: [PHP-DB] Windows 2003 Server > > > > Is there any problem to install > > 1. apache version 1.3.23 > > 2. PHP version 4.1.1 > > 3. mySQL version 3.23.29 > > > > into windows 2003 server > > > > If there are any, please report them :) > The only problem that I do know is why do you want to do that? > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] replacing once with ereg_replace
$new_php_self = substr($PHP_SELF, 1); Does this has anything to do with db?? - Original Message - From: "lisi" <[EMAIL PROTECTED]> To: "PHP-DB" <[EMAIL PROTECTED]> Sent: Monday, January 19, 2004 10:21 AM Subject: [PHP-DB] replacing once with ereg_replace > I have a problem with two possible solutions, I'm just not sure how to do > either one. > > I have a number of pages and their links stored in a MySQL db. The links > are stored without the leading slash (i.e. animals/birds/birds.htm). > $PHP_SELF returns the link with the leading slash (i.e. > /animals/birds/birds.htm). > > I need these two strings to match. There are two ways to do this: > > 1) Solution: Remove the leading slash from $PHP_SELF > Problem: How do remove only the first instance of the slash with > ereg-replace and leave the others? Or is there another function that would > do this? This may be obvious but I didn't see it in the documentation. > > 2) Solution: Add the leading slash to each entry in the db (MySQL) > Problem: How do I do this with a query without having to change each > one manually? I know I can change the link field using UPDATE but how would > I tell MySQL to change the entry to / + entry? Each entry is obviously > different. Using a plus makes MySQL think it's mathematical addition and > sets the field to 0. The field type is varchar. > > Thanks in advance for any suggestions! > > -Lisi > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Stored Procedures ?
That's fantastic. Thank you very much. - Original Message - From: "Alban Médici (NetCentrex)" <[EMAIL PROTECTED]> To: "Ricardo Lopes" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, January 19, 2004 9:58 AM Subject: Re: [PHP-DB] Stored Procedures ? yep just call the name of your function as : SELECT MyFunction(); Ricardo Lopes wrote: >Is possible to call database stored procedures from php with oracle or >any other db? > > > -- Alban Médici R&D software engineer -- you can contact me @ : IPPhone : +33 (0)2 31 46 37 68 [EMAIL PROTECTED] http://www.netcentrex.net -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Stored Procedures ?
Is possible to call database stored procedures from php with oracle or any other db?