473,782 Members | 2,419 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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($qu ery) 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=strtolo wer($result);
Also changing the query to read LNAME=strtolowe r('$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 4947

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

RTFM!

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

$result = mysql_query($qu ery);
$rows = array();
$num_rows = mysql_num_rows( $result);
for ( $i=0; $i<$num_rows; $i++ )
$rows[] = mysql_fetch_ass oc($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($qu ery);
$rows = array();
$num_rows = mysql_num_rows( $result);
for ( $i=0; $i<$num_rows; $i++ )
$rows[] = mysql_fetch_ass oc($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.goo glegroups.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.goo glegroups.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
programmer s, 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*******@attgl obal.net
=============== ===
Nov 22 '06 #8

"Jerry Stuckle" <js*******@attg lobal.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*******@attg lobal.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

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

Similar topics

13
2515
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, vclastname, vccompany, vcfunction, nlangid, ngenderid, nuserid, ntitleid, dtbirthdate, vcbankaccount, vcvatnr, vctraderegisternr)
3
3957
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 screen. I grabbed this code from the net hoping that I could tweak it for my needs. I'm using MySQL, PHP and IIS and they all are running fine. As the code is, it will display the form, but it won't display my result(s). Any suggestions? Cheers,
2
3435
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 new values are updated in all corresponding tables (the function of the pages in question). However, on the page that does the DB update, I also want to do some checks on the data before performing the update. Now, the problem that I am...
13
2734
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 the iSeries Client Access Driver ver 10.00.04.00 to connect to the database. The problem is that executing the exact same SQL select statement more than twice int a row stops produces results. The first two instances will always produce the...
8
3706
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 to return the results as they query executes rather than wait for the whole query to execute. Basically, I want to get the results as they are prepared by the database. Any way to do this?
0
1906
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 solution, I would be interested. Thank you. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim cmd As System.Data.SqlClient.SqlCommand cmd = New System.Data.SqlClient.SqlCommand
6
4849
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 SalesManName AT Alan Time
2
1657
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 AS p ON s.Package_ID = p.ID
4
3689
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
10313
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
10147
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
10081
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
8968
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
6735
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5378
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...
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2875
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.