Friday, October 28, 2011

How to write arabic text in mysql and show it with php

 

The database, the tables and columns had been defined with

(mysql) CHARACTER SET utf8 COLLATE utf8_general_ci;


The server would send a header telling the browser to expect utf-8

(php) header('Content-Type: text/html; charset=utf-8' );

The HTML page contained the necessary meta-tag

(html)

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

And important thing to type this code after connection

mysql_query("SET NAMES 'utf8'");

 

Example:database “quiz” table “math” field “question”

 <?php header("Content-type: text/html; charset=utf-8");  
//SQL Connection Info - update with your database, username & password
echo "بسم الله";
$connection = mysql_connect("localhost", "root","" ) or die ('cannot reach database');
mysql_query("SET NAMES 'utf8'");
$db = mysql_select_db("quiz") or die ("this is not a valid database");
//Change this query as you wish for single or multiple records
$result = mysql_query("SELECT * FROM math") or die('Query failed: ' . mysql_error());;
while ( $row = mysql_fetch_array($result) ) {
echo("<P>" . $row["question"] . "</P>");
}
?>

Sunday, October 16, 2011

site for insert code in blogger

 

 

http://codeformatter.blogspot.com/2009/06/about-code-formatter.html

Using the AnimateColor effect to animate the background color of a RadioButton control in Flex 4.5

 

The following example shows how you can use the AnimateColor effect to animate the background color on a RadioButton control in Flex 4.5.

 <?xml version="1.0" encoding="utf-8"?>  
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
import mx.utils.object_proxy;
private function option_focusIn(evt:FocusEvent):void {
colorEffect.play([evt.currentTarget]);
}
private function option_focusOut(evt:FocusEvent):void {
colorEffect.stop();
evt.currentTarget.opaqueBackground="0xFFFFFF";
}
]]>
</fx:Script>
<fx:Declarations>
<s:AnimateColor id="colorEffect"
colorPropertyName="opaqueBackground"
colorFrom="0xFFFFFF"
colorTo="0xFF0000"
repeatBehavior="reverse"
repeatCount="0"
duration="500" />
</fx:Declarations>
<s:VGroup horizontalCenter="-264" verticalCenter="-214">
<s:Label width="100%" color="blue"
text="How many Pillars of Islam?"/>
<s:RadioButton id="option1"
label="2"
focusIn="option_focusIn(event);"
focusOut="option_focusOut(event);" />
<s:RadioButton id="option2"
label="3"
focusIn="option_focusIn(event);"
focusOut="option_focusOut(event);" />
<s:RadioButton id="option3"
label="5"
focusIn="option_focusIn(event);"
focusOut="option_focusOut(event);" />
</s:VGroup>
</s:Application>

 

Monday, August 15, 2011

Drag imag from list to another list

 <?xml version="1.0" encoding="utf-8"?>  
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<s:Panel title="Palette" left="8" top="8" >
<s:List id="paletteList" left="3" right="3" top="3" bottom="3"
dragEnabled="true"
dropEnabled="true"
dragMoveEnabled="true"
itemRenderer="spark.skins.spark.DefaultComplexItemRenderer" verticalCenter="0">
<s:ArrayList>
<s:Image source="@Embed('rec.gif')"/>
<s:Image source="@Embed('box.gif')"/>
<s:Image source="@Embed('start.gif')"/>
</s:ArrayList>
<s:layout>
<s:VerticalLayout paddingLeft="7" paddingRight="7" paddingTop="7" paddingBottom="7" gap="7" />
</s:layout>
</s:List>
</s:Panel>
<s:Panel title="Color List" left="136" top="8" bottom="8" width="555">
<s:List id="colorList" left="3" right="3" top="3" bottom="3"
dragEnabled="true"
dropEnabled="true"
dragMoveEnabled="true"
itemRenderer="spark.skins.spark.DefaultComplexItemRenderer"
styleName="drop">
<!-- we MUST have a blank array -->
<s:ArrayList></s:ArrayList>
<s:layout>
<s:VerticalLayout paddingLeft="7" paddingRight="7" paddingTop="7" paddingBottom="7" gap="7" />
</s:layout>
</s:List>
</s:Panel>
</s:Application>