[PHP-DB] Re: question

2001-12-12 Thread Dan Fitzpatrick
Robert, The easiest way to convert result set values to the field variable names is with one line of code: extract(mysql_fetch_array($row)); This will set $firstname = $row["firstname"], etc. Dan -- ~~~~~~~ Dan Fitzpatrick Overhaul Se

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 variab

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 w

[PHP-DB] Re: Command line PHP + DB access

2001-05-18 Thread Dan Fitzpatrick
Jor, You will need to have the Informix environment variables defined in your shell environment: INFORMIXDIR INFORMIXSERVER Make sure that the command line PHP binary you are using is compiled with Informix support. Dan >Subject: Command line PHP + DB access > Date: Fri, 18 May 2001 11:08

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

[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 username='$uname'",

RE: [PHP-DB] CSS versus Includes

2001-04-01 Thread Dan Fitzpatrick
Matt, I recommend using separate style sheets. This is especially important when your users are browsing a record set, say 10 records at a time. There is no need to pass them the style sheet embedded in the PHP page for every page view. If the stylesheet is a file on the file system, it is more e

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

[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