473,471 Members | 1,995 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

1 or more fetch array

ddtpmyra
333 Contributor
I have two separate query on my PHP mailer and I wonder how can it be possible to call the two queries in one fetch array.

Expand|Select|Wrap|Line Numbers
  1. #email process starts here
  2.  
  3.  
  4.         require("class.phpmailer.php");
  5.         $mail = new PHPMailer();
  6.  
  7.         $mail->From     = "xxxx";
  8.         $mail->FromName = "administrator";
  9.         $mail->Subject = "xxxx";
  10.         $mail->Host     = "xx.xx.xx.x"; // SMTP server
  11.         $mail->Mailer   = "smtp";
  12.  
  13.         //$query 
  14.         $query ="SELECT * FROM members";
  15.         $query1 ="SELECT max(fileid) FROM table1";
  16.  
  17.  
  18.         $result=@MYSQL_QUERY($query);
  19.         $result1=@MYSQL_QUERY($query1);
  20.  
  21.         while ($row = mysql_fetch_array ($result, $result1)) {
  22.             // HTML body
  23.             $body  = "Hello <font size=\"4\">" . $row["fname"] . "</font>, <p>";
  24.             $body .= " <font size=\"4\"> A document is now available for your review" . $row["fileid"] ."</font><p>";
  25.             $body .= "http://xx.xx.xx.xxx/data.php?id=\" .$row [fileid] .\"<p>";
  26.             $body .= "Thank You, <br>";
  27.             $body .= "Administrator";
  28.  
  29.  
  30.  
  31.             $mail->Body    = $body;
  32.             $mail->AltBody = $text_body;
  33.             $mail->AddAddress($row["email"], $row["fname"]);
  34.  
  35.             if(!$mail->Send())
  36.                 echo "There has been a mail error sending to " . $row["email"] . "<br>";
  37.  
  38.             // Clear all addresses and attachments for next loop
  39.             $mail->ClearAddresses();
  40.             $mail->ClearAttachments();
  41.         }
  42.  
I know this won't work :) any suggestion how to call two queries?
Jun 16 '09 #1
3 2285
Dormilich
8,658 Recognized Expert Moderator Expert
you need to combine the two queries, so that you fetch all data at once. I think this can be done using the JOIN syntax (although the SQL people might know better)
Jun 17 '09 #2
prabirchoudhury
162 New Member
1.if this two tables are different and have no primary and foreign key relation then you could make this query like..

Expand|Select|Wrap|Line Numbers
  1. SELECT members. * , (SELECT max(fileid) FROM table1) AS max_field
  2. FROM members
  3.  
  4.  
:)
Jun 19 '09 #3
ddtpmyra
333 Contributor
I have 1.2.13 MYSQL Query Browser

And I had error when I execute this query. Any idea why?

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT max(fileid) FROM table1) AS max_field
FROM members' at
@prabirchoudhury
Jun 19 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: Brian Tkatch | last post by:
I have a PROCEDURE that test other PROCEDUREs. Timings_Call ------------------ Id Group Name Text Timings_Log
38
by: sopranos2 | last post by:
Dear IBM DB2 support, I wish CLP would have been more functional. Without living the command line I would like to get sql return code explanations, scalar function definitions etc.. Looking...
1
by: Ben Ellis | last post by:
Hello all, I'm wanting to know which method I should use to fetch dynamic XML data. Is it better to use web services or to fetch the data from a dynamic XML file? Either, use a webMethod to...
7
by: asenthil | last post by:
Hai to all, this is senthil... i'm now working in the field of VC++... i want to connect a mysql database... just now tried to retrieve rows from a simple mysql database by using VC++ My...
4
by: Christian Maier | last post by:
Hi After surfing a while I have still trouble with this array thing. I have the following function and recive a Segmentation fault, how must I code this right?? Thanks Christian Maier
9
The1corrupted
by: The1corrupted | last post by:
This is truly frustrating. I'm trying to fetch one array from two different tables. Personally, I think it would work but I always get this: Warning: mysql_fetch_array(): supplied argument is...
1
by: buzzw | last post by:
I am trying to find top n salaries from given table . My code returns top n salaries but if there are same value of salaries for more than 1 emp than program just picks one of them, I want to list...
1
by: yasmine | last post by:
Hi friends, I'm having a table which stores id as comma separated in string datatype. I want to fetch each of the value in a row in the form of array such as follows: table: sid ...
1
by: dillipkumar | last post by:
Hi, I have a flat file like: 106|4 |ABC|0000000280| 919886046726| 253436| TP001| 1| 4200| 998607230300| 12345630864|BUNDLE| ACE1| ...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.