Skip to main content

Simple search – result appears in the same page

This PHP code is a simple search example. It needs the user to enter a name and the PHP script will to the searching by the name provided by the user in the text box.

<form name='search' method='get' action=''>

Insert the firstname

<input type='text' name='txtname'>

<input type='submit' value='search name'>



//database connect


//checking database connection

if ($db==false) {

echo "Connect failed: ". mysqli_connect_error($db);



else {

echo "Connection successful";





from employee

where FIRSTNAME like '%$n%' ";



echo ("Query cannot be executed!<br>");

echo ("SQL Error : ".mysqli_error($db));



echo "<table border=1>";

echo "<tr>";

echo "<td>Employee no</td>";

echo "<td>First name</td>";

echo "<td>Last name</td>";

echo "<td>Department</td>";

echo "<td>Phone ext</td>";

echo "</tr>";


echo "<tr>";

echo "<td>".$rekod['EMPNO']."</td>";

echo "<td>".$rekod['FIRSTNAME']."</td>";

echo "<td>".$rekod['LASTNAME']."</td>";

echo "<td>".$rekod['WORKDEPT']."</td>";

echo "<td>".$rekod['PHONENO']."</td>";

echo "</tr>";



echo "</table>";





Post a Comment

Popular posts from this blog

Several English proverbs and the Malay pair

Or you could download here for the Malay proverbs app – English proverbs and the Malay pair Corpus Reference: Amir Muslim, 2009. Peribahasa dan ungkapan Inggeris-Melayu. DBP, Kuala Lumpur CTRL+F to search Proverbs in English Definition in English Similar Malay Proverbs Definition in Malay 1 Where there is a country, there are people. A country must have people. Ada air adalah ikan. Ada negeri adalah rakyatnya. 2 Dry bread at home is better than roast meat home's the best hujan emas di negeri orang,hujan batu di negeri sendiri Betapa baik pun tempat orang, baik lagi tempat sendiri. 3 There's no accounting for tastes We can't assume that every people have a same feel Kepala sama hitam hati lain-lain. Dalam kehidupan ini, setiap insan berbeza cara, kesukaan, perangai, tabia

Submit your blog address here

Create your own blog and send the address by submitting the comment of this article. Make sure to provide your full name, matrix and URL address of your blog. Refer to the picture below. Manual on developing a blog using and AdSense, download here … Download Windows Live Writer (a superb offline blog post editor)

Simple Calculator with Spinner – Android Code

This code is a simple code for Android application. It has two textboxes to receive two numbers (decimal), list of mathematical operations with +, –, * and /. Choose the operation, and hit the “Display result” button. You will see the answer to the at the bottom of the button. Have fun with Android.   The Manifest file <? xml version="1.0" encoding="utf-8" ?> < LinearLayout xmlns : android = "" android : orientation = "vertical" android : layout_width = "fill_parent" android : layout_height = "fill_parent" > < EditText android : text = "@+id/EditText01" android : id = "@+id/EditText01" android : layout_width = "fill_parent" android : layout_height = "wrap_content" > </ EditText > < EditText android : text = "@+id/EditText02" android : id = "@+id/EditText

Most used STRING functions in my PHP coding

These are my favourite string manipulation functions in my daily coding life. Dedicated especially to Web Programming students. Read them and have fun. Expect a happiness after a storm , and you’ll find your “inner peace”… This post is still in draft. I’ll update and refine with more examples that I’ve personally develop. More after the break…

Login JSON Android using Login Activity

I’ve been trying to release this tutorial quite a while. At last after a long hard effort. Since HttpClient is not supported any more in Android SDK 23, I have to resort to org.json.JSONObject and library to do online database with JSON. The objective of this tutorial is to log-in from a mobile client with the username and password stored in an online database facility. STEP 1: Create a new Android project, this time choose the LoginActivity .