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
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..
?>

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.