472,798 Members | 1,318 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,798 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 1199
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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{

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.