[PHP-DB] Re: Join statement and output

2001-03-04 Thread Dan Fitzpatrick
Norman, The SQL statement is this: select s.first_name AS s_name, t.first_name AS t_name, f.date from members s, members t, schedule f where s.first_name=f.member1 and t.first_name=f.member2 The AS is optional but it works the same as aliasing table names in the FROM clause. $s_name | $t_name

[PHP-DB] Re: SQL Mysql - Informix

2001-03-17 Thread Dan Fitzpatrick
Jon, Try the following: Use the sysmaster DB. Then: SELECT tabname FROM systabnames WHERE dbsname = '$your_db_name' [ AND owner 'informix' ] - Assuming you were not logged in as informix when you created the tables [ AND tabname NOT LIKE ' %' ] - If you use blobs you may have some numeric

[PHP-DB] Re: Help please

2001-04-10 Thread Dan Fitzpatrick
I assume that the username field is text. You need to add single quotes around the field. $validate = mysql_query("SELECT username, user_password FROM users WHERE username='".$uname."'",$db); OR simply: $validate = mysql_query("SELECT username, user_password FROM users WHERE

[PHP-DB] SELECT question

2001-05-17 Thread Dan Fitzpatrick
Nick, Use the group by function: SELECT items.itemId, description, link, sum(qty) AS total_qty, sum(price) AS total_price FROM carts, items WHERE carts.custId = '$custId' AND items.itemId = carts.itemId GROUP BY items.itemId, description, link You'll have to change the reference to the

Re: [PHP-DB] Informix Question (Still need help,please)

2001-06-22 Thread Dan Fitzpatrick
B, Do your first query, then run this (for one record returned). while($row = ifx_fetch_row($query_result_id)) { for(reset($row); $fieldname=key($row); next($row)) { $$fieldname = $row[$fieldname]; } } Do your second query. The while statement

Re: [PHP-DB] Row order

2001-07-12 Thread Dan Fitzpatrick
Stefan, Depending on your load, you could save the results in a database table, make the table name a session variable, and just have the sorting column names be fields in the saved table. CREATE TABLE Q1234 AS SELECT ...; You can also put all the variables in a variable then put the new