473,395 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

capturing query result

ddtpmyra
333 100+
how can I capture the query result in PHP?

I have two queries below:
[PHP]# Fetch the file information
$query ="update filestorage set approved ='Y' where FileID = {$id}";
$query1 ="select members.email from members, filestorage where filestorage.author = members.username and FileID = {$id}" ;[/PHP]

then execute the query using command below:
[PHP] $result = @mysql_query($query) or die("Error! Query failed: <pre>". mysql_error($dbLink) ."</pre>");
$result1 = @mysql_query($query1) or die("Error! Query failed: <pre>". mysql_error($dbLink) ."</pre>");[/PHP]

assigning var $result1:
[PHP] echo "$result1";
$to = "$result1";[/PHP]

and when I tried to print the $result1 it shows
"Resource id #3"
where I'm expecting "email address" (johnsmith@yahoo.com) as a result :( Please anyone can show me how to do this in a right way.
Oct 25 '08 #1
1 1730
Markus
6,050 Expert 4TB
You have to run it through one of mysql's functions such as mysql_fetch_array().

Expand|Select|Wrap|Line Numbers
  1. $result1 = @mysql_query($query1)  or die("Error! Query failed: <pre>". mysql_error($dbLink) ."</pre>");
  2.  
  3. while($output = mysql_fetch_array($result1))
  4. {
  5.     echo $output['email'];
  6. }
  7.  
Oct 25 '08 #2

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

Similar topics

1
by: Oz | last post by:
This is long. Bear with me, as I will really go through all the convoluted stuff that shows there is a problem with streams (at least when used to redirect stdout). The basic idea is that my...
14
by: Brent Burkart | last post by:
I am trying to capture the Windows Authenticated username, but I want to be able to capture the login name that exists in IIS, not Windows. In order to enter my company's intranet through the...
2
by: GS | last post by:
How can one avoid capturing leading empty or blank lines? the data I deal with look like this "will be paid on the dates you specified. xyz supplier amount: $100.52 when: September 07,...
3
by: Rahul Babbar | last post by:
Hi, I have the following doubt. Suppose I use the execute immediate statement and the statement to be executed is a Select statement from the sysibm.sysdummy1 table which will always return...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.