Jump to content

how to get one by one element from array and store one by one in databse


rohan.bajaj17

Recommended Posts

[<?php

$f="F";

$Cnt=1;

 

$var=4;

 

$var2=$var;

$var1=66;

$var5=65;

 

$myarray=array();

 

if($var==100 || $var==200)

{

 

 

$var2=1;

 

 

$var1++;

echo$var1;

 

$var5++;

echo$var5;

 

}

 

 

 

 

 

 

 

if($var1<93)

{

for($s=$var5;$s<$var1;$s++)

{

 

$char=chr($s);

 

 

if($var2<100)

{

for($i=0;$i<$var2;$i++)

{

 

$String=$f.$char.$Cnt;

 

//echo $String;

array_push($myarray,$String);

 

//foreach( $myarray as $key => $value)

 

 

$keys = array_keys($myarray);

//$lastKey = end($keys);

//echo$lastKey;

 

reset($myarray); //Safety - sets pointer to top of array

$firstKey = key($myarray); // Returns the first key of it

 

echo "Key = ".$firstKey;

 

 

 

 

 

 

echo "<br>";

 

$Cnt++;

 

 

 

}

 

 

}

 

}

 

 

 

//break;

$Cnt=1;

 

}

//$flag=1;

 

 

?>

 

i already generated code like FA1 ...FA99 ....FB1 ...FB99 ...FZ1...FZ99.....i already stored in an array..u can see in above code. so i want to retrieve values one by one firstly fa1 and the fa2 and den fa3 and so on and fa1 store into database when i m trying to get keys one by one...bt it will print one key many times....

18712_.php

18713_.php

Link to comment
Share on other sites

Your code is unreadable because you've just slapped it on here with an abysmal explanation. I don't mean to be harsh but if you want help, first help yourself by taking the time to write a decent explanation, with examples, describing your problem.

 

Then, maybe, someone will answer appropriately and solve your problem. I personally can't even be bothered to look at your code at the moment.

Link to comment
Share on other sites

do you know the position of the exact data that you would like in a specific table field? is yes then run a foreach loop and catch the values into a variable.

$a = array(1,2,3,4)

foreach($a as $ab){

$c=$ab[0];

$d = $ab[1];

$e = $ab[2];

$f = $ab[3];

}

 

the save the vatriable c d e f in your data base.

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.