More easy stuff :-)

Posted on 2000-03-14
Last Modified: 2008-02-01
Having performed a successful select, how can I refer to the result? (i.e. how could I assign a variable name to the result? Should that not be possible, how could I say if the result from the above query = x then...?

I've been looking at mysql_use_result() however I am totally confused by the MYSQL_RES bit.

Where does that need to be inserted?
What does it do?
Question by:dht1
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5

Accepted Solution

gravity earned 75 total points
ID: 2617371
Ok then, remember the question you asked where I gave you the select code ? I assume that you'll store the SQL to execute it in $sql for this example.

   $query = mysql_query($sql);
   while ($row = mylsq_fetch_row($query)) {
      $result = $row[0];

The thing is that $row is an array containing the fields from the SQL query for that row.

Author Comment

ID: 2617387
hehe... I actually worked it out a couple of hours ago (and neglected to delete the question)... oh well - it's clearly been another opportunity for you to show off your skills! :-)


Expert Comment

ID: 2617420
Skills ? I'm actually a musicien more than programmer :)

(check out my profile !)
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 2617450
Checked out your profile.
Wonderful. I used to play trumpet & piano too. I still play the piano, but I gave up on the ol' trumpet quite a while ago.

Should you care, I'm a final year uni student. Sadly I opted to take computer science as my major - pretty dumb considering my hatred for programming. I'm actually studying comp sci and business administration, and I tell you what, a first in business is nothing compared to a first in computing... and I clearly won't be getting one of those!

....and now I have the pleasure of dealing with a parse error. I musta put my ifs, elses and endifs in the wrong places... Grrrrr...

*waiting for the days when programming languages will get the jist of what you're trying to say, and correct the code for you*

Expert Comment

ID: 2617474
Yeah, I'm 18 and already my trumpet playing is beginning to lag, which is a shame considering it's my major instrument.
I recently applied to Uni for a music course, got an interview, and then a "Please piss off and die" letter, which was nice.
So, right now I'm going to continue working for this internet consultant in London... not exactly what I want to do, but hey, I need the money :)

Author Comment

ID: 2617485
Well, there's pleanty of money in IT... particularly if you're willing to work expat.

Music on the other hand, tends to pay very badly, but is fun...

I think I'd do the IT until I can afford to relax - but hey, that's me.

Author Comment

ID: 2617498
..and that feckin' parse error was for the lack of an inverted comma.

Why o why didn't they just put an additional bit of code into the compiler?

Expert Comment

ID: 2617499
Basically, I'd really like to get into music, but I'm resigned to the sad fact that unless I'm pretty lucky, I'm not going to make any serious cash from it.

All I really want to do is get a job in a hotel or cafe where I can play cheesy jazz all day long.

Expert Comment

ID: 2617503
Why not make the compiler better ?
Ever seen the design of a compiler ? It's a right bitch, it really is...



Author Comment

ID: 2617514
I don't suppose you fancy giving me your email address such that I can email you my php3 for you to debug? :)

Expert Comment

ID: 2617523
Not a chance, that is until I get my shirt :)

Anyway, gotta go eat, so keep groovy...

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MySQL-Design Help 12 67
A responsive image gallery using flexbox 6 79
Bootstrap - BootBox - PHP - MYSQL - Response Trigger 6 62
phpmyadmin memory error 55 95
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question