Fwd: [PHP-DB] Select from multiple tables

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

Re: [PHP-DB] Select from multiple tables

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

[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 from multiple tables

2012-02-29 Thread Matijn Woudt
On Wed, Feb 29, 2012 at 3:01 PM, Kranthi Krishna kranthi...@gmail.com 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

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 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

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

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

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

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 =

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 m.f...@leedsmet.ac.uk wrote: -Original Message- From: Ron Piggott [mailto:ron.pigg...@actsministries.org] Sent: 17

Re: [PHP-DB] SELECT

2011-10-21 Thread tamouse mailing lists
On Fri, Oct 21, 2011 at 2:09 AM, Ford, Mike m.f...@leedsmet.ac.uk 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 m.f...@leedsmet.ac.uk wrote: -Original Message-

Re: [PHP-DB] SELECT

2011-10-20 Thread tamouse mailing lists
On Tue, Oct 18, 2011 at 5:36 AM, Ford, Mike m.f...@leedsmet.ac.uk 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

Re: [PHP-DB] SELECT

2011-10-20 Thread tamouse mailing lists
On Thu, Oct 20, 2011 at 3:36 PM, tamouse mailing lists tamouse.li...@gmail.com wrote: On Tue, Oct 18, 2011 at 5:36 AM, Ford, Mike m.f...@leedsmet.ac.uk wrote: -Original Message- From: Ron Piggott [mailto:ron.pigg...@actsministries.org] Sent: 17 October 2011 18:38 I need help creating

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 around

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

[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

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

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

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

[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

RE: [PHP-DB] SELECT syntax

2011-10-12 Thread Toby Hart Dyke
...@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 4

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,

Re: [PHP-DB] SELECT syntax

2011-10-12 Thread Amit Tandon
select casehttp://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html 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 j...@vanzanen.com wrote: Hi In Oracle (and maybe

Re: [PHP-DB] SELECT syntax

2011-10-12 Thread Amit Tandon
another examplehttp://mysql-tips.blogspot.com/2005/04/mysql-select-case-example.html regds amit The difference between fiction and reality? Fiction has to make sense. On Thu, Oct 13, 2011 at 9:34 AM, Amit Tandon att...@gmail.com wrote: select

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

2011-08-22 Thread Amit Tandon
Ron Have u thought of CASE (in SELECT)http://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html. 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. On

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

2011-08-22 Thread Ron Piggott
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 difference between fiction and reality? Fiction has to make sense. On Sun, Aug 21

[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

[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 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 ron.pigg...@actsministries.org wrote: Is there a command in mySQL that would allow me to SELECT the rows where the `fax` column is more than 11

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 ron.pigg...@actsministries.org 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

Re: [PHP-DB] SELECT / ORDER BY

2010-09-13 Thread Richard Quadling
On 11 September 2010 07:47, Ron Piggott ron.pigg...@actsministries.org 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`

[PHP-DB] SELECT / ORDER BY

2010-09-11 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

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,

[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 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 nagendra802...@gmail.com wrote: Hi

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
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 nagendra802...@gmail.com wrote: PS: Want to check the username from a table and the password from another table. Is it possible ?? -- PHP Database

[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:

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

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

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

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 emiliano.borag...@gmail.com To: php-db@lists.php.net Date: 05/03/2009 01:43 AM Hello. I am using

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

[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 +      _    //

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 Hardware:msi

[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 user

[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

[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

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

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

2008-04-23 Thread Evert Lammerts
($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: Wednesday, April 23, 2008 11:48:39 AM Subject: Re: [PHP-DB] Select query with Forein key Relation

[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

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?

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:

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). ...

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

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 =

[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

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):

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 creating a

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'll run

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

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

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

2008-02-27 Thread Stephen Johnson
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: php-db@lists.php.net Subject: [PHP-DB] SELECT query with multiple WHERE Clause $query = mysql_query(SELECT * from gig WHERE gigName

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

2008-02-27 Thread TG
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 creating a SEARCH, by only using one table. The search form is same as Inserting item

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 is

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. Actually

[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!!

[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

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,

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 that

RE: [PHP-DB] SELECT string

2007-04-24 Thread Dwight Altman
to be omitted from the SQL query altogether. Regards, Dwight God Bless! -Original Message- From: Ron Piggott [mailto:[EMAIL PROTECTED] Sent: Monday, April 23, 2007 11:31 PM To: PHP DB Subject: [PHP-DB] SELECT string I am looking for help to write a SELECT syntax to help me process

[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

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 php-db@lists.php.net Sent: Tuesday, April 24, 2007 11:31 AM Subject: [PHP-DB] SELECT string I am looking for help to write a SELECT syntax to help me process

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 +0100 Hi Ron I've made

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

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:

[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

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)); // Returns a

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

2006-06-07 Thread Martin Alterisio
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 learning MySQL so don't know all

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

2006-06-07 Thread Bastien Koert
: RE: [PHP-DB] Select distinct field won't return distinct value Date: Tue, 6 Jun 2006 23:44:22 -0400 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

[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

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 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

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

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

2006-06-06 Thread Blanton, Bob
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 And you want to output something

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
-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 there an equivalent function in MySQL? Query

[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 id

[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-19

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

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 php-db@lists.php.net Subject: [PHP-DB] SELECT Date: Fri, 20 Jan 2006 06:00:33 -0500 Yesterday I asked how to get

[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;

Re: [PHP-DB] SELECT html table

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 this.

[PHP-DB] SELECT html table

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

RE: [PHP-DB] SELECT html table

2005-12-04 Thread Robbert van Andel
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 Subject: [PHP-DB] SELECT html table I have two questions

Re: [PHP-DB] SELECT Performance and INDEXing

2005-08-18 Thread Dwight Altman
- From: Dwight Altman [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Wednesday, August 10, 2005 4:23 PM Subject: [PHP-DB] SELECT Performance and INDEXing I have a MyISAM table holding images with field types bigint(20), mediumblob, varchar(255), blob and tinyint(3). The table has grown

Re: [PHP-DB] SELECT Performance and INDEXing

2005-08-18 Thread Micah Stevens
[EMAIL PROTECTED] To: php-db@lists.php.net Sent: Wednesday, August 10, 2005 4:23 PM Subject: [PHP-DB] SELECT Performance and INDEXing I have a MyISAM table holding images with field types bigint(20), mediumblob, varchar(255), blob and tinyint(3). The table has grown to over 800 MB

Re: [PHP-DB] SELECT Performance and INDEXing

2005-08-18 Thread Dwight Altman
[EMAIL PROTECTED] To: php-db@lists.php.net Sent: Thursday, August 18, 2005 9:49 AM Subject: Re: [PHP-DB] SELECT Performance and INDEXing I think no one answered it because it doesn't make a whole lot of sense. Breaking a condition out into a second SQL statement would force the DB to rescan

Re: [PHP-DB] SELECT Performance and INDEXing

2005-08-18 Thread Micah Stevens
Subject: Re: [PHP-DB] SELECT Performance and INDEXing I think no one answered it because it doesn't make a whole lot of sense. Breaking a condition out into a second SQL statement would force the DB to rescan the table, so it should take longer rather than shorter. There's nothing suggesting

Re: [PHP-DB] SELECT Performance and INDEXing

2005-08-18 Thread Dwight Altman
type of composite index on (field2, field3) would be better. Then again, any combination with field1 would also be unique. - Original Message - From: Micah Stevens [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Thursday, August 18, 2005 12:33 PM Subject: Re: [PHP-DB] SELECT

  1   2   3   4   >