473,411 Members | 2,030 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,411 software developers and data experts.

noob question

Okay, I know how to:
- construct a SQL query and get a result set
- loop through the result set and echo the fields I need

But what I really need to do is get a value from a field and put it in a
variable, and I can't seem to get it to work, because then the variable just
holds "resource id#"
So the query I'm using returns only one row, since I'm filering on the
primary key, and I can test for one row returned. If one row is returned,
how do I pull out the value of one field and put it in a variable?

I know this is very basic stuff, but I can't seem to find the answer. Even
just a very simple reply, pointing me in the right direction would be
greatly appreciated.

Thanks!

Ernie
Jan 7 '07 #1
3 1220
On Sun, 7 Jan 2007 09:39:17 -0800, "ernie.bornheimer"
<er**************@gmail.comwrote:
>Okay, I know how to:
- construct a SQL query and get a result set
- loop through the result set and echo the fields I need

But what I really need to do is get a value from a field and put it in a
variable, and I can't seem to get it to work, because then the variable just
holds "resource id#"
So the query I'm using returns only one row, since I'm filering on the
primary key, and I can test for one row returned. If one row is returned,
how do I pull out the value of one field and put it in a variable?
mysql_result or mysql_fetch_array.

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Jan 7 '07 #2
You can also try... mysql_fetch_assoc - this will give you an array of
the values, where the keys of the array would be associative. For
instance, it'll have for a table that's got the fileds "Name" and
"Surname" the following array:
array {
[Name] =peter
[Surname] =pan
}

Andy Hassall wrote:
On Sun, 7 Jan 2007 09:39:17 -0800, "ernie.bornheimer"
<er**************@gmail.comwrote:
Okay, I know how to:
- construct a SQL query and get a result set
- loop through the result set and echo the fields I need

But what I really need to do is get a value from a field and put it in a
variable, and I can't seem to get it to work, because then the variable just
holds "resource id#"
So the query I'm using returns only one row, since I'm filering on the
primary key, and I can test for one row returned. If one row is returned,
how do I pull out the value of one field and put it in a variable?

mysql_result or mysql_fetch_array.

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Jan 7 '07 #3
Thank you both, these suggestions were just what I needed.

Ernie

"Sarel" <sa*****@gmail.comwrote in message
news:11**********************@i15g2000cwa.googlegr oups.com...
You can also try... mysql_fetch_assoc - this will give you an array of
the values, where the keys of the array would be associative. For
instance, it'll have for a table that's got the fileds "Name" and
"Surname" the following array:
array {
[Name] =peter
[Surname] =pan
}

Andy Hassall wrote:
>On Sun, 7 Jan 2007 09:39:17 -0800, "ernie.bornheimer"
<er**************@gmail.comwrote:
>Okay, I know how to:
- construct a SQL query and get a result set
- loop through the result set and echo the fields I need

But what I really need to do is get a value from a field and put it in a
variable, and I can't seem to get it to work, because then the variable
just
holds "resource id#"
So the query I'm using returns only one row, since I'm filering on the
primary key, and I can test for one row returned. If one row is
returned,
how do I pull out the value of one field and put it in a variable?

mysql_result or mysql_fetch_array.

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

Jan 10 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dave Williams | last post by:
First off...total noob to VB. So far have learned a lot in 1.5 days and feel fairly comfortable at throwing screens up. However, I want to start writing forms that revolve around an access...
10
by: Matt Hollingsworth | last post by:
Hello, Very new to python, so a noob question. When I've written stuff in JavaScript or MEL in the past, I've always adopted the variable naming convention of using a $ as the first character...
1
by: davestrike | last post by:
I am a noob to sql and asp programming. I am working on a db for the gaming squad I am a member of. One of the pages I created is a roster list of all the squad members. Part of this roster is...
3
by: We need more power captain | last post by:
Hi, I know less than a noob, I've been asked to do some compiles in VC++ 6 without knowing too much at all. (I'm a COBOL program normally so this is all too much for me) I open VC++6, open...
8
by: Ivan Shevanski | last post by:
Alright heres another noob question for everyone. Alright, say I have a menu like this. print "1. . .Start" print "2. . .End" choice1 = raw_input("> ") and then I had this to determine what...
2
by: Chris Dunaway | last post by:
I was looking over some asp.net code and saw this asp:Image control: <asp:Image ImageUrl="~/images/logo.gif" runat="server" ID="Image1"/> What does the tilde (~) mean in the ImageUrl...
2
by: Dan McCollick | last post by:
Hi All, Noob question that I can not seem to figure out: I am trying to implement a screenscraper to pull data from two seperate websites, here is some test code so far: public static void...
0
by: AndyW | last post by:
Hey folks. I am trying to get a soap wsdl service working and have a bit of a noob php programming question for it. I'm using PHP 5.x btw. I have written a soap server that contains a...
6
by: Lang Murphy | last post by:
I'm baaaaack... some of you answered a question I had last week. Only problem is: I'm a dope who doesn't understand most of what y'all posted. Raw noob when it comes to .Net and C#. So I'm going...
1
by: SCRIPT KEEPER | last post by:
Hello, I am a complete noob and just starting off with csharp so I apologize for my basic question. I am wanting to start powershell from inside a batch script and then to pass the powershell args...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
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...

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.