how to insert arabic text in mysql

Step-1 Create database table

CREATE TABLE <code>language_messages</code> (
  <code>lang_id</code> int(11) NOT NULL auto_increment,
  <code>en</code> varchar(500) NOT NULL,
  <code>ar</code> varchar(500) NOT NULL,
  PRIMARY KEY  (<code>lang_id</code>)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=8 ;

INSERT INTO <code>language_messages</code> VALUES (1, 'About Us', 'من نحن');
INSERT INTO <code>language_messages</code> VALUES (2, 'Contact Us', ' تواصل معنا ');
INSERT INTO <code>language_messages</code> VALUES (5, '', 'శ్రీనివాస్ తామాడా');

Step-2 create connection

$conn=mysql_connect(HOST,DB_USER,DB_PASS) or die(mysql_error());
$db=mysql_select_db(DB_NAME,$conn) or die(mysql_error());
mysql_query("set character_set_server='utf8'");
mysql_query("set names 'utf8'");

Step-3 View output in HTML page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--<html dir="rtl" lang="ar" xml:lang="ar" xmlns="http://www.w3.org/1999/xhtml">-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>

<body>

<?php $sql = "select * from language_messages"; $res = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_array($res)) { echo" ". $row['en']; echo" ". $row['ar']; } ?>
</body>
</html>

Facebook style ‘see more’ text onclick using php, mysql, Ajax and Javascript

Must Read : Facebook style ‘see more’ text onclick using php, mysql, Ajax and Javascript

This is small implementation in the last tutorial, as we discussed in the last tutorial, we know how to make insert and fetch data from database without refreshing the page, here i’m going to show you that, if i’m entering more number of data or texts in the field that will be shorten and make see more link, and to extract the full view of text, we have to make javascript hide and show concept for that, let see how i made it, in this. If you want to get clear idea from this you must have to see the previous tutorial i.e Insert and view data without refresh using PHP, MySql and AJAX.

most of them searching this concept to implement to their personal purpose. here i’m going to show you that, actually this is very very simple method. i did here. for this you must have to see the last tutorial. here i’m just showing you that how make see more button that’s it.
this concept is mostly used for going out of overflow, for that. made limited text only have display in the page and make see more or read more link for that. here i’m using Toggle concept to make this technique.
As we discussed in the last tutorial. we have to use 3 files to that, they are
  1. DB.PHP
  2. INDEX.PHP
  3. ACTION.PHP
here i’m going to made some small changes in the ACTION.PHP alone. let see the changes

ACTION.PHP

refer the previous tutorial for more file datails. and we must have include Jquery min file.

Refer the previous tutorial ACTION.PHP file details to get clear idea in that.  here i just made small changes in <div class=”showbox”> </div>. in the last tutorial i just echo the row data in that for small view of all data. here i’m using substr to show limited text form 0 to 25 letters, and php if condition with strlen for stringlength greater than 25 means make this link else default view.
and you must have to make call from the id so you have make class with the name of id.

for you clear idea. i just made CSS in the same line.

Autocomplete search using php, mysql and ajax

Must Read : Autocomplete search using php, mysql and ajax

We know what is autocomplete in input type, that is make some predefined entered texts come under the input type box, while focusing on the input type, similarly we are searching some content from mysql database, this actually facebook style search concept to suggest some data for select before we get the exact search, for that we are using this kind of search, and this is very simple to make search in php, mysql with ajax and jquery. let see it in brief.
as like you see in the above image, the search will be comes like that by using php, mysql and ajax with jquery.
DATABASE DETAILS
database name–>wearecoders
table name –> autocomplete
column names –> id, name, email
DB.PHP

the above is database file.

INDEX.PHP

just give this input type only in index page with AJAX. you can see the ajax coding below here that is also comes in index page

AJAX

the above all for make action in SEARCH page with out refreshing the page.

SEARCH.PHP

that’s it. as like the usual fetch from database with like and here we are just adding str_ireplace, that’s it. and other thinks are as like we know, that is very simple one. let’s try this. and each of our entering text that wil comes as in strong letter.

Activate and deactivate concept using php and mysql

Must Read : Activate and deactivate concept using php and mysql

This is the concept for activate and deactivate the account or user to display in the page. that’s why we are using this coding. this concept is known by all like block or unblock the user or some other thing. here going to show you that how make activate and deactivate the accounts. this is what using in the most of the social media and more other user management sites are need this concept. let see the details about the coding and some other things.
this concept is whether we have to display the details of it or not. here i’m showing that in a single page. how to make activate and de-activate the accounts. this concept should not display the details of user and any of the product details in the page when you deactivate the account. let see what are all needed to do that.
FILES :
  1. db.php
  2. index.php
  3. action.php
the above three files must be needed to do this action.
DATABASE DETAILS :
database name : wearecoders
table name : tablename

column names : id, detail, status

here the status is important, because there only the action should be performs. the status must be 0 or 1. 1 means the product is in active state. 0 means not active state.

DB.PHP

INDEX.PHP

in an achor tag we just give a link to id of status and used onclick function to activate and de-activate concept. if the status is 0 means activate and 1 means de-activate.

ACTION.PHP

In an action page. make the condition in if statement. and use update coding for make activate and de-activate concept. just make 0 and 1 condition.

Simple Login logout system using php

Must Read : Simple Login logout system using php

Login and logout system is the most important thing for the user management, session management is one important thing for manage the user for the whole time of login time. for that we have to use session for this. it should have 5 files for this. we have to fetch the same value for the user and check the session and register the session value. and make destroy for logout. let see it detail,
it should need 5 files for this login-logout system, they are
  1. login/index page
  2. datafetch/usercheck page
  3. session/check page
  4. welcome/profile page
  5. logout page

the above files must me needed for this. we can named it as our wish. let see what i done here.

database name –> wearecoders
table name –> login

DB.PHP

INDEX.PHP

in the index page we have to start the session, as the above mentioned. action is performed in login.php page.

LOGIN.PHP

if the session is registered then go to check the profile.php page there session.php file is included so the session is checked.

SESSION.PHP

check the session value is correct or not. if the session is value is not set, then again redirect to index.php page.

PROFILE.PHP

assign the logout.php page in the profile.php page.

LOGOUT.PHP

in the logout.php page, we should unset or destroy the session value as the above you seen. then locate to index.php page.
and we should have to start the session in all the page.

Marquee style in different manner with PHP and MySql

Must Read : Marquee style in different manner with PHP and MySql

Marquee style scroll using in different manner, such as top to bottom, bottom to top, left to right, right to left, and scroll speed control, like all those details we are going to discuss here. usually all web developer must this tag that is marquee tag, which this marquee tag is used for the purpose of make the small kind of head line or make important thing in the particular area using marquee scroll style, similarly here we are going to discuss the thing about marquee tag with Php and Mysql.

marquee tag is used for more purpose, like top news publishing with marquee scrolling and more frequently publishing news or some other all things are scroll in a particular area, for that here we are using the marquee tag.

STOP / START

Marquee start and stop is the one main function most of us searching this thing, how is it happens on mouse hover. see the code.

onmouseover=”this.stop();” for stop the marquee content on on mouse over, onmouseout=”this.start();” for start the marquee tag content on mouse out.

MARQUEE DIRECTION

Marquee direction is for make the marquee move direction, the moving of marquee tag is move towards to which direction, like left to right, or right to left like that. for that we are using that marquee direction tag. see the code.

choose any one direction in the above direction like left or right or up or down any one direction.

MARQUEE SPEED

Marquee  speed how reduce and increase the speed of marquee tag moving. see the code.

that is scrollamount=”5″ we can give any number value for that, when you increase the value of scrollamount the speed will be increased, when you are reducing the scrollamount the speed will be decreased.

PHP and Mysql FETCH FROM DATABASE

Database name –> wearecoders
table name –> marquee
column names –> id, feeds

you can clear with the above coding, just fetch data from the database, which is from marquee table, * astrick is for select all the field from the table name. and make the coding with simple.