functions

You are currently browsing articles tagged functions.

Adding two array

To add a array with a array, you can use array_combine(),but to use this function arrays size must be same.
for example:

$array1=array(1,4,5,6);
$array2=array(A,K,M,P);
$array3= array_combine($array1,$array2);

//array3 will be
$array3=
array(
[1]=>A,
[4]=>K,
[5]=>M,
[6]=>P,
)

for more information you can visit php.net/array_combine

Related posts

Tags: , , ,

mysql_insert_id

mysql_insert_id() is a very usefull function..

what does it do ?

it returns id generated from previous insert query.

Could you give some example ?

mysql_query("insert into product (name) values(aflower)");
if you want to print id of "aflower" you can use mysql_insert_id
echo mysql_insert_id();

!: to use mysql_insert_id your cloumn should be an auto_increment cloumn

Related posts

Tags: , , ,