Jump to content

[SOLVED] case sensitive


ngreenwood6

Recommended Posts

First let me explain what is happening. A user has input data into a database. I was trying to have this data pulled back up and have it

displayed. I have created a few rules. If the user doesnt put anything in, it asks them to. if it doesnt match anything tell them there are no results. the problem is that as i am testing this i put in a capital letter as the first letter and it wont find it. I have to search by using a capital. This is the part that tells it to match it (elseif ($get_lastname != $lastname)). Does anyone know how I can make it none case sensitive.

 

Here is my code:

 

<?php

 

//include variables

include ("variables.php");

 

//include the database variables

include ("db.php");

 

$mysql_connect = mysqli_connect($host,$db_username,$db_password,$db_name)

or die ("Could not connect to database");

 

//variable to send data to the database

$result = mysqli_query($mysql_connect,$getfrom_db)

or die ("Error: ".mysqli_error($cxn));

 

$row = mysqli_fetch_array($result);

$firstname = $row['firstname'];

$lastname = $row['lastname'];

$id = $row['id'];

 

if (!$get_lastname)

{

include ("index.php");

echo ("Please enter a last name!");

}

elseif ($get_lastname != $lastname)

{

echo ("There are no results, please enter a different last name!");

}

else

{

echo ("$firstname $lastname your user id is $id!");

}

?>

 

 

Thanks for all your help. Great community

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.