[PHP-DB] Select on Group

2015-11-16 Thread Karl DeSaulniers
Hello All, Hoping someone can help me with this query. I want to select some custom fields from my database that are part of a group of custom fields. There are several of these groups. I want to (in one sql statement) grab these fields, all of them and have them grouped in the results like so.

Re: [PHP-DB] Select from multiple tables

2012-03-01 Thread Kranthi Krishna
ny relations Kranthi. http://goo.gl/e6t3 On 1 March 2012 21:47, Carl Michael Skog wrote: > -- Vidarebefordrat meddelande -- > Från: Carl Michael Skog > Datum: 1 mars 2012 17:12 > Ämne: Re: [PHP-DB] Select from multiple tables > Till: Kranthi Krishna > &

Fwd: [PHP-DB] Select from multiple tables

2012-03-01 Thread Carl Michael Skog
-- Vidarebefordrat meddelande -- Från: Carl Michael Skog Datum: 1 mars 2012 17:12 Ämne: Re: [PHP-DB] Select from multiple tables Till: Kranthi Krishna It seems to me that you are mixing two semantically different things(board_entries and schooltypeentries, both related to

Re: [PHP-DB] Select from multiple tables

2012-02-29 Thread Karl DeSaulniers
This is just a stab in the dark and may be in the wrong order. If it does not work I apologize. SELECT s.Title, (SELECT DISTINCT b.Board_id), (SELECT DISTINCT t.type), (SELECT s.School_id AND b.School_id AND t.schoolid AS id ) FROM school s, board_entries b, schooltypeentries t WHERE id = 1

Re: [PHP-DB] Select from multiple tables

2012-02-29 Thread Kranthi Krishna
Hi all, SELECT DISTINCT s.Title, b.Board_id, t.type FROM school s, board_entries b, schooltypeentries t WHERE s.School_id = 1698 AND b.School_id = 1698 AND t.schoolid = 1698 this SQL query gives me Kendriya Vidyalaya 15 Kick Boxing Kendriya Vidyalaya 15 Karate Kendriya Vidyal

Re: [PHP-DB] Select from multiple tables

2012-02-29 Thread Karl DeSaulniers
Try DISTINCT On Feb 29, 2012, at 10:28 PM, Amit Tandon wrote: Dear Kranthi You have to be clear what you decide especially when you are getting multiple rows. To get just a single row you can use LIMIT clause. But it would return only one row. Now you have to decide which row. So i think y

Re: [PHP-DB] Select from multiple tables

2012-02-29 Thread Amit Tandon
Dear Kranthi You have to be clear what you decide especially when you are getting multiple rows. To get just a single row you can use LIMIT clause. But it would return only one row. Now you have to decide which row. So i think you decide on what you require and see how can you uniquely identify

Re: [PHP-DB] Select from multiple tables

2012-02-29 Thread Kranthi Krishna
Hi, The examples I saw were regarding cartesian join not inner join. I will read about inner joins. Also, the example i mentioned seems to be a mistake. Both school and type will not be similar at the same time Kranthi. http://goo.gl/e6t3 On 1 March 2012 09:26, Kranthi Krishna wrote: > Hi,

Re: [PHP-DB] Select from multiple tables

2012-02-29 Thread Kranthi Krishna
Hi, Thanks for the input. I have seen some tutorials on joins, they all suggest that MySql returns multiple rows For example -- School | Board 1 -- School | Board 1 - Now if I have another one-to-many relation -

Re: [PHP-DB] Select from multiple tables

2012-02-29 Thread Matijn Woudt
On Wed, Feb 29, 2012 at 3:01 PM, Kranthi Krishna wrote: > Hi all, > > Say I have an object like > > array >    schoolName => string >    board => array >         string >         string > > I generally create  two MySql tables > > schools: id PRIMARY KEY, SchoolName > boards: id FOREGIN KEY refers

[PHP-DB] Select from multiple tables

2012-02-29 Thread Kranthi Krishna
Hi all, Say I have an object like array schoolName => string board => array string string I generally create two MySql tables schools: id PRIMARY KEY, SchoolName boards: id FOREGIN KEY refers Table A(id), board and then do two selects. The problem is that, the number

Re: [PHP-DB] SELECT

2011-10-21 Thread tamouse mailing lists
On Fri, Oct 21, 2011 at 2:09 AM, Ford, Mike wrote: >> -Original Message- >> From: tamouse mailing lists [mailto:tamouse.li...@gmail.com] >> Sent: 20 October 2011 21:37 >> >> On Tue, Oct 18, 2011 at 5:36 AM, Ford, Mike >> wrote: >> >> -Original Message- >> >> From: Ron Piggott [mai

RE: [PHP-DB] SELECT

2011-10-21 Thread Ford, Mike
> -Original Message- > From: tamouse mailing lists [mailto:tamouse.li...@gmail.com] > Sent: 20 October 2011 21:37 > > On Tue, Oct 18, 2011 at 5:36 AM, Ford, Mike > wrote: > >> -Original Message- > >> From: Ron Piggott [mailto:ron.pigg...@actsministries.org] > >> Sent: 17 October 2

Re: [PHP-DB] SELECT

2011-10-20 Thread tamouse mailing lists
On Thu, Oct 20, 2011 at 3:36 PM, tamouse mailing lists wrote: > On Tue, Oct 18, 2011 at 5:36 AM, Ford, Mike wrote: >>> -Original Message- >>> From: Ron Piggott [mailto:ron.pigg...@actsministries.org] >>> Sent: 17 October 2011 18:38 >>> >>> I need help creating a mySQL query that will sele

Re: [PHP-DB] SELECT

2011-10-20 Thread tamouse mailing lists
On Tue, Oct 18, 2011 at 5:36 AM, Ford, Mike wrote: >> -Original Message- >> From: Ron Piggott [mailto:ron.pigg...@actsministries.org] >> Sent: 17 October 2011 18:38 >> >> I need help creating a mySQL query that will select the correct >> introduction message for a website I am making.  The

Re: [PHP-DB] SELECT

2011-10-18 Thread Jim Giner
Ron - Mike here is correct. I gave you a start, but it had a problem with it. Hope I didn't have you running around too much. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP-DB] SELECT

2011-10-18 Thread Ford, Mike
> -Original Message- > From: Ron Piggott [mailto:ron.pigg...@actsministries.org] > Sent: 17 October 2011 18:38 > > I need help creating a mySQL query that will select the correct > introduction message for a website I am making. The way I have > designed the table I can’t wrap my mind aro

Re: [PHP-DB] SELECT

2011-10-17 Thread Amit Tandon
Dear Ron If only day is required u could add another day condition in the where clause e.g. month(current_date) between and day(current_date) between. i think u require something more than this. So could u pls explain your requirement in a little more detail say what would be the output of the que

[PHP-DB] SELECT

2011-10-17 Thread Ron Piggott
I need help creating a mySQL query that will select the correct introduction message for a website I am making. The way I have designed the table I can’t wrap my mind around the SELECT query that will deal with the day # of the month. The part of the SELECT syntax I am struggling with is wh

Re: [PHP-DB] SELECT syntax

2011-10-13 Thread Karl DeSaulniers
Heh, Thanks Karthik. Not my post.. :) But your solution looks dead on.. Here you go Ron. Try this one. Best, Karl On Oct 13, 2011, at 2:42 AM, Karthik S wrote: Try this, select CASE answer when 1 then trivia_answer_1 when 2 then trivia_answer_2 when 3 then trivia_

Re: [PHP-DB] SELECT syntax

2011-10-13 Thread Karl DeSaulniers
Or something like this? SELECT * FROM `Bible_trivia` WHERE answer=`answer`; Then match the results to trivia_answer_1 in php to see if correct. if($trivia_answer_1 == $results) { ... do this } or a switch switch ($results) { case $trivia_answer_1: ... do this cas

Re: [PHP-DB] SELECT syntax

2011-10-12 Thread Amit Tandon
another example regds amit "The difference between fiction and reality? Fiction has to make sense." On Thu, Oct 13, 2011 at 9:34 AM, Amit Tandon wrote: > select > case

Re: [PHP-DB] SELECT syntax

2011-10-12 Thread Amit Tandon
select case works in mysql also regds amit "The difference between fiction and reality? Fiction has to make sense." On Thu, Oct 13, 2011 at 3:26 AM, Jack van Zanen wrote: > Hi > > In Oracle (and maybe others) you

Re: [PHP-DB] SELECT syntax

2011-10-12 Thread Jack van Zanen
Hi In Oracle (and maybe others) you can use select case when answer=1 then trivia_answer_1 when answer=2 then trivia_answer_2 when answer=3 then trivia_answer_3 when answer=4 then trivia_answer_4 else null end answer from bible_trivia_table OR You can select all of them and process in PHP, shou

RE: [PHP-DB] SELECT syntax

2011-10-12 Thread Toby Hart Dyke
.pigg...@actsministries.org] Sent: Wednesday, October 12, 2011 3:25 PM To: php-db@lists.php.net Subject: [PHP-DB] SELECT syntax In my Bible_Trivia table I have the columns `trivia_answer_1`, `trivia_answer_2`, `trivia_answer_3`, `trivia_answer_4`, `answer` `answer` is an integer always with a value of 1 to

[PHP-DB] SELECT syntax

2011-10-12 Thread Ron Piggott
In my Bible_Trivia table I have the columns `trivia_answer_1`, `trivia_answer_2`, `trivia_answer_3`, `trivia_answer_4`, `answer` `answer` is an integer always with a value of 1 to 4. Is there a way to use the value of `answer` to only select the correct trivia answer? This doesn’t work, but t

Re: [PHP-DB] SELECT online store discount %

2011-08-22 Thread Ron Piggott
011 5:45 AM To: Ron Piggott Cc: php-db@lists.php.net Subject: Re: [PHP-DB] SELECT online store discount % Ron Have u thought of CASE (in SELECT). Remebber their is some syntactical difference in "CASE" for SELECT and "CASE" in procedures regds amit "The diff

Re: [PHP-DB] SELECT online store discount %

2011-08-22 Thread Amit Tandon
Ron Have u thought of CASE (in SELECT). Remebber their is some syntactical difference in "CASE" for SELECT and "CASE" in procedures regds amit "The difference between fiction and reality? Fiction has to make sense."

[PHP-DB] SELECT online store discount %

2011-08-20 Thread Ron Piggott
I am trying to write a database query that determine the customer loyalty discount for an online store. I am wondering if there is a way of doing this as 1 query, instead of multiple and using PHP to do the math? - I want to offer a 10% discount if the person is a subscriber SELECT 10 AS disc

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

2011-03-09 Thread Daniel Brown
On Wed, Mar 9, 2011 at 17:49, Ron Piggott wrote: > > Is there a command in mySQL that would allow me to SELECT the rows where the > `fax` column is more than 11 characters long? There is. SELECT * FROM tblName WHERE CHAR_LENGTH(fax) >= 11; (Presuming you meant greater than or equal

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

2011-03-09 Thread kesavan trichy rengarajan
Have a look at this: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_char-length On Thu, Mar 10, 2011 at 9:49 AM, Ron Piggott wrote: > > 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 > > D

[PHP-DB] SELECT WHERE length of content question

2011-03-09 Thread Ron Piggott
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

Re: [PHP-DB] SELECT / ORDER BY

2010-09-13 Thread Richard Quadling
On 11 September 2010 07:47, Ron Piggott wrote: > > I wrote the query below to determine the 10 most popular words used: > > SELECT COUNT( `bible_concordance_usage`.`reference` ) AS word_usage, > `bible_concordance_words`.`reference` , `bible_concordance_words`.`word` > FROM `bible_concordance_usag

Re: [PHP-DB] SELECT / ORDER BY

2010-09-11 Thread Karl DeSaulniers
Hello, This may help. http://dev.mysql.com/doc/refman/5.0/en/order-by-optimization.html Best, Karl On Sep 11, 2010, at 1:47 AM, Ron Piggott wrote: I wrote the query below to determine the 10 most popular words used: SELECT COUNT( `bible_concordance_usage`.`reference` ) AS word_usage, `bible

[PHP-DB] SELECT / ORDER BY

2010-09-10 Thread Ron Piggott
I wrote the query below to determine the 10 most popular words used: SELECT COUNT( `bible_concordance_usage`.`reference` ) AS word_usage, `bible_concordance_words`.`reference` , `bible_concordance_words`.`word` FROM `bible_concordance_usage` INNER JOIN `bible_concordance_words` ON `bible_concorda

Re: [PHP-DB] Select the specific user data from the database

2010-09-05 Thread Phpster
I would suggest that you keep authorization separate from data access Bastien Sent from my iPod On Sep 5, 2010, at 9:19, nagendra prasad wrote: > PS: Want to check the username from a table and the password from another > table. > > Is it possible ?? > > -- PHP Database Mailing List (http

Re: [PHP-DB] Select the specific user data from the database

2010-09-05 Thread nagendra prasad
PS: Want to check the username from a table and the password from another table. Is it possible ??

Re: [PHP-DB] Select the specific user data from the database

2010-09-05 Thread Phpster
Then each record needs to have a user filed where their is stored. Then your access query just adds an additional filter to check this value Select * from data_table where user = $user Bastien Sent from my iPod On Sep 5, 2010, at 7:21, nagendra prasad wrote: > Hi Experts, > > I have a mysql

[PHP-DB] Select the specific user data from the database

2010-09-05 Thread nagendra prasad
Hi Experts, I have a mysql database. What I want is that when a user login he can able to see his entries only, so that he can delete, add or edit his entries only. I have 2 different tables one for user details and another for actual entries. Please help me. Best, Guru.

Re: [PHP-DB] SELECT with ' in search term

2010-08-12 Thread Chris
On 13/08/10 13:26, Ron Piggott wrote: If the variable $segment has an ' in it the $query won't work because of having 3 ' 's. Should I be using: $segment = mysql_real_escape_string($segment); before querying the database? Use it in your query. Don't use it anywhere else. Your code may use it

[PHP-DB] SELECT with ' in search term

2010-08-12 Thread Ron Piggott
If the variable $segment has an ' in it the $query won't work because of having 3 ' 's. Should I be using: $segment = mysql_real_escape_string($segment); before querying the database? $query="SELECT `reference` FROM `bible_concordance_words` WHERE `word` = '$segment' LIMIT 1"; Please note: $s

Re: [PHP-DB] SELECT LIKE with "%" and without "%"

2010-02-24 Thread Ahmet Caner
"Eleonora De Marinis" , haber iletisinde sunlari yazdi:49fe92d0.2060...@garr.it... > $sql = "SELECT * FROM table WHERE ID ='$_GET[id]' AND title LIKE > '%$_GET[word]%'"; > > > > Original Message > Subject: [PH

Re: [PHP-DB] SELECT LIKE with "%" and without "%"

2009-05-04 Thread Philip Thompson
On May 2, 2009, at 6:43 PM, Emiliano Boragina wrote: Hello. I am using this: $sql = "SELECT * FROM table WHERE ID LIKE '%$_GET[id]%' AND title LIKE '%$_GET[word]%'"; But I want exactlu ID, not one part of many possibles Ids in the DB. How can I do that? PLEASE tell me your cleaning that inpu

Re: [PHP-DB] SELECT LIKE with "%" and without "%"

2009-05-04 Thread Eleonora De Marinis
$sql = "SELECT * FROM table WHERE ID ='$_GET[id]' AND title LIKE '%$_GET[word]%'"; Original Message ---- Subject: [PHP-DB] SELECT LIKE with "%'" and without "%'" From: Emiliano Boragina To: php-db@lists.php.net Date:

Re: [PHP-DB] SELECT LIKE with "%" and without "%"

2009-05-02 Thread mrfroasty
Emiliano Boragina wrote: > Hello. > > I am using this: > $sql = "SELECT * FROM table WHERE ID LIKE '%$_GET[id]%' AND title LIKE > '%$_GET[word]%'"; > This doesnt work? $sql = "SELECT * FROM table WHERE ID='some_id' AND title='some_title'; -- Extra details: OSS:Gentoo Linux profile:x86 Hardw

[PHP-DB] SELECT LIKE with "%" and without "%"

2009-05-02 Thread Emiliano Boragina
Hello. I am using this: $sql = "SELECT * FROM table WHERE ID LIKE '%$_GET[id]%' AND title LIKE '%$_GET[word]%'"; But I want exactlu ID, not one part of many possibles Ids in the DB. How can I do that? Thanks +      _    // Emil

[PHP-DB] SELECT query

2008-12-21 Thread Ron Piggott
I am working on a web based Bible searching query. So far I am able to generate: SELECT * FROM `bible_verses` INNER JOIN `bible_books` ON `bible_books`.`id` = `bible_verses`.`b` WHERE `t` IN ( 'Lord' , 'Jesus' ) LIMIT 0 , 10 Is an "IN" the correct syntax to use? I am trying to take what the use

[PHP-DB] SELECT FOR UPDATE

2008-06-02 Thread Philip Thompson
Hi all. Which is more efficient in order to use SELECT FOR UPDATE? %> SELECT * FROM `table` WHERE (`table_id` = 32) LIMIT 1 FOR UPDATE; %> UPDATE `table` SET `field_name` = 'Pizza' WHERE (`table_id` = 32) LIMIT 1; OR %> SELECT `field_name` FROM `table` WHERE (`table_id` = 32) LIMIT 1 FOR

Re: [PHP-DB] Select query with Forein key Relation

2008-04-23 Thread Evert Lammerts
of columns do i need to do following in php /while ($row = mysql_fetch_array($result)) {/ /$sub= $row[venue].[vname];/ /}/ Regards - Original Message From: Evert Lammerts <[EMAIL PROTECTED]> To: Nasreen Laghari <[EMAIL PROTECTED]> Cc: php-db@lists.php.net Sent

Re: [PHP-DB] Select query with Forein key Relation

2008-04-23 Thread Evert Lammerts
SELECT * FROM gig LEFT JOIN genre ON gig.genreId = genre.genreId LEFT JOIN venue ON gig.venueID = venue.vid WHERE gig.gigid = $gigdetail I'd replace the dash with [table].[columnames]. Also, you're using four different naming conventions in your columns - gigid, genreId, venueID and vid. If I w

[PHP-DB] Select query with Forein key Relation

2008-04-23 Thread Nasreen Laghari
Hi, I have a table which contains 2 foreign key relation columns. I'm trying to get all columns from main table as well as all column from those 2 foreign key relation tables. The query i'm using is : select * from gig where gig.gigid = $gigDetail LEFT JOIN genre ON gig.genreId=genre.genr

Re: [PHP-DB] SELECT query from two tables

2008-03-09 Thread Ron Piggott
Thanks On Mon, 2008-03-10 at 12:56 +1300, Bruce Cowin wrote: > I think what you mean to do is use IN(). And I would suggest table aliases. > So it could look like this: > > SELECT * FROM ministry_directory md INNER JOIN > ministry_directory_listing_categories mdlc ON md.entry = > mdlc.minist

Re: [PHP-DB] SELECT query from two tables

2008-03-09 Thread Bruce Cowin
I think what you mean to do is use IN(). And I would suggest table aliases. So it could look like this: SELECT * FROM ministry_directory md INNER JOIN ministry_directory_listing_categories mdlc ON md.entry = mdlc.ministry_directory_entry WHERE md.listing_type = 2 AND mdlc.ministry_directory_

Re: [PHP-DB] SELECT query from two tables

2008-03-09 Thread Chris
Ron Piggott wrote: Two different rows Chris. That's the problem then. Your query is saying "get records with category_reference of 10 and it has to have category_reference of 11 as well". No such rows exist. Maybe that should be an 'or' or 'in' (same thing). ... ministry_directory_listi

Re: [PHP-DB] SELECT query from two tables

2008-03-09 Thread Ron Piggott
Two different rows Chris. reference ministry_directory_entry ministry_directory_category_reference 13 1 10 14 1 11 What I am trying to do is allow the user to make a more specific search. Ron On Mon, 2008-03-10 at 10:37 +1100, Chris wrote: > > > ministry_directory_list

Re: [PHP-DB] SELECT query from two tables

2008-03-09 Thread Chris
ministry_directory_listing_categories.ministry_directory_category_reference = 10 AND > ministry_directory_listing_categories.ministry_directory_category_reference = 11 Can a record really have a reference for two different id's like this? ie can it be both '10' and '11' at the same time?

[PHP-DB] SELECT query from two tables

2008-03-09 Thread Ron Piggott
I am wondering what is wrong with this syntax? SELECT * FROM ministry_directory INNER JOIN ministry_directory_listing_categories ON ministry_directory.entry = ministry_directory_listing_categories.ministry_directory_entry WHERE ministry_directory.listing_type = 2 AND ministry_directory_listing_c

Re: [PHP-DB] SELECT query with multiple "WHERE" Clause

2008-02-27 Thread TG
l Message - From: Nasreen Laghari <[EMAIL PROTECTED]> To: php-db@lists.php.net Date: Wed, 27 Feb 2008 15:44:23 -0800 (PST) Subject: [PHP-DB] SELECT query with multiple "WHERE" Clause > Hi All, > > Thank you for increasing my knowledge about PHP/MYSQL. > > I am creati

Re: [PHP-DB] SELECT query with multiple "WHERE" Clause

2008-02-27 Thread Stephen Johnson
the struggle against bad code http://www.fortheloveofgeeks.com I¹m a geek and I¹m OK! -- > From: Nasreen Laghari <[EMAIL PROTECTED]> > Date: Wed, 27 Feb 2008 15:44:23 -0800 (PST) > To: > Subject: [PHP-DB] SELECT query with multiple "WHERE" Clause > > >

Re: [PHP-DB] SELECT query with multiple "WHERE" Clause

2008-02-27 Thread Stut
On 27 Feb 2008, at 23:44, Nasreen Laghari wrote: Thank you for increasing my knowledge about PHP/MYSQL. The question you ask below is basic SQL syntax. Please read the MySQL manual before asking here - answers at this level are all in there. http://mysql.com/doc Oh, and once you have it wo

Re: [PHP-DB] SELECT query with multiple "WHERE" Clause

2008-02-27 Thread Daniel Brown
On Wed, Feb 27, 2008 at 6:44 PM, Nasreen Laghari <[EMAIL PROTECTED]> wrote: > I am creating a SEARCH, by only using one table. The search form is same as > Inserting item (search has form of all fields in table ), difference is > SEARCH page doesnt have validation . Therefore user can enter inf

Re: [PHP-DB] SELECT query with multiple "WHERE" Clause

2008-02-27 Thread Chris
Greg Bowser wrote: In MySQL, both "OR" and "||" are valid logical or operators. You can only have one Where clause, thus your last example is correct. Though in postgresql and db2 (and some other dbs) "||" means "concatenate" so stick with using the word "OR" in this situation otherwise you'

Re: [PHP-DB] SELECT query with multiple "WHERE" Clause

2008-02-27 Thread Greg Bowser
In MySQL, both "OR" and "||" are valid logical or operators. You can only have one Where clause, thus your last example is correct. --GREG On Wed, Feb 27, 2008 at 6:44 PM, Nasreen Laghari <[EMAIL PROTECTED]> wrote: > Hi All, > > Thank you for increasing my knowledge about PHP/MYSQL. > > I am cr

Re: [PHP-DB] SELECT query with multiple "WHERE" Clause

2008-02-27 Thread Chris
$query = mysql_query("SELECT * from gig WHERE gigName='$gig_name' OR WHERE gig_fdate='$sdate'"); This one. I'd suggest you get a book to help you with the basics, something like this should do (first hit in amazon, haven't actually read this particular book): http://www.amazon.com/Learni

[PHP-DB] SELECT query with multiple "WHERE" Clause

2008-02-27 Thread Nasreen Laghari
Hi All, Thank you for increasing my knowledge about PHP/MYSQL. I am creating a SEARCH, by only using one table. The search form is same as Inserting item (search has form of all fields in table ), difference is SEARCH page doesnt have validation . Therefore user can enter information in any of

Re: [PHP-DB] Select...

2008-01-15 Thread OKi98
Original Message Subject: [PHP-DB] Select... From: Miguel Guirao <[EMAIL PROTECTED]> To: php-db@lists.php.net Date: 15.1.2008 4:44 Hello List, I'm having kind of trouble to get done this: Select data from a table, except those data already in a second table. Ac

Re: [PHP-DB] Select...

2008-01-15 Thread Niel Archer
Hi First off, please create your own thread, do not reply to someone else's and change the subject. > I'm having kind of trouble to get done this: Select data from a table, > except those data already in a second table. Actually, if there is a rowid > in table2, I wont get it from table1, rowid

[PHP-DB] Select...

2008-01-14 Thread Miguel Guirao
Hello List, I'm having kind of trouble to get done this: Select data from a table, except those data already in a second table. Actually, if there is a rowid in table2, I wont get it from table1, rowid is the key that relates both tables. I just can't express this with a SQL statement!! idequipo

Re: [PHP-DB] ? "SELECT TABLE" Command

2007-09-10 Thread Mike W.
Chris wrote (in news:[EMAIL PROTECTED]): > > It is an SQL query (probably MySQL, but perhaps SQLite or possibly even PGSQL or mSQL): > > The line after $query should tell you what uses it ;) Sorry, I meant the book may have been about any of those; I was skimming through a bunch of SQL books at t

Re: [PHP-DB] ? "SELECT TABLE" Command

2007-09-10 Thread Chris
Please fix your reply-to address. It is an SQL query (probably MySQL, but perhaps SQLite or possibly even PGSQL or mSQL): The line after $query should tell you what uses it ;) $query="SELECT TABLE $tablename;"; if (mysql_query($query, $link)) { echo($indent."The table, '$tablen

[PHP-DB] ? "SELECT TABLE" Command

2007-09-10 Thread Alec S.
Hi, I've got a PHP program I wrote a year or so ago with the oddest line of code. I know I didn't come up with it myself; I must have adapted it from a book or something, but I have checked all the books it could have come from and could not find it in any of them, nor can I find any such command

RE: [PHP-DB] SELECT string

2007-04-24 Thread Dwight Altman
-4); }else{ $sql .= "1"; } echo "SQL:$sql"; ?> It was getting a tad complicated with the "Could Include" using "OR" and testing for the end of the existing $sql string, but the "Could Include"'s just need to be omitted from the SQ

Re: [PHP-DB] SELECT string

2007-04-23 Thread bedul
cmiiw.. since i don't the visual what u said bellow - Original Message - From: "Ron Piggott" <[EMAIL PROTECTED]> To: "PHP DB" Sent: Tuesday, April 24, 2007 11:31 AM Subject: [PHP-DB] SELECT string > > I am looking for help to write a SELECT sy

[PHP-DB] SELECT string

2007-04-23 Thread Ron Piggott
I am looking for help to write a SELECT syntax to help me process a directory searching query tool I am developing. If you start at http://www.actsministrieschristianevangelism.org/ministrydirectory/ and under 'Step 1:' click Business a form is displayed. My question is how would you generat

Re: [PHP-DB] SELECT date query

2006-10-08 Thread Bastien Koert
i tend to take the approach of $next_wed = date("Y-m-d", strtotime("next wednesday")); Bastien From: Niel Archer <[EMAIL PROTECTED]> Reply-To: php-db@lists.php.net To: php-db@lists.php.net Subject: Re: [PHP-DB] SELECT date query Date: Sat, 07 Oct 2006 05:49:36 +0

Re: [PHP-DB] SELECT date query

2006-10-07 Thread Niel Archer
Hi > You can make this easier with date('w'). Doh, that'll teach me to code at 5 am. I knew there was a better way, but couldn't think of it, the sound of my bed calling was too distracting. Niel -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsu

Re: [PHP-DB] SELECT date query

2006-10-07 Thread Hodicska Gergely
Hi! You can make this easier with date('w'). $correction = array(3, 2, 1, 7, 6, 5, 4); list($year, $month, $day, $dayOfWeek) = explode('|', date('Y|m|d|w')); echo date ("Y.m.d", mktime (0,0,0,$month,$day+$correction[$dayOfWeek],$year)); Regards, Felhő Niel Archer wrote: Hi Ron I've ma

Re: [PHP-DB] SELECT date query

2006-10-06 Thread Niel Archer
Hi Ron I've made the assumption that if today is Wednesday, you still want next Wednesday. Try this: $offset = array(3,2,1,7,6,5,4); $date = explode("-", date("Y-n-j")); $ToDay = DayOfWeek($date[0], $date[1], $date[2]); $NextWed = date("Y-n-j", time() + ($offset[$ToDay] * 24 * 60 * 60)); // Retu

[PHP-DB] SELECT date query

2006-10-06 Thread Ron Piggott (PHP)
I am wondering if someone would help me write a SELECT date query ... Weekly mailings go out every Wednesday. I am setting up an administration function and table to store the mailing name, PDF to be contained within the mailing and the date for it to be used. The SELECT query I want to create i

RE: [PHP-DB] Select distinct field won't return distinct value

2006-06-08 Thread tg-php
have the link) on who to create a cross table query which is what you are looking for Bastien >From: "Blanton, Bob" <[EMAIL PROTECTED]> >To: ><[EMAIL PROTECTED]>,,<[EMAIL PROTECTED]> >Subject: RE: [PHP-DB] Select distinct field won't return distinct v

RE: [PHP-DB] Select distinct field won't return distinct value

2006-06-07 Thread Bastien Koert
000929062 2341 001139768 2207 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 06, 2006 7:48 PM To: php-db@lists.php.net Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Select distinct field won't return distinct value Correct me if

Re: [PHP-DB] Select distinct field won't return distinct value

2006-06-07 Thread Martin Alterisio
the subquery is the only way to go. -Original Message- From: Chris [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 07, 2006 8:50 AM To: Blanton, Bob Cc: php-db@lists.php.net Subject: Re: [PHP-DB] Select distinct field won't return distinct value Blanton, Bob wrote: > I'm just

RE: [PHP-DB] Select distinct field won't return distinct value

2006-06-06 Thread Blanton, Bob
: php-db@lists.php.net Subject: Re: [PHP-DB] Select distinct field won't return distinct value Blanton, Bob wrote: > I'm just learning MySQL so don't know all the syntax. There is a "LIST" > function in Sybase Adaptive Server Anywhere which would do that. Is >

Re: [PHP-DB] Select distinct field won't return distinct value

2006-06-06 Thread Chris
Blanton, Bob wrote: I'm just learning MySQL so don't know all the syntax. There is a "LIST" function in Sybase Adaptive Server Anywhere which would do that. Is there an equivalent function in MySQL? Query: SELECT distinct niin, list(serial_number) FROM fmds.maintenance_equipment group by niin

RE: [PHP-DB] Select distinct field won't return distinct value

2006-06-06 Thread Blanton, Bob
, June 06, 2006 7:48 PM To: php-db@lists.php.net Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Select distinct field won't return distinct value Correct me if I'm wrong, but it sounds like you have something like this: 123 Joe 124 Joe 125 Sue 126 John 127 Joe 128 Frank 129 Sue An

Re: [PHP-DB] Select distinct field won't return distinct value

2006-06-06 Thread Mohamed Yusuf
I thank you all. problem solved using two queries as TQ mentioned. On 6/6/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Correct me if I'm wrong, but it sounds like you have something like this: 123 Joe 124 Joe 125 Sue 126 John 127 Joe 128 Frank 129 Sue And you want to output somethi

Re: [PHP-DB] Select distinct field won't return distinct value

2006-06-06 Thread tg-php
Correct me if I'm wrong, but it sounds like you have something like this: 123 Joe 124 Joe 125 Sue 126 John 127 Joe 128 Frank 129 Sue And you want to output something like: Joe 123, 124, 127 Sue 125, 129 John 126 Frank 128 But what you're getting is: Joe 123 Joe 124 ..etc You have two

Re: [PHP-DB] Select distinct field won't return distinct value

2006-06-06 Thread Brad Bonkoski
Perhaps you should fix your data model... but with your current set up, try: select cus_name, cus_id from customers group by cus_name order by cus_name asc -Brad Mohamed Yusuf wrote: I want select distinct field and return value of that field, but I have problem which is: select distinct re

[PHP-DB] Select distinct field won't return distinct value

2006-06-06 Thread Mohamed Yusuf
I want select distinct field and return value of that field, but I have problem which is: select distinct returns duplicate value. eg, I wan select distinct customer name and id from the customer table. one customer may have different cus_ids since cus_ids are auto increment and depend on the purc

RE: [PHP-DB] SELECT

2006-01-20 Thread Bastien Koert
Convert both to unix timestamps...be much easier to wrok with both date and time then bastien From: "Ron Piggott (PHP)" <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] To: PHP DB Subject: [PHP-DB] SELECT Date: Fri, 20 Jan 2006 06:00:33 -0500 Yesterday I asked how to get th

Re: [PHP-DB] SELECT

2006-01-20 Thread Adrian Bruce
Possibility? WHERE (`date_created` = '$date_90_minutes_ago' AND `time_created` <= '$time_90_minutes_ago') or (`date_created` < '$date_90_minutes_ago' AND `time_created` > '01:30:00') Ade Ron Piggott (PHP) wrote: Yesterday I asked how to get the date & time 90 minutes ago and I received se

[PHP-DB] SELECT

2006-01-20 Thread Ron Piggott (PHP)
Yesterday I asked how to get the date & time 90 minutes ago and I received several responses. Thanks. I don't think this select statement is working "correctly". (Correctly being what I am intending it to do) I took a look at the table this morning. One record remains that was created 2006-01-

[PHP-DB] Select found_rows problem...

2006-01-20 Thread Yemi Obembe
Using the select calc_found rows code (i.e select sql_calc_found_rows * from table where ... limit 0, 10) to get the found fesult irrespective of the limit clause...then using $count = mysql_query("select found_rows()"); with the hope of getting the returened result but got this instead: Resource i

Re: [PHP-DB] SELECT

2005-12-10 Thread Julien Bonastre
oOo---oOo-- - Original Message - From: "Ron Piggott (PHP)" <[EMAIL PROTECTED]> To: "PHP DB" Sent: Sunday, December 11, 2005 11:04 AM Subject: [PHP-DB] SELECT I am trying to put together a SELECT syntax. I am querying a response database and I only

Re: [PHP-DB] SELECT

2005-12-10 Thread Julien Bonastre
oOo-- - Original Message - From: "Philip Hallstrom" <[EMAIL PROTECTED]> To: "Ron Piggott (PHP)" <[EMAIL PROTECTED]> Cc: "PHP DB" Sent: Sunday, December 11, 2005 11:20 AM Subject: Re: [PHP-DB] SELECT I am trying to put together a SELECT synt

Re: [PHP-DB] SELECT

2005-12-10 Thread Philip Hallstrom
I am trying to put together a SELECT syntax. I am querying a response database and I only want to obtain each user's name once even if they have given more than 1 response. $query="SELECT * FROM conversation_table WHERE conversation_reference = $conversation_currently_displayed"; $response_cre

[PHP-DB] SELECT

2005-12-10 Thread Ron Piggott (PHP)
I am trying to put together a SELECT syntax. I am querying a response database and I only want to obtain each user's name once even if they have given more than 1 response. $query="SELECT * FROM conversation_table WHERE conversation_reference = $conversation_currently_displayed"; $response_cr

Re: [PHP-DB] SELECT & html

2005-12-05 Thread Amol Hatwar
On Sun, 2005-12-04 at 13:38 -0500, Ron Piggott (PHP) wrote: > I have two questions. > > I would like to display the contents of my table with the first row > being grey in background and the next row being white and the third row > being grey, fourth being white, etc. I am not sure how to do th

RE: [PHP-DB] SELECT & html

2005-12-04 Thread Robbert van Andel
ot;\n"; } As for the limiting of rows, you would use the limit statement (assuming you're using a DBMS that supports it). Hopefully this helps, Robbert van Andel -Original Message- From: Ron Piggott (PHP) [mailto:[EMAIL PROTECTED] Sent: Sunday, December 04, 2005 10:39 AM To

[PHP-DB] SELECT & html

2005-12-04 Thread Ron Piggott (PHP)
I have two questions. I would like to display the contents of my table with the first row being grey in background and the next row being white and the third row being grey, fourth being white, etc. I am not sure how to do this. Secondly I only want the first 20 records to be displayed at a ti

  1   2   3   4   >