473,387 Members | 1,553 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,387 software developers and data experts.

strtolower() for query results

I need to take the output from a query and convert it to lower case.
Here is the relevant code:

$query="SELECT FNAME, LNAME FROM (table) WHERE FNAME=('$FName') AND
LNAME=('$LName')";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
I can get number of rows by using mysql_num_rows($result) so I assume
there is some similar method for accessing data in the $result
variable. This didn't seem to work: $result=strtolower($result);
Also changing the query to read LNAME=strtolower('$LName') didn't
work either. I am just looking for a way to access the FNAME and the
LNAME in the $result variable.

Nov 21 '06 #1
10 4911

I appologize, but what is with all the MySQL questions?

RTFM!

http://us2.php.net/manual/en/ref.mysql.php

$result = mysql_query($query);
$rows = array();
$num_rows = mysql_num_rows($result);
for ( $i=0; $i<$num_rows; $i++ )
$rows[] = mysql_fetch_assoc($result);
print_r($rows);

Nov 21 '06 #2

BKDotCom wrote:
I appologize, but what is with all the MySQL questions?

RTFM!

http://us2.php.net/manual/en/ref.mysql.php

$result = mysql_query($query);
$rows = array();
$num_rows = mysql_num_rows($result);
for ( $i=0; $i<$num_rows; $i++ )
$rows[] = mysql_fetch_assoc($result);
print_r($rows);
Oh, I am sorry. I thought this was a newsgroup about PHP. My bad.

Nov 21 '06 #3

Jerim79 wrote:
>
Oh, I am sorry. I thought this was a newsgroup about PHP. My bad.
how many times do we have to explain what mysql_query() returns?
You've started a few threads asking the same question.
Very similar mysql related questions have also been asked in just the
last couple of days.
I simply suggest you use your resources a bit better.
There's no shortage of documentation and examples.

Nov 21 '06 #4

BKDotCom wrote:
Jerim79 wrote:

Oh, I am sorry. I thought this was a newsgroup about PHP. My bad.

how many times do we have to explain what mysql_query() returns?
You've started a few threads asking the same question.
Very similar mysql related questions have also been asked in just the
last couple of days.
I simply suggest you use your resources a bit better.
There's no shortage of documentation and examples.
Huh? I started another thread about IF/Then when using mysql queries.
Some code snippets were submitted. That situation has been resolved. As
far as I know, no one has explained what mysql_query() returns in any
detail that I wasn't already familiar with.

I think the statement "how many times do we have to explain what
mysql_query() returns?" is not only false, but irrelevant to my current
situation. I may post a lot, but I always keep new threads to new
issues. I use the existing thread to work on the existing problem. I
certainly understand the concern of flooding the newsgroup with the
same topic over and over. However, I feel that I have not done that.
You may think all my posts are all on the same topic, but I can assure
you they are not. Perhaps I haven't been expressive enough in
explaining my problem. My posts may be "simple" to advanced
programmers, but you can always choose to ignore them. You should never
discourage people from asking questions. I am a beginner and am running
across a lot of situations where I can't find anything on point for
what I am trying to do. Sure I can find "similar" posts, but nothing
that addresses my concerns. If you know of a post that is precisely on
point, please let me know , as I have yet to find one.

Nov 21 '06 #5

Jerim79 wrote:
BKDotCom wrote:
Jerim79 wrote:
>
Oh, I am sorry. I thought this was a newsgroup about PHP. My bad.
how many times do we have to explain what mysql_query() returns?
You've started a few threads asking the same question.
Very similar mysql related questions have also been asked in just the
last couple of days.
I simply suggest you use your resources a bit better.
There's no shortage of documentation and examples.

Huh? I started another thread about IF/Then when using mysql queries.
Some code snippets were submitted. That situation has been resolved. As
far as I know, no one has explained what mysql_query() returns in any
detail that I wasn't already familiar with.

I think the statement "how many times do we have to explain what
mysql_query() returns?" is not only false, but irrelevant to my current
situation. I may post a lot, but I always keep new threads to new
issues. I use the existing thread to work on the existing problem. I
certainly understand the concern of flooding the newsgroup with the
same topic over and over. However, I feel that I have not done that.
You may think all my posts are all on the same topic, but I can assure
you they are not. Perhaps I haven't been expressive enough in
explaining my problem. My posts may be "simple" to advanced
programmers, but you can always choose to ignore them. You should never
discourage people from asking questions. I am a beginner and am running
across a lot of situations where I can't find anything on point for
what I am trying to do. Sure I can find "similar" posts, but nothing
that addresses my concerns. If you know of a post that is precisely on
point, please let me know , as I have yet to find one.
Okay, the problem has been solved. What I was trying to do was get my
variables from the HTM form into lower case. I would then search a
MySQL database for those values. My associate seemed to think the
database was case sensitive. So I was looking for a way to make sure
that the MySQL query converted everything to lower case. However, while
playing around with it, I got it to work, and didn't have to change the
MySQL query at all. It looks like the database stores the variables in
lower case to begin with.

I was able to run some test data through it, and it always returned the
correct value for the right data which was positive, no matter how I
capitilized it. Wrong data would return the correct value, which in
this case was a negative. So it seems that you don't necessarily have
to modify your MySQL statement. At least I didn't have to.

Nov 21 '06 #6

"Jerim79" <my***@hotmail.comwrote in message
news:11**********************@h54g2000cwb.googlegr oups.com...
>
Jerim79 wrote:
>BKDotCom wrote:
Jerim79 wrote:

Oh, I am sorry. I thought this was a newsgroup about PHP. My bad.

how many times do we have to explain what mysql_query() returns?
You've started a few threads asking the same question.
Very similar mysql related questions have also been asked in just the
last couple of days.
I simply suggest you use your resources a bit better.
There's no shortage of documentation and examples.

Huh? I started another thread about IF/Then when using mysql queries.
Some code snippets were submitted. That situation has been resolved. As
far as I know, no one has explained what mysql_query() returns in any
detail that I wasn't already familiar with.

I think the statement "how many times do we have to explain what
mysql_query() returns?" is not only false, but irrelevant to my current
situation. I may post a lot, but I always keep new threads to new
issues. I use the existing thread to work on the existing problem. I
certainly understand the concern of flooding the newsgroup with the
same topic over and over. However, I feel that I have not done that.
You may think all my posts are all on the same topic, but I can assure
you they are not. Perhaps I haven't been expressive enough in
explaining my problem. My posts may be "simple" to advanced
programmers, but you can always choose to ignore them. You should never
discourage people from asking questions. I am a beginner and am running
across a lot of situations where I can't find anything on point for
what I am trying to do. Sure I can find "similar" posts, but nothing
that addresses my concerns. If you know of a post that is precisely on
point, please let me know , as I have yet to find one.

Okay, the problem has been solved. What I was trying to do was get my
variables from the HTM form into lower case. I would then search a
MySQL database for those values. My associate seemed to think the
database was case sensitive. So I was looking for a way to make sure
that the MySQL query converted everything to lower case. However, while
playing around with it, I got it to work, and didn't have to change the
MySQL query at all. It looks like the database stores the variables in
lower case to begin with.

I was able to run some test data through it, and it always returned the
correct value for the right data which was positive, no matter how I
capitilized it. Wrong data would return the correct value, which in
this case was a negative. So it seems that you don't necessarily have
to modify your MySQL statement. At least I didn't have to.
Sometimes the search **IS** case sensitive. I ran into that when the
database had a mixed case (like "Hound" and the search failed when I put in
"hound" -- or maybe it was vice-versa).

Shelly
Nov 22 '06 #7
Shelly wrote:
"Jerim79" <my***@hotmail.comwrote in message
news:11**********************@h54g2000cwb.googlegr oups.com...
>>Jerim79 wrote:
>>>BKDotCom wrote:

Jerim79 wrote:

>Oh, I am sorry. I thought this was a newsgroup about PHP. My bad.

how many times do we have to explain what mysql_query() returns?
You've started a few threads asking the same question.
Very similar mysql related questions have also been asked in just the
last couple of days.
I simply suggest you use your resources a bit better.
There's no shortage of documentation and examples.

Huh? I started another thread about IF/Then when using mysql queries.
Some code snippets were submitted. That situation has been resolved. As
far as I know, no one has explained what mysql_query() returns in any
detail that I wasn't already familiar with.

I think the statement "how many times do we have to explain what
mysql_query() returns?" is not only false, but irrelevant to my current
situation. I may post a lot, but I always keep new threads to new
issues. I use the existing thread to work on the existing problem. I
certainly understand the concern of flooding the newsgroup with the
same topic over and over. However, I feel that I have not done that.
You may think all my posts are all on the same topic, but I can assure
you they are not. Perhaps I haven't been expressive enough in
explaining my problem. My posts may be "simple" to advanced
programmers, but you can always choose to ignore them. You should never
discourage people from asking questions. I am a beginner and am running
across a lot of situations where I can't find anything on point for
what I am trying to do. Sure I can find "similar" posts, but nothing
that addresses my concerns. If you know of a post that is precisely on
point, please let me know , as I have yet to find one.

Okay, the problem has been solved. What I was trying to do was get my
variables from the HTM form into lower case. I would then search a
MySQL database for those values. My associate seemed to think the
database was case sensitive. So I was looking for a way to make sure
that the MySQL query converted everything to lower case. However, while
playing around with it, I got it to work, and didn't have to change the
MySQL query at all. It looks like the database stores the variables in
lower case to begin with.

I was able to run some test data through it, and it always returned the
correct value for the right data which was positive, no matter how I
capitilized it. Wrong data would return the correct value, which in
this case was a negative. So it seems that you don't necessarily have
to modify your MySQL statement. At least I didn't have to.


Sometimes the search **IS** case sensitive. I ran into that when the
database had a mixed case (like "Hound" and the search failed when I put in
"hound" -- or maybe it was vice-versa).

Shelly

It depends on the database definition. Searches are case sensitive if
the column is specified as BINARY; otherwise they are case-insensitive.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 22 '06 #8

"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:9q******************************@comcast.com. ..
It depends on the database definition. Searches are case sensitive if the
column is specified as BINARY; otherwise they are case-insensitive.
This was for a VARCHAR. I thought it unusual at the time, but was too busy
to investigate further. I just changed it to match and it worked.

Shelly
Nov 22 '06 #9

"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:9q******************************@comcast.com. ..
It depends on the database definition. Searches are case sensitive if the
column is specified as BINARY; otherwise they are case-insensitive.
On second thought, maybe my memory is failing me. It might have been an
enum.

Shelly
Nov 22 '06 #10
Shelly wrote:
"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:9q******************************@comcast.com. ..
>>It depends on the database definition. Searches are case sensitive if the
column is specified as BINARY; otherwise they are case-insensitive.


On second thought, maybe my memory is failing me. It might have been an
enum.

Shelly

OK, that makes sense. I believe enums are case sensitive. But
VARCHAR's which are not defined as BINARY should not be.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 22 '06 #11

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

Similar topics

13
by: Kristof Goossens | last post by:
Hi you guys, in the following insert the strtolower wont put the chars in lowercase. Any ideas what i'm doing wrong? the code: $qryInsRel = "INSERT INTO \"tblrelations\" (rid, vcfirstname,...
3
by: Mike Cocker | last post by:
Hello, I'm quite weak at PHP, so I was hoping to get some help understanding the below code. First off, I'm trying to create a "query form" that will allow me to display the results on my...
2
by: jaysonsch | last post by:
Hello! I am having some problems with a database query that I am trying to do. I am trying to develop a way to search a database for an entry and then edit the existing values. Upon submit, the...
13
by: Wescotte | last post by:
Here is a small sample program I wrote in PHP (running off Apache 1.3.31 w/ PHP 5.0.1) to help illustrates problem I'm having. The data base is using DB2 V5R3M0. The client is WinXP machine using...
8
by: san | last post by:
Hi, I wanted to know if this is possible and if so, how do I do it. Say, I have a query "SELECT * FROM Table WHERE Column="some_value". This executes on a very large data set and I would like...
0
by: Rob | last post by:
I doubt this is the best way to do it, but what I came up with was to hide the XML in an HTML Comment then edit the file deleting the HTML stuff and keep the XML results. If anyone has a better...
6
by: jjturon | last post by:
Can anyone help me?? I am trying to pass a Select Query variable to a table using Dlookup and return the value to same select query but to another field. Ex. SalesManID ...
2
by: AJ | last post by:
Hi all, I have this monster query (at least i think it is). SELECT c.ID, c.Company_Name, p., 1 As QueryNbr FROM (Company AS c LEFT JOIN Sale AS s ON c.ID = s.Company_ID) LEFT JOIN Package...
4
by: robert.szczepanski | last post by:
Hi everybody; I can't change polish sign to small letter. This is my php script: <?php setlocale(LC_ALL, "pl_PL.UTF-8") ; //this function return "pl_PL.UTF-8"
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.