Solved

More easy stuff :-)

Posted on 2000-03-14
11
215 Views
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?
0
Comment
Question by:dht1
  • 6
  • 5
11 Comments
 
LVL 2

Accepted Solution

by:
gravity earned 75 total points
Comment Utility
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.
0
 

Author Comment

by:dht1
Comment Utility
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! :-)

Cheers!
0
 
LVL 2

Expert Comment

by:gravity
Comment Utility
Skills ? I'm actually a musicien more than programmer :)

(check out my profile !)
0
 

Author Comment

by:dht1
Comment Utility
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*
0
 
LVL 2

Expert Comment

by:gravity
Comment Utility
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 :)
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:dht1
Comment Utility
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.
0
 

Author Comment

by:dht1
Comment Utility
..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?
0
 
LVL 2

Expert Comment

by:gravity
Comment Utility
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.
0
 
LVL 2

Expert Comment

by:gravity
Comment Utility
Why not make the compiler better ?
Ever seen the design of a compiler ? It's a right bitch, it really is...

:)

0
 

Author Comment

by:dht1
Comment Utility
I don't suppose you fancy giving me your email address such that I can email you my php3 for you to debug? :)
0
 
LVL 2

Expert Comment

by:gravity
Comment Utility
Not a chance, that is until I get my shirt :)

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

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now