Re: [PHP-DB] RE: SELECT WHERE length of content question

2011-03-11 Thread Constantin Brinzoi

Do not forget to use TRIM function as well:

LENGTH(TRIM(fax))

in order to elliminate leading and trailing spaces.

Aurel

- Original Message - 
From: Geoffrey Pitman geoffrey.pit...@gmail.com

To: php-db@lists.php.net
Sent: Friday, March 11, 2011 7:59 PM
Subject: [PHP-DB] RE: SELECT WHERE length of content question


You should be able to use the MySQL command LENGTH() command. I'm assuming
that your fax field is a varchar or char(10) field. If it's a number (which
it probably shouldn't be), I suppose you could write a query to find values
equal to or greater than 100,000,000,000.

http://dev.mysql.com/doc/refman/5.5/en/string-functions.html#function_length

I hope this helps.

Geoff

-- Forwarded message --
From: Ron Piggott ron.pigg...@actsministries.org
To: php-db@lists.php.net
Date: Wed, 9 Mar 2011 17:49:42 -0500
Subject: SELECT WHERE length of content question

Is there a command in mySQL that would allow me to SELECT the rows where the
`fax` column is more than 11 characters long?

OR

Do I need to use PHP to assess this?

Ron

The Verse of the Day
“Encouragement from God’s Word”
http://www.TheVerseOfTheDay.info http://www.theverseoftheday.info/


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] query help

2010-11-17 Thread Constantin Brinzoi

Hey,

You can also try PEAR module MDB2 to insert an array into a table. The
function is: executeMultiple. This works for other SQL queries too.

Check this link please:
http://pear.php.net/manual/en/package.database.mdb2.intro-execute.php

Cheers,


-Original Message-
From: Artur Ejsmont [mailto:ejsmont.ar...@gmail.com] 
Sent: 17 noiembrie 2010 16:07
To: Vinay Kannan
Cc: PHP DB; php mysql
Subject: Re: [PHP-DB] query help

well  i guess you could do that. but it gets complicated after a while
and there will be a lot of work and probably after a while you will get into
some problems. You have to handle escaping, special types etc. Then what
about performance? how to query the data ...
using similar approach or is it just for inserts? there is a bit of work to
make it really usable i guess.

I am not saying its wrong though, I have seen this approach twice ...
in general its possible.

Maybe better choice would be to try to use some orm ? there are plenty of
frameworks out there  the only problem is the learning curve may be
steep.

What others think?

art

On 17 November 2010 13:51, Vinay Kannan viny...@gmail.com wrote:
 Hello PHP Gurus,

 I need your help on an insert query.

 I wanted to know if there is way to insert an array of values into a 
 DB. An eg would explain this better :

 If I have 2 tables in a DB, 1) users has 3 columns 2) hobbies = 5 
 columns

 I was thinking of having a single function which will perform the 
 insert on any  insert which happens on the entire website.

 Eg : This function can be called with 2 parameters, the first 
 parameter the table name, and the second parameter is an array of 
 values which will be inserted into the table.
 eg : Users has these columns [1]ID [2] Name [3]Location so the 
 function call would be something like *
 insert_into_tbale(users,array[user_values])*
 **
 Does this make sense ? Is this a good method to follow ?

 Thanks in advance !

 Vinay Kannan.




--
Visit me at:
http://artur.ejsmont.org/blog/

--
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] Specific order by MySQL statement

2005-11-07 Thread Constantin Brinzoi
One possibility is to use codes for this filed, such as:

10 for Current;
20 for Completed;
30 for Withdrawn;
40 for Transferred.

a.s.o.

If you will discover other states of the field you can insert them
apropriatelly (if you want Canceled state to be inserted and to be
displayed last put the code 45 for it).

Best regards, 
Aurel


On Mon, 2005-11-07 at 11:47 +, Adrian Bruce wrote:

 Hi
 
 I am trying to get results from a MySQL query in a specific order, just 
 using ASC or DESC will not work.
 
 For Example I have a field that can contain 4 possible values: 
 'Current', 'Completed','Withdrawn' or 'Transferred',  I would like to 
 order the results specifically like:
 
 Current
 Completed
 Withdrawn
 Transferred
 
 Is there any way i can do this using MySQL?  Any help will be much 
 appreciated.
 
 Thanks, Ade
 


Re: [PHP-DB] NOT NULL - newbie

2005-10-05 Thread Constantin Brinzoi
Hi!

I think that NOT NULL comes together with PRIMARY KEY and not with
AUTO_INCREMENT.
Follow this link http://dev.mysql.com/doc/mysql/en/create-table.html for
detailed information about creating tables in MySQL.

Have a nice day!
Aurel


On Wed, 2005-10-05 at 12:15 +0200, W Roothman wrote:

 Dear All,
 
 When declaring values for an identifier with unsigned auto_increment, is it 
 necessary to include NOT NULL?
 
 my_id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
 
 or
 
 my_id INT  NOT NULL UNSIGNED AUTO_INCREMENT PRIMARY KEY,
 
 Regards,
 
 Will 


[PHP-DB] Problem with PHP_AUTH_USER

2003-12-15 Thread Constantin Brinzoi
Hi!

Here is the problem:

How can I unset the $PHP_AUTH_USER when the user clicks logout?

The authentication works very well except the log out.
I tried:
session_destroy(); 
unset($_SERVER['PHP_AUTH_USER'])

and in the next line I did:

print $PHP_AUTH_USER;

and the value is still there.

How can I unregister this variable so that the authentication window
appears again.

I'm using apache 2.0.40, php 4.2.2 compiled as a module, RedHat Linux
9.0. Register globals is On.

TIA
Constantin Brinzoi.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Another question

2003-12-15 Thread Constantin Brinzoi
Is there a php function that closes a browser window?

I know there is a javascript function (window.close), but I can't use it
because it complains that the window is not opened by javascript
(window.open).

I looked over the function reference but I didn't find anything about
this problem.

TIA
Constantin Brinzoi

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Another question

2003-12-15 Thread Constantin Brinzoi
I destroy the session with:
session_destroy()

The file is deleted from the /tmp directory (which is good) but after
that I want to go on another page (public space) and get rid of
PHP_AUTH_USER and PHP_AUTH_PW.

How can I do it?

On Mon, 2003-12-15 at 16:10, Muhammed Mamedov wrote:
 Could you provide the code you use for destroying your session?
 
 Because if you destroy it session_unregister($session_name) then no need
 for browser closing.
 But if you don't destroy it, then it will be destroyed automatically after
 you close the browser.. this is how PHP works.
 
 Regards,
 Muhammed.
 
 
 - Original Message - 
 From: Constantin Brinzoi [EMAIL PROTECTED]
 To: Muhammed Mamedov [EMAIL PROTECTED]
 Sent: Monday, December 15, 2003 4:05 PM
 Subject: Re: [PHP-DB] Another question
 
 
  The reason is that I want to logout from the system.
  I destroyed the session but the session is still there!
  So I'm thinking of closing the window for good!
 
  Do you have any ideas how to make it work?
 
  Aurel.
 
  On Mon, 2003-12-15 at 15:25, Muhammed Mamedov wrote:
   Really?
   What is the reason for that?...
  
   Muhammed.
  
   - Original Message - 
   From: Duane Lakoduk [EMAIL PROTECTED]
   To: 'Constantin Brinzoi' [EMAIL PROTECTED]; [EMAIL PROTECTED]
   Sent: Monday, December 15, 2003 3:17 PM
   Subject: RE: [PHP-DB] Another question
  
  
   
You can avoid the prompt when using javascript to close the window if
 you
use this:
   
function closeit(){
window.opener = top;
window.close();
}
   
Now, window will close without prompting.
   
hth,
   
Duane
 -Original Message-
 From: Constantin Brinzoi [mailto:[EMAIL PROTECTED]
 Sent: Monday, December 15, 2003 6:15 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Another question


 Is there a php function that closes a browser window?

 I know there is a javascript function (window.close), but I
 can't use it
 because it complains that the window is not opened by javascript
 (window.open).

 I looked over the function reference but I didn't find anything
 about
 this problem.

 TIA
 Constantin Brinzoi


   
-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
   
  
  
   ---
   Outgoing mail is certified Virus Free.
   Checked by AVG anti-virus system (http://www.grisoft.com).
   Version: 6.0.545 / Virus Database: 339 - Release Date: 27.11.2003
 
 
 
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.545 / Virus Database: 339 - Release Date: 27.11.2003

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] SQL question

2003-12-11 Thread Constantin Brinzoi
I know it is  possible to search a database like this:

SELECT * FROM x_table WHERE name=%part_of_name%

but I don't know for sure the correct command.

Could you tell me the right syntax?

TIA
Aurel.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php