Jump to content

how to insert this code...into database....


soryn4u

Recommended Posts

i have this code...

and i want to make it more dynamic....

<?php 
$content = $content[1].$content[2].$content[3].$content[4].$content[5].$content[6].$content[7].$content[8].$content[9].$content[10].$content[11].$content[12]
.$content[13].$content[14].$content[15].$content[16] 
.$content[17].$content[18].$content[19].$content[20].$content[21].$content[22].$content[23].$content[24]; 


$sql = mysql_query ("insert into database (content)  values ('$content')") 
               or die(mysql_error()); 
?>

 

 

for example... instead  content[1]. content[2]. content[3] ...etc... i want something like this.......

 

$content = $content[from 1 to  24];

or

$content = $content[from 1 to 777];

 

any solutions?

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/246296-how-to-insert-this-codeinto-database/
Share on other sites

the code works in that form...but i want a simple way...a dynamic way

 

for example i have this..

 

<?php
$number = 25;
for ($i = 0; $i < $number; $i++){
echo $content[$i] = $xml->data[$i];
}

//then i create this code...to be inserted into db

$content = $content[1].$content[2].$content[3].$content[4].$content[5].$content[6].$content[7].$content[8].$content[9].$content[10].$content[11].$content[12]
.$content[13].$content[14].$content[15].$content[16] 
.$content[17].$content[18].$content[19].$content[20].$content[21].$content[22].$content[23].$content[24]; 


$sql = mysql_query ("insert into database (content)  values ('$content')") 
               or die(mysql_error()); 


//but i dont like it... i want.... thist part  --------> $content = $content[1].$content[2].$content[3].$content[4] ---> to be dynamic..
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.