[PHP-DB] Re: Quarter question..
In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... HI all, In the code below I'm trying to get the last column to show 1, 2, 3, or 4= =20 according to which quarter of the year it is. But all it shows in that co= lumn=20 is Resource ID # X. The X starts with #3 and goes to 18. There are (at= the=20 moment) 15 items in the table. Any ideas what's wrong? Thanks JIM # ?php echo table border=3D1 \n; $i=3D1; while ($myrow =3D mysql_fetch_array($result)) { if($i % 2) { //this means if there is a remainder echo TR bgcolor=3D\yellow\\n; } else { //if there isn't a remainder we will do the else echo TR bgcolor=3D\white\\n; } $qdate=3D$myrow[date]; $sql =3D select quarter($qdate) or die(not work #3); $yyy =3D mysql_query ($sql) or die(not work #4); printf(tda href=3D\%s?id=3D%sdelete=3Dyes\Delete/a/td, $PHP_= SELF,=20 $myrow[id]); printf(tda href=3D\%s?id=3D%ssubmit=3Dyes\Update/tdtd%s/td= td =20 %s/tdtd %s/td/a/tr,=20 =09update-inv.php, $myrow[id], $myrow[name], $myrow[details], $yy= y); You are echoing/printing $yyy here, which is the mysql result pointer; you need to use mysql_fetch_array or similar to get the value of the quarter. Hint - you might want to use an alias in the query where you select the quarter. $i=3D$i+1; } echo /table\n; } ? # -- David Robley Temporary Kiwi! Quod subigo farinam -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Check If Table Exists
In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... RTFM? Read The Fine Manual -- David Robley Temporary Kiwi! Quod subigo farinam -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Check If Table Exists
not to make a point but the F = fucking and not fine :-) -Original Message- From: David Robley [mailto:robleyd;paradise.net.nz] Sent: maandag 4 november 2002 9:46 To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Check If Table Exists In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... RTFM? Read The Fine Manual -- David Robley Temporary Kiwi! Quod subigo farinam -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Connecting to DB on separate server?
Hi You need to pinpoint where the break in communication is. Does php connect ok to a database on the local machine? no - php or local MySql config problem? yes - can you ping the database server from the php server? no - network problem yes -MySql problem -is MySql running no - start it :) yes - have you run a GRANT statement that allows access to the database from the php server? If none of the above gives any answers contact me offlist and I will run through some diagnostics with you HTH Peter --- Excellence in internet and open source software --- Sunmaia Birmingham UK www.sunmaia.net tel. 0121-242-1473 International +44-121-242-1473 --- -Original Message- From: Cassy M Rowe [mailto:cassy;cassyrowe.com] Sent: 04 November 2002 04:27 To: [EMAIL PROTECTED] Subject: [PHP-DB] Connecting to DB on separate server? I have a php page on server #1 trying to access a database on server #2. What do I put in the following blanks: $hostname: ___ (have tried IP, http, localhost, nothing works) $username: blah $password: blah $database: _ $link=mysql_connect($hostname, $user, $pass) or die(Failure to communicate with database); $close=mysql_select_db($database, $link); All I get is the Failure to communicate. message. Server #1: ellerweb.eller.arizona.edu Server #2: datamonster.sbs.arizona.edu $database is cassy, but do I need to add anything to that? I've tried asking two people who are really good at this and they have no answers. THANK YOU IN ADVANCE! Cassy Rowe -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Connecting to DB on separate server?
Also the following might give a more useful error message $link=mysql_connect($hostname, $user, $pass) echo mysql_errno() . : . mysql_error(). \n; Peter --- Excellence in internet and open source software --- Sunmaia Birmingham UK www.sunmaia.net tel. 0121-242-1473 International +44-121-242-1473 --- -Original Message- From: Cassy M Rowe [mailto:cassy;cassyrowe.com] Sent: 04 November 2002 04:27 To: [EMAIL PROTECTED] Subject: [PHP-DB] Connecting to DB on separate server? I have a php page on server #1 trying to access a database on server #2. What do I put in the following blanks: $hostname: ___ (have tried IP, http, localhost, nothing works) $username: blah $password: blah $database: _ $link=mysql_connect($hostname, $user, $pass) or die(Failure to communicate with database); $close=mysql_select_db($database, $link); All I get is the Failure to communicate. message. Server #1: ellerweb.eller.arizona.edu Server #2: datamonster.sbs.arizona.edu $database is cassy, but do I need to add anything to that? I've tried asking two people who are really good at this and they have no answers. THANK YOU IN ADVANCE! Cassy Rowe -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Quarter question..
$sql = select quarter($qdate) or die(not work #3); change to $sql = select quarter($qdate) as my_quarter; //Added an alias to quarter($qdate). Easier to access that way... And there's no need for an 'or die()' here. You're just assigning a variable and most likely this will allways work! $yyy = mysql_query ($sql) or die(not work #4); change to $yyy = mysql_query ($sql) or die(not work #4: . mysql_error()); //Standard MySQL trouble-shooting... printf(tda href=\%s?id=%sdelete=yes\Delete/a/td, $PHP_SELF, $myrow[id]); printf(tda href=\%s?id=%ssubmit=yes\Update/tdtd%s/tdtd %s/tdtd %s/td/a/tr, update-inv.php, $myrow[id], $myrow[name], $myrow[details], $yyy); and here you actually echo out the resource id instead of it's value... change $yyy to $yyy[my_quarter] HTH Joakim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Quarter question..
printf(tda href=\%s?id=%sdelete=yes\Delete/a/td, $PHP_SELF, $myrow[id]); printf(tda href=\%s?id=%ssubmit=yes\Update/tdtd%s/tdtd %s/tdtd %s/td/a/tr, update-inv.php, $myrow[id], $myrow[name], $myrow[details], $yyy); My bad. Before this printf statement you need $my_var = mysql_fetch_array($yyy); and then in the printf statement change $yyy to $my_var[my_quarter] That should work... Regards Joakim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Quarter question..
On Monday 04 November 2002 19:58, [EMAIL PROTECTED] wrote: $sql = select quarter($qdate) or die(not work #3); change to $sql = select quarter($qdate) as my_quarter; //Added an alias to quarter($qdate). Easier to access that way... And there's no need for an 'or die()' here. You're just assigning a variable and most likely this will allways work! On the contrary. If you've made a mistake in your query you wouldn't know what's happening. So having the below is a very good idea. $yyy = mysql_query ($sql) or die(not work #4: . mysql_error()); //Standard MySQL trouble-shooting... -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Ask not what's inside your head, but what your head's inside of. -- J.J. Gibson */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Locking for data integrity
I'm making a query to one table, and inserting it into another table (INSERT.SELECT syntax). The table that's the source of the copy is updated constantly, and is has a large amount of data in it. Will locking the table for write (or read??) access keep insert queries to the source table from executing at all, or will they be queued, and executed after the lock is lifted? The MySQL manual wasn't clear on this. I may be misunderstanding the SQL meaning of locking something; I want to keep a table from being updated while I'm getting information from it, but I still want the inserts to be executed after I'm finished with the table. I'm running the query in a cron job daily to compress the data in a log table, and keep it from growing out of control, by copying the totals per user from the live table into a daily table, and then deleting all of the records in the live table. If the live table is locked and the inserts made during the lock are queued and executed after the lock is released, it makes the whole thing a lot easier to manage. I can empty the live table and be sure that all of the data in the live table the following day is new data, and not worry about data loss because of the execution time of the script (which could be as long as 30 seconds or more, we've gotten over 17,500 unique entries in the past 24 hours, and the site is growing). Thanks for your help. -- Josh -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Locking for data integrity
They will be queued, in my experience. Peter On Mon, 4 Nov 2002, Josh Johnson wrote: I'm making a query to one table, and inserting it into another table (INSERT.SELECT syntax). The table that's the source of the copy is updated constantly, and is has a large amount of data in it. Will locking the table for write (or read??) access keep insert queries to the source table from executing at all, or will they be queued, and executed after the lock is lifted? The MySQL manual wasn't clear on this. I may be misunderstanding the SQL meaning of locking something; I want to keep a table from being updated while I'm getting information from it, but I still want the inserts to be executed after I'm finished with the table. I'm running the query in a cron job daily to compress the data in a log table, and keep it from growing out of control, by copying the totals per user from the live table into a daily table, and then deleting all of the records in the live table. If the live table is locked and the inserts made during the lock are queued and executed after the lock is released, it makes the whole thing a lot easier to manage. I can empty the live table and be sure that all of the data in the live table the following day is new data, and not worry about data loss because of the execution time of the script (which could be as long as 30 seconds or more, we've gotten over 17,500 unique entries in the past 24 hours, and the site is growing). Thanks for your help. -- Josh -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Quarter question..
On Monday 04 November 2002 19:58, [EMAIL PROTECTED] wrote: $sql = select quarter($qdate) or die(not work #3); change to $sql = select quarter($qdate) as my_quarter; //Added an alias to quarter($qdate). Easier to access that way... And there's no need for an 'or die()' here. You're just assigning a variable and most likely this will allways work! On the contrary. If you've made a mistake in your query you wouldn't know what's happening. So having the below is a very good idea. $yyy = mysql_query ($sql) or die(not work #4: . mysql_error()); //Standard MySQL trouble-shooting... Hi Jason, I might have been unclear in my reply. The original code had an 'or die()' on $sql = select... aswell and that is, in my opinion, rather unnecessary. Using 'or die(mysql_error())' on mysql_query should be mandatory. At least during development. Regards Joakim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Generating readio buttons
On Sun, 3 Nov 2002, David Jackson wrote: OK, this works but there has to be a pretty way? David html headtitleOperation Sticky Bun/title/head body h3 align=centerOperation Sticky Bun /h3 ?php require('connect.php'); print 'form action=hello.php method=post'; $header = mysql_query (SELECT * FROM chart ORDER BY acct); if (mysql_num_rows($header)0) { while ($row = mysql_fetch_array($header)) { print input type='radio' name='ledger_acct' value='{$row['acct']}'{$row['descript']}br; } } else print Sorry, no records were found!; print '/form'; ? /body /html That looks prettier to me. Peter --- Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] OCIBindByName with Oracle 8i17 problem ?!
I discovered recently that it was impossible to bind an output placeholder plsql (an input work only). Configuration 1 : Suse + Oracle 8i17 + oci (oracle) + PHP4.2.3 Configuration 2 : HPUX11 + Oracle 8i17 + oci(oracle) + PHP4.2.3 Configuration 3 : HPUX11 + Oracle 8i17 + oci(oracle) + PHP4.2.2 With script : inoutdemo.sql CREATE OR REPLACE PROCEDURE inoutdemo (par_in IN VARCHAR2, par_in_out IN OUT VARCHAR2, par_out OUT VARCHAR2) IS BEGIN par_out:=par_in; par_in_out:=par_in||' '||par_in_out;END; $db=OCILogon(toto,titi); $stmt=OCIParse($db,BEGIN inoutdemo(:in,:inout,:out);END;); OCIBindByName($stmt,:in,$in,32); OCIBindByName($stmt,:inout,$inout,32); OCIBindByName($stmt,:out,$out,32); $in=Hello ; $inout=World!; OCIExecute($stmt); echo $in.\n.$inout.\n.$out.\n; //Result Warning: OCIStmtExecute: ORA-06550: line 1, column 17: PLS-00553: character set name is not recognized ORA-06550: line 0, column 0: PL/SQL: Compilation unit analysis terminated in /opt/apache/htdocs/fab.php4 on line 58 Hello World! I tested this script with the 3 configurations but it's the same error I changed $in, inout , out into $in, $out, $inout but it's the same error Please help me !!! Fabien JOSEPH -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] OCIBindByName with Oracle 8i17 problem ?!
On Mon, Nov 04, 2002 at 06:16:04PM +0100, Fabien JOSEPH wrote: I discovered recently that it was impossible to bind an output placeholder plsql (an input work only). Configuration 1 : Suse + Oracle 8i17 + oci (oracle) + PHP4.2.3 Configuration 2 : HPUX11 + Oracle 8i17 + oci(oracle) + PHP4.2.3 Configuration 3 : HPUX11 + Oracle 8i17 + oci(oracle) + PHP4.2.2 With script : inoutdemo.sql CREATE OR REPLACE PROCEDURE inoutdemo (par_in IN VARCHAR2, par_in_out IN OUT VARCHAR2, par_out OUT VARCHAR2) IS BEGIN par_out:=par_in; par_in_out:=par_in||' '||par_in_out;END; $db=OCILogon(toto,titi); $stmt=OCIParse($db,BEGIN inoutdemo(:in,:inout,:out);END;); OCIBindByName($stmt,:in,$in,32); OCIBindByName($stmt,:inout,$inout,32); OCIBindByName($stmt,:out,$out,32); $in=Hello ; $inout=World!; OCIExecute($stmt); echo $in.\n.$inout.\n.$out.\n; //Result Warning: OCIStmtExecute: ORA-06550: line 1, column 17: PLS-00553: character set name is not recognized ORA-06550: line 0, column 0: i'd say you have a problem with your NLS_LANG setting. re, tc PL/SQL: Compilation unit analysis terminated in /opt/apache/htdocs/fab.php4 on line 58 Hello World! I tested this script with the 3 configurations but it's the same error I changed $in, inout , out into $in, $out, $inout but it's the same error Please help me !!! Fabien JOSEPH -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Thies C. Arntzen - Looking for all sorts of freelance work - just ask.. http://www.amazon.de/exec/obidos/wishlist/AB9DY62QWDSZ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] how to timeout a db connect
Is there any way to control the timeout of a pg_connect() call? I.e., if the connect doesn't succeed in N seconds, abort immediately, and fall through to the next line of code. I've got my app configured to go into maintenance mode when the db connect fails... only problem is, that takes too long. I'd like to manually specify a lower connect timeout. Is this possible? -- Alex Howansky Wankwood Associates http://www.wankwood.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Oracle via PHP on OS X
I need to make connections of this sort but cannot find the needed extensions. Could someone point me in the right direction? I'm using 10.1.5. James -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Quarter question..
On Monday 04 November 2002 22:56, [EMAIL PROTECTED] wrote: I might have been unclear in my reply. Sorry, I was following this thread on and off and probably misinterpreted your post. The original code had an 'or die()' on $sql = select... aswell and that is, in my opinion, rather unnecessary. Of course ;-) Using 'or die(mysql_error())' on mysql_query should be mandatory. At least during development. That should be drummed into people's heads from the word go! I've made a request in the users' comment of the mysql section of the manual hoping that the example code is changed so that instead of just die(), it dies with a mysql_error(). -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Maybe you can't buy happiness, but these days you can certainly charge it. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Date and time issues
Hi all, I searched for 5 hours, trying to solve my (newbie?) problem. I want to pick today's date and add XXX days to it. Its setup to validate membership period. Now my column is of date type. Aswell, I want to pick current time and add 1 hour to it. Here aswell, sessions expire after one hour. Can anybody help me? Thanks Fred My code: $time = getdate(); $yr = $time[year]; $mn = $time[mon]; $dy = $time[mday]; if (subscr_type==1) { //these users van only work 1 hour $exp_time=time()+3600; $new_exp_day = getdate(); } else if (subscr_type==3) { //3 months subscription(here time doesn't really matter) $offset = 90; } else if (subscr_type==12) { //1 year subscriptions $offset = 365; } $new_exp_day = strftime(%Y-%m-%d,mktime(0,0,0,$mn,$dy+$offset,$yr)); -- Frederik Feys [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Date and time issues
I assume you are trying to insert into a mysql table column that is a date. insert into table (datecol) values (from_unixtime($new_exp_day)); Example output of from_unixtime: +---+ | from_unixtime(10) | +---+ | 2001-09-08 21:46:40 | +---+ Peter On Mon, 4 Nov 2002, Frederik Feys wrote: Hi all, I searched for 5 hours, trying to solve my (newbie?) problem. I want to pick today's date and add XXX days to it. Its setup to validate membership period. Now my column is of date type. Aswell, I want to pick current time and add 1 hour to it. Here aswell, sessions expire after one hour. Can anybody help me? Thanks Fred My code: $time = getdate(); $yr = $time[year]; $mn = $time[mon]; $dy = $time[mday]; if (subscr_type==1) { //these users van only work 1 hour $exp_time=time()+3600; $new_exp_day = getdate(); } else if (subscr_type==3) { //3 months subscription(here time doesn't really matter) $offset = 90; } else if (subscr_type==12) { //1 year subscriptions $offset = 365; } $new_exp_day = strftime(%Y-%m-%d,mktime(0,0,0,$mn,$dy+$offset,$yr)); -- Frederik Feys [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Date and time issues
If you are using MySQL, you may profitably investigate the function DATE_ADD( date, INTERVAL ) Ignatius J. Reilly - Original Message - From: Frederik Feys [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, November 04, 2002 10:32 PM Subject: [PHP-DB] Date and time issues Hi all, I searched for 5 hours, trying to solve my (newbie?) problem. I want to pick today's date and add XXX days to it. Its setup to validate membership period. Now my column is of date type. Aswell, I want to pick current time and add 1 hour to it. Here aswell, sessions expire after one hour. Can anybody help me? Thanks Fred My code: $time = getdate(); $yr = $time[year]; $mn = $time[mon]; $dy = $time[mday]; if (subscr_type==1) { //these users van only work 1 hour $exp_time=time()+3600; $new_exp_day = getdate(); } else if (subscr_type==3) { //3 months subscription(here time doesn't really matter) $offset = 90; } else if (subscr_type==12) { //1 year subscriptions $offset = 365; } $new_exp_day = strftime(%Y-%m-%d,mktime(0,0,0,$mn,$dy+$offset,$yr)); -- Frederik Feys [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: OCIBindByName with Oracle 8i17 problem ?!
Fabien Joseph [EMAIL PROTECTED] wrote: I discovered recently that it was impossible to bind an output placeholder plsql (an input work only). Configuration 1 : Suse + Oracle 8i17 + oci (oracle) + PHP4.2.3 Configuration 2 : HPUX11 + Oracle 8i17 + oci(oracle) + PHP4.2.3 Configuration 3 : HPUX11 + Oracle 8i17 + oci(oracle) + PHP4.2.2 With script : inoutdemo.sql CREATE OR REPLACE PROCEDURE inoutdemo (par_in IN VARCHAR2, par_in_out IN OUT VARCHAR2, par_out OUT VARCHAR2) IS BEGIN par_out:=par_in; par_in_out:=par_in||' '||par_in_out;END; $db=OCILogon(toto,titi); $stmt=OCIParse($db,BEGIN inoutdemo(:in,:inout,:out);END;); OCIBindByName($stmt,:in,$in,32); OCIBindByName($stmt,:inout,$inout,32); OCIBindByName($stmt,:out,$out,32); $in=Hello ; $inout=World!; OCIExecute($stmt); echo $in.\n.$inout.\n.$out.\n; //Result Warning: OCIStmtExecute: ORA-06550: line 1, column 17: PLS-00553: character set name is not recognized ORA-06550: line 0, column 0: PL/SQL: Compilation unit analysis terminated in /opt/apache/htdocs/fab.php4 on line 58 IMHO these Oracle error messages mean that there might be something wrong with your PL/SQL code. As it talks about a character set name: did you set (and export) the NLS_LANG environment variable correctly before you started your web server? export NLS_LANG=FRENCH_FRANCE.WE8ISO8859P15 or something like this? Regards... Michael -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] error messages to variables
Jason Wong wrote: On Monday 04 November 2002 12:10, Bob Lockie wrote: You can suppress the error message on failure by prepending a http://www.php.net/manual/en/language.operators.errorcontrol.php to the function name.. How can you get the error string into a local variable? Look at the track_errors setting in php.ini. Thanks. -- From Mozilla and GNU/Linux -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] persistant database connections
I'm using mysql_pconnect(...) at the beginning of a PHP page. Can I safely use mysql_select_db(...) later on the page? I thought I read somewhere that you can't rely on HTML to be rendered from top to bottom. Can I rely on PHP to be interpreted from top to bottom? From Mozilla and GNU/Linux -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: mysql_fetch_array() question
Hi everyone, I think I've got the problem sorted, I'll soon let y'all know if it doesn't work ! Cheers, Graeme :) On Mon, 2002-11-04 at 21:47, Graeme McLaren wrote: Hi, Anyone know how I can use two mysql_fetch_array() functions similar to the code below? I've tried a few different ways but I keep getting Resource ID #4. I need to do this to retrieve an email address from one table and retrieve details from another. Cheers for any tips - I'm stumped with this one, Graeme :) $query = SELECT Name, Address FROM users; $query2 = SELECT EmailAddress From Members; $result = mysql_query($query); $result2 = mysql_query($query2); while($details = mysql_fetch_array($result) and $Email = mysql_fetch_array($result2)) { echo Name: $details[Name]; echo Address: $details[Address]; echo Email: $Email[EmailAddress]; } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] mysql_fetch_array() question
Hi, Anyone know how I can use two mysql_fetch_array() functions similar to the code below? I've tried a few different ways but I keep getting Resource ID #4. I need to do this to retrieve an email address from one table and retrieve details from another. Cheers for any tips - I'm stumped with this one, Graeme :) $query = SELECT Name, Address FROM users; $query2 = SELECT EmailAddress From Members; $result = mysql_query($query); $result2 = mysql_query($query2); while($details = mysql_fetch_array($result) and $Email = mysql_fetch_array($result2)) { echo Name: $details[Name]; echo Address: $details[Address]; echo Email: $Email[EmailAddress]; } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php