473,809 Members | 2,797 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1244
On Sun, 7 Jan 2007 09:39:17 -0800, "ernie.bornheim er"
<er************ **@gmail.comwro te:
>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_arr ay.

--
Andy Hassall :: an**@andyh.co.u k :: 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_ass oc - 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.bornheim er"
<er************ **@gmail.comwro te:
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_arr ay.

--
Andy Hassall :: an**@andyh.co.u k :: 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.goo glegroups.com.. .
You can also try... mysql_fetch_ass oc - 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.bornheim er"
<er*********** ***@gmail.comwr ote:
>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_arr ay.

--
Andy Hassall :: an**@andyh.co.u k :: 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
1950
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 database. From what I have read to date it looks like VB can only display 1 record at a time. I suspect this is not the case. How easy is it to display 10 records at a time (in a table format) that can be scrolled up and down ? When the current...
10
2142
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 (no, I don't use perl, never have). Not possible in python. What are some good options that people commonly use so that they can easily and quickly identify variable with just a glance? When I was writing stuff in SoftImage XSI/JScript, many of...
1
1809
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 listing each member's email address. What several people have asked of me is to make it so the email addresses can be clicked on to open their email programs, just as html allows the mailto function to work. Here is a copy of the coding I am...
3
6082
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 the workspace and then: Build>Batch Build
8
2147
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 option.
2
1375
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 attribute? Is it some sort of relative addressing? On the design surface, that shows as an error until I change it to read:
2
1915
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 Main(string args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false);
0
1488
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 single method in the form: SayHelloWorld( $name ) { return "Hello " .$name; };
6
1636
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 to be more specific... All I need to do at the moment is figure out how to replace our usage of .ini files as configuration files for our small, utility type apps. I'm not looking to use XML as a data stream or anything like that. Not right now,...
1
3544
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 from the batch, so from the batch I can use the name of the compiled csharp app without having to include the "call" command. Something like "Compiled Csharp app.exe" "PowerShell Args" etc..... Thank You for any help.
0
9721
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10639
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10383
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10120
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9200
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5550
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5688
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.