Re: [PHP-DB] Query syntax

2007-09-15 Thread TG
ype LIKE '%$listing_type%' AND listing_approved IN ('1', '2') ORDER BY name ASC Good luck! -TG - Original Message - From: "ron.php" <[EMAIL PROTECTED]> To: php-db@lists.php.net Date: Sat, 15 Sep 2007 15:04:59 -0400 Subject: [PHP-DB] Query syntax

Re: [PHP-DB] Delete one table and move data to another table

2007-09-26 Thread TG
r condition is the same in both statements, reducing potential errors. This is just a quick and dirty example, not adhering to any real design scheme. My normal code is a bit prettier than this, but you get the idea. -TG - Original Message - From: "endro mei a." <[EMAIL PROTECT

Re: [PHP-DB] Re: mysql statement [SOLVED]

2007-09-26 Thread TG
e or not though. You'd have to do some tests. Also, comparisons like "=" should (if I recall) be faster than LIKE comparisons. So if you really meant to use "=", do that instead. Let me know if any of that's unclear. I know I get some kooky ideas sometimes. Also, an

Re: [PHP-DB] Updating 2 Databases from a single form

2007-09-27 Thread TG
1); $result2 = mysql_query($somequery, $conn2); Something like that. -TG - Original Message - From: "Derek" <[EMAIL PROTECTED]> To: php-db@lists.php.net Date: Thu, 27 Sep 2007 16:42:10 -0500 Subject: [PHP-DB] Updating 2 Databases from a single form > Hello, > >

Re: [PHP-DB] newbie help

2007-09-28 Thread TG
custD 3 Then it's just a matter of drilling down, collecting a list of ID's for that customer and the sub-customers. Lotsof ways to tackle this problem. -TG - Original Message - From: nhadie <[EMAIL PROTECTED]> To: php-db@lists.php.net Date: Fri, 28

Re: [PHP-DB] newbie help

2007-09-28 Thread TG
for a customer doesn't use characters that are bad for table names. What kind of data are you thinking about storing for your customers and your customer's customers? And what other data do you need to store for whatever your webapp does? -TG - Original Message - From: nha

Re: [PHP-DB] newbie help

2007-09-28 Thread TG
ibly wrong and give a better solution, please enlighten. Always willing to learn new things if they are, indeed, better. -TG - Original Message - From: "Bob Chatman" <[EMAIL PROTECTED]> To: TG <[EMAIL PROTECTED]> Cc: nhadie <[EMAIL PROTECTED]>, php-db@li

[PHP-DB] Re: [PHP] the opposite of a join?

2007-10-03 Thread TG
risons with NULL), you have to use "WHERE DepartmentID IS NULL". -TG - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>, Date: Wed, 3 Oct 2007 05:21:06 -0500 Subject: [PHP] the opposite of a join? > I have a company table and a contacts t

Re: [PHP-DB] Prevention for multiple submissions from the same form

2007-10-04 Thread TG
The most common method I've seen is with Javascript. onsubmit, disable submit button. As a backup, in case the user's JS is disabled, you might consider the unique ID thing. -TG - Original Message - From: "T K" <[EMAIL PROTECTED]> To: php-db@lists.php.ne

Re: [PHP-DB] Prevention for multiple submissions from the same form

2007-10-05 Thread TG
see, there is some kind of case for allowing non-unique input into the database, depending on the circumstances. -TG - Original Message - From: OKi98 <[EMAIL PROTECTED]> To: T K <[EMAIL PROTECTED]> Cc: php-db@lists.php.net Date: Fri, 05 Oct 2007 10:34:50 +0200 Subject: R

RE: [PHP-DB] inner join

2007-10-21 Thread TG
Along with the formal inner join syntax Bastien pointed out, isn't doing "WHERE t1.id = t2.id AND t2.id = t3.id" the same thing? select [table.field] from table1 t1, table2 t2, table3 t3 where t1.some_field = t2.some_field and t1.some_field = t3.some_field -TG - O

RE: [PHP-DB] UPDATE syntax

2007-12-13 Thread TG
-you-wanna-call-them are used to be explicit with a name. -TG - Original Message - From: "Gary Wardell" <[EMAIL PROTECTED]> To: Date: Thu, 13 Dec 2007 19:33:57 -0500 Subject: RE: [PHP-DB] UPDATE syntax > Hi, > > I'm a beginner at PHP and MySql but a long

Re: [PHP-DB] Download google spreadsheet

2007-12-26 Thread TG
You might check the google documents api: http://code.google.com/apis/documents/overview.html -TG - Original Message - From: ioannes <[EMAIL PROTECTED]> To: php-db@lists.php.net Date: Wed, 26 Dec 2007 23:59:12 + Subject: [PHP-DB] Download google spreadsheet > I would li

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

2008-02-27 Thread TG
bout any PHP issues too. Assuming your MySQL server is on another server, if you have a Windows machine you can use a program like WinSQL Lite or Navicat to connection to the MySQL server (if it allows remote connections). phpMyAdmin is probably the easiest option though. -TG - Origina

Re: [PHP-DB] Generating random numbers

2008-04-16 Thread TG
r be generated by PHP or the database? Or can it be either? -TG - Original Message - From: "A. Joseph" <[EMAIL PROTECTED]> To: "Evert Lammerts" <[EMAIL PROTECTED]> Cc: "php-db@lists.php.net" Date: Thu, 17 Apr 2008 00:00:21 +0100 Subject: [PHP-

Re: [PHP-DB] When does using multiple tables make sense?

2008-10-20 Thread TG
load on the server than you need to put on it. Anyway, just some thoughts. See if anyone else responds, do some reading, etc. Sounds like you're in a good position since your company is small. Probably can't do too much that's going to cause a mess in the future. hah G

[PHP-DB] Joomla MySQL query performance affected by anything non-server related?

2008-11-05 Thread TG
ce would be appreciated. I know my way around a database or two and know a few things about optimization, but I need some solid evidence to throw at this web host so they'll listen to me. They're usually really awesome, but this case is causing me to lose my hair. Thanks in adva

Re: [PHP-DB] Joomla MySQL query performance affected by anything non-server related?

2008-11-05 Thread TG
That's the other thing that's driving me nuts. They get traffic, but it shouldn't be so much that it's causing issues ilke this. Shouldn't have to make such radical changes for this site. All I can think is that it's an issue with their server and/or other custom

Re: [PHP-DB] Joomla MySQL query performance affected by anything non-server related?

2008-11-05 Thread TG
- Original Message - From: Afan Pasalic <[EMAIL PROTECTED]> To: TG <[EMAIL PROTECTED]> Cc: php-db@lists.php.net Date: Wed, 05 Nov 2008 17:07:46 -0600 Subject: Re: [PHP-DB] Joomla MySQL query performance affected by anything non-server related? > TG wrote: >

Re: [PHP-DB] Joomla MySQL query performance affected by anything non-server related?

2008-11-09 Thread TG
ly weird, since their support is usually great. Maybe it's just their database guys who don't want to work. -TG - Original Message - From: "Fergus Gibson" <[EMAIL PROTECTED]> To: php-db@lists.php.net Date: Sun, 9 Nov 2008 11:09:22 -0800 Subject: Re: [PHP-DB] Joom

Re: [PHP-DB] is there any reasone why the following doesn't work?

2008-12-25 Thread TG
ng one "connect" at the head of your script and closing it at the end of the script execution isn't a big deal. But you won't be able to pass the connection information via session variables. -TG - Original Message - From: Fred Silsbee To: php-db@lists.php.net

Re: [PHP-DB] recover values independently of GET or POST used

2009-09-14 Thread TG
s probably good to try to structure things so you have a predictable and controllable way so you know whether you're going to be getting GET or POST data. Some cases required 'either' but in general, one or the other should be good enough if your code is structured properly. -T

Re: [PHP-DB] How to: Include identifier with a query

2009-11-02 Thread TG
;t know if that helps, but just to add to the list of "how *some* people do it". Good luck! -TG - Original Message - From: listread To: php-db@lists.php.net Date: Mon, 02 Nov 2009 07:16:23 -0600 Subject: [PHP-DB] How to: Include identifier with a query > Greetings! > &g

Re: [PHP-DB] Are join queries in phpMyAdmin a security hazard?

2010-02-28 Thread TG
The only issue I see and maybe why they'd disable it is so you don't do a crazy join that ends up returning 8 billion rows. But they should be able to manage that with query execution time timeouts or something and you can do the same thing with bad implied inner joins in the WHERE clause anyw

Re: [PHP-DB] date conversions

2004-12-15 Thread tg-php
d?) and just using the numbers is the one big instance that strtotime() breaks. Hope this helps. You should be able to get whatever date format you need now. -TG *** new email address [EMAIL PROTECTED] *** old email address [EMAIL PROTECTED] YAY CHAPTER 11! :( = = = Original message = = = Hi I

Re: [PHP-DB] date conversions

2004-12-16 Thread tg-php
+ mktime(). I think date/mktime gives you more reliability and more flexibility. Just something to think about. When it comes down to it, whatever works for you, right? :) -TG = = = Original message = = = Thank you for all your help. Among all the variations I found this to be

Re: [PHP-DB] Comparing Two Values

2004-12-21 Thread tg-php
... "0002" (integer versus a string?) If so, the === should work I believe. It should compare variable types as well as values so it shouldn't convert "0002" to just 2 before doing the evaluation. Good luck! -TG = = = Original message = = = Hi List, I was comparin

Re: [PHP-DB] to many addresses

2004-12-27 Thread tg-php
er it again by hand... something to keep them from being too lazy and always entering a new address. Good luck Matt! -TG = = = Original message = = = We have about 20,000 addresses in our database. If my users are filling out a form that requires an address already in our database I have

Re: [PHP-DB] GROUP BY? Urgent help needed with selection list

2005-01-22 Thread tg-php
he lookup of "SE Akron" and know that's actually Akron and not some suburb of Chicago or something, then you're going to have to tell it yourself. I think this is the best solution for you. Best of luck! -TG = = = Original message = = = Hi there everyone, I~m usin

Re: [PHP-DB] Integrated Authentication on IIS 6.0

2005-05-23 Thread tg-php
r things like that. Again, maybe I mis-assuming what your configuration is. Mind giving us more detail on the process you're trying to fix? Users connects to web server, web server makes ODBC connection (by what means?), etc.. -TG = = = Original message = = = Hi, I have an intranet applicat

RE: [PHP-DB] Integrated Authentication on IIS 6.0

2005-05-23 Thread tg-php
n turn actually handles the connection. Don't know if that helps, but that's the next place I'd check, unless someone else has better insight. -TG = = = Original message = = = Thanks for the response! Yes, believe it or not it does work, or at least did on IIS 5. When I turn on

[PHP-DB] Finding duplicate contacts..

2005-07-26 Thread tg-php
.3.4 Any tricks, tips or philosophical and/or theoretical things I've just not seeing, please let me know. Thanks -TG ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP

Re: [PHP-DB] Connecting to SQL Server

2005-08-10 Thread tg-php
DSN config file. Down here it says "Cargo System databases" you'll find examples that might help. Sorry to be vague, but hopefully it's a start for you. Once you get it configured, it should work fairly fluidly. -TG = = = Original message = = = I have been asked by my

Re: [PHP-DB] Case sensitive

2005-08-24 Thread tg-php
son doesn't affect output but will make your case sensitivity issue moot. HTH -TG = = = Original message = = = Hi there everyone, I have a little problem, I have a search where people can search the address of a property BUT the search is case sensitive, I don~t WANT it to be.

Re: [PHP-DB] SQL Injection attack

2005-08-25 Thread tg-php
parately, you only have to check this function, not all your lines of code. If someone has better ways of doing this, I'm all for hearing it. Please opine or criticize what I've posted above too. I want to learn as well. -TG Code: * Modification Log: * -

Re: [PHP-DB] SQL Injection attack

2005-08-25 Thread tg-php
ks for pointing that out. Now off to find my newer version and make sure I chaned it there too. -TG = = = Original message = = = no !!! mysql_real_escape_string() anyhow.. good luck with your security endeavors! On 8/25/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I'm pr

Re: [PHP-DB] Storing an array on a table?

2005-09-01 Thread tg-php
; way to do it. If that's what you need to do though, definitely check out serialize (unless someone knows something I don't). Serialize() should do essentially what's being proposed below, just without having to figure out what string may not be in your array. good luck! -TG

Re: [PHP-DB] Storing an array on a table?

2005-09-01 Thread tg-php
ter though. -TG = = = Original message = = = Yes, this has been mentioned in this thread. But with serialize/ unserialize, you can run into other problems that may be more confusing/difficult to troubleshoot. e.g.: http://www.php.net/serialize > >As you can see, the original

Re: [PHP-DB] Minor Change

2005-12-12 Thread tg-php
error is and then we can figure out how to fix it. Probably a typo in a query, variable name or table name I'm guessing. Let us know if you find anything else out. -TG = = = Original message = = = After adding echo mysql_error(); I get the same result. I tried changing the query to i

Re: [PHP-DB] Need a Help!

2005-12-12 Thread tg-php
songs and want all artists who've covered it to point to the same SongID data. This way you can: SELECT * from ARTISTS for your ARTISTS box Then once an artist is selected, do a: SELECT * from SONGS where ARTISTID = $artistid Just some ideas. Forgive the pseudo-code and mixed c

Re: [PHP-DB] Date Formatting Question

2005-12-14 Thread tg-php
onthText = date("F", mktime(0, 0, 0, $i, 1, 2000)); if ($i == $monthNumber) $selected = " SELECTED"; else $selected = ""; echo "$selectMonthText\n"; echo "\n"; -TG = = = Original message = = = I am trying to format the month portion

RE: [PHP-DB] Formatting a form box

2006-01-12 Thread tg-php
have any doubts/questions. -TG = = = Original message = = = use the nl2br() function to convert the newlines to bastien >From: Alex Major <[EMAIL PROTECTED]> >To: >Subject: [PHP-DB] Formatting a form box >Date: Thu, 12 Jan 2006 16:33:01 + > >Hi there, >On one o

[PHP-DB] MySQL date casting..

2006-01-17 Thread tg-php
a way to convert at least the valid date/time pairs into a happily ORDER BY'd column. I can handle the -00-00 and N/A entries with exceptions if I need to. And I would really like to do this without pre-loading the data into PHP and sorting it with PHP

RE: [PHP-DB] MySQL date casting..

2006-01-17 Thread tg-php
s meant to work on separate date and time fields in the following formats: ApptDate: -MM-DD (we at least did that part 'normal') ApptTime: HH:MM [AM|PM] Thanks for the response though Stephen... always worth going over the simple stuff first. :) -TG = = = Original message =

Re: [PHP-DB] MySQL date casting..

2006-01-17 Thread tg-php
PM', '%Y-%m-%d %H:%i:%s') duh... hah. Thanks! I knew it was something simple. -TG -- What's wrong with [using] this? mysql> select str_to_date('2005-10-27 07:00 PM', '%Y-%m-%d %l:%i %p'); +

Re: [PHP-DB] Refreshing text question!

2006-01-18 Thread tg-php
xpires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 header("Cache-Control: post-check

Re: [PHP-DB] Refreshing text question!

2006-01-18 Thread tg-php
uot;); // always modified header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 header("Cache-Control: post-check=0, pre-check=0", false); // HTTP/1.1 header("Pragma: no-cache"); // HTTP/1.0 good luck! -TG = = = Original message = = = Hi,

RE: [PHP-DB] Date & Time 90 minutes ago

2006-01-19 Thread tg-php
05; echo date("Y-m-d H:i:s", mktime($hour, $minute - 90, $second, $month, $day, $year)); It will even adjust for leap years I believe. You can add/subtract/etc any of those items and it's smart enough to figure out what the correct resulting date/time would be. -TG = =

[PHP-DB] Storing money values in MySQL

2006-01-19 Thread tg-php
efficient and accurate and this is on the list of things to doublecheck. If anyone has any comments, criticisms, information, etc... I'd love to hear them. We're running MySQL 4.1.11-standard. Thanks! -TG ___ Sent by ePrompte

Re: [PHP-DB] Storing money values in MySQL

2006-01-20 Thread tg-php
ch and not "monetary". I think that's the keyword that would have done it for me. I appreciate the help guys! Best of luck to both of you (and anyone else I inadvertantly missed who may have responded). -TG = = = Original message = = = Me again, Sorry for the rtfm stuff

Re: [PHP-DB] Duplicate rows

2006-03-01 Thread tg-php
;re dealing with 15k rows still, so you probably want something a little more automated. Without more info though, it's hard to say exactly what can be done. Hope that helps a little bit. -TG = = = Original message = = = My dear beloved friends, I have a catalog of products that a produ

Re: [PHP-DB] Duplicate rows

2006-03-01 Thread tg-php
Haha.. oh yeah.. DISTINCT works too.. in this case you'd get a list of all totally 100% unique records. If you had an auto_increment column though, you'd want to exclude it from the list. -TG = = = Original message = = = SELECT DISTINCT * FROM `tablename` On Wednesday 01 March

Re: [PHP-DB] Installing PEAR

2006-03-03 Thread tg-php
ong in case it was useful. -TG = = = Original message = = = I know this may be a bit off-topic, but I would like to use the PEAR library to implement some of my database functions. Unfortunately, the PEAR documentation is woefully incomplete and as a result i've been unable to install it pr

Re: [PHP-DB] Excel to CSV

2006-03-11 Thread tg-php
cel file format spec.. maybe through the OpenOffice sources.. and figure out how to read XLS files that way. The Excel Object Model might help you with the proper properties/methods/etc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_wrcore/html/wrgrfexcelworkbookobject.asp Go

Re: [PHP-DB] Adding url to google

2006-05-12 Thread tg-php
figure out how they do it (if at all) but I'm guessing it's not going to really be feasible for you to do this... not easily at least. -TG = = = Original message = = = Hi all, I am developing the site using php and mysql. I have to add the url at google site through php code. If any

Re: [PHP-DB] Too stupid to UPDATE...

2006-05-12 Thread tg-php
s to try to isolate if it's the query or your PHP. Good luck! -TG = = = Original message = = = I am trying to write a script to handle event registration. Most of the people that will be registering are already in the database, but not all, and those that are may not have current informat

Re: [PHP-DB] MySQL/PHP Left Join Question

2006-05-25 Thread tg-php
hen when you go to do your output, you'd do something like this: forach ($dvdarr as $callnumber => $dvddata) { $title = $dvddata['Title']; $publisher = $dvddata['Publisher']; $comments = $dvddata['Comments']; foreach ($comments as $comment) { // do wh

Re: [PHP-DB] Automatically +1 every 30 mins to a value in the database.

2006-06-02 Thread tg-php
figure out how many 30 minute periods have occurred between the timestamp and now and update the gold then. The cron job is preferrable but if you're looking for alternate ideas, there's one for ya. Good luck! -TG = = = Original message = = = Hi there. I've posted this up on

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

2006-06-06 Thread tg-php
here may be some tricky ways in SQL to get the data the way you want it, but ultimately it's not worth the bending over backwards for (do I remember right that you can do it with crosstab queries? don't even know if MySQL will do those properly). Easier just to do it with one of

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

2006-06-08 Thread tg-php
s an example of how to do it in MySQL: http://dev.mysql.com/tech-resources/articles/wizard/index.html But again, not what the original poster was looking for. -TG = = = Original message = = = google 'cross tab queries'...there is a php/mysql example (sorry travelling and don't

RE: [PHP-DB] LIMIT

2006-07-05 Thread tg-php
cause very minimal impact on your system. Sometimes two queries are better than one. -TG = = = Original message = = = I see they call mysql_query twice which doesn't look like I'm gaining anything over running the 2 queries: SELECT count(*) as MyCount FROM aTable SELECT * FROM aTable

Re: [PHP-DB] running program after insert w/MySQL 4.1

2006-07-07 Thread tg-php
s the database check. You could probably get the last inserted ID number as well and pass that to the PHP script if you want to check specific records right after they're inserted. -TG = = = Original message = = = I have an Access database connecting via ODBC to a local MySQL machine

Re: [PHP-DB] Problem with list#2

2006-07-07 Thread tg-php
ested and unsubscribe using one of your email addresses and see if that solves the problem. -TG On 7/7/06, Karl James <[EMAIL PROTECTED]> wrote: > > Team, > > > > I am still receiving duplicate emails. > > I check with my ISP and they tell me it is > > Not th

Re: [PHP-DB] Order By [blank]

2006-12-21 Thread tg-php
al values, but it doesn't change what appears in your results. This only affects the sorting: select * from sometable order by if(ifnull(somecolumn, '') = '', 'ZZZZ', somecolumn) Hope that helps. -TG = = = Original message = = = I have this c

Re: [PHP-DB] Order By [blank]

2006-12-21 Thread tg-php
al values, but it doesn't change what appears in your results. This only affects the sorting: select * from sometable order by if(ifnull(somecolumn, '') = '', 'ZZZZ', somecolumn) Hope that helps. -TG = = = Original message = = = I have this c

Re: [PHP-DB] Order By [blank]

2006-12-21 Thread tg-php
x27;s able to UNION them together. Also, less code/typing typically means less chance of typos. BTW: In my example, realistically you could probably shorten the morphed value to "ZZ" or "ZZZ" unless you think you'll values in your database that will start with "ZZ

Re: [PHP-DB] MSSQL Server

2006-12-21 Thread tg-php
random data sources I had to from time to time. http://adodb.sourceforge.net/ Sorry I don't have time to look for good examples, but maybe the documentation will help out some and get you on the right path. -TG = = = Original message = = = I cannot connect to my MSSQL server. I us

Re: [PHP-DB] search result error message

2006-12-21 Thread tg-php
get zero results. You really don't need to use the mysql_affected_rows() either unless you want to test for zero results and display an error message, like I believe you wanted to do. -TG = = = Original message = = = Hi, The below mentioned code works fine. Connects to the database, fetches

Re: [PHP-DB] Filter array results... no copies

2007-01-11 Thread tg-php
If all you want is a unique list of "adr_one_region" codes, then use the DISTINCT keyword in your SQL: SELECT DISTINCT adr_one_region FROM egw_addressbook WHERE cat_id='8' ORDER BY adr_one_region -TG = = = Original message = = = Hello everyone I'm back wor

Re: [PHP-DB] 2 queries --> 1 array

2007-01-12 Thread tg-php
Not sure if this is exactly what you're looking for, Matt, but I think it is. If that's not right, please re-describe the problem and let's see what we can figure out. If you have questions about what/how/why/etc... feel free to ask. -TG = = = Original message = = = Hel

Re: [PHP-DB] 2 queries --> 1 array

2007-01-12 Thread tg-php
o "Supplier: $name has CONTACT_VALUE = $value\n"; } There may be an elegant way to do what you want in SQL too, I'm just not fully groking the situation I think. -TG > $name = $row['NAME']; > $business = $row['BUSINESS']; > $address = $row

Re: [PHP-DB] SQL Query - Using variable from another SQL Query

2007-02-12 Thread tg-php
Try this as your SQL. It should give you all the results, then you can use PHP to sort it all out. SELECT * FROM egw_cal WHERE cal_category='501' and cal_id in (SELECT cal_id FROM egw_cal_dates where cal_start > $tstamp) -TG = = = Original message = = = Hello Everyone

Re: [PHP-DB] Values in a date field

2007-03-17 Thread tg-php
e "n" echo date("n", strtotime($subscription_begins)); http://us3.php.net/manual/en/function.date.php -TG = = = Original message = = = I have a $subscription_begins variable. It the date type. -MM-DD How may I find out the month value (1

Re: [PHP-DB] Search for whole words in MySQL 3.23

2007-06-13 Thread tg-php
e alnum class or an underscore (_). mysql> SELECT 'a word a' REGEXP '[[:<:]]word[[:>:]]'; -> 1 mysql> SELECT 'a xword a' REGEXP '[[:<:]]word[[:>:]]'; -> 0 -TG = = = Original message = = = Hi all, I'm setting up a data

Re: [PHP-DB] sql statement - complex order by

2007-07-02 Thread tg-php
"s first, sorting them by first/last, then put everyone else after the "Bob"s sorted by first/last. If you don't put DESC on the 'Cats', it looks like it'll put the 'Cats' at the bottom of the list. Also refer to the user comments here: htt

Re: [PHP-DB] sql statement - complex order by

2007-07-02 Thread tg-php
ff, but just to demonstrate the point: SELECT * FROM productgroup WHERE groupid = $productid ORDER BY IIF(label = 'Cats', 0, 1), title Was that MS SQL or just Access that used IIF? (immediate IF.. wtf is an 'immediate IF' anyway?) -TG = = = Original message = = = I think the

Re: [PHP-DB] First and Last ID of a table

2007-07-11 Thread tg-php
SELECT MIN(id), MAX(id) FROM mytable :) Hope that helps! -TG = = = Original message = = = I have a table where I need to figure out the very first ID and the very last ID, so here is what I wrote: $first_query = "SELECT id FROM mytable ORDER BY id LIMIT 1"; $first_result = m

Re: [PHP-DB] First and Last ID of a table

2007-07-11 Thread tg-php
able names: SELECT l.LeadID, ld.FirstName FROM Leads as l, LeadData as ld WHERE l.LeadID = ld.LeadID (actually a lot of the time you can leave out the "as" and just do "Leads l") Fun times.. -TG = = = Original message = = = <[EMAIL PROTECTED]> wrote in message news:[EMA