Jump to content

php explode help!


jaylearning

Recommended Posts

hi thanks in advance for looking.

a

[quote]
<playlist version="1" xmlns="http://xspf.org/ns/0/">
<trackList>
<?php



  // Get the search variable from URL



  $var = @$_GET['/'] ;

  $trimmed = trim($var); //trim whitespace from the stored variable



// rows to return

$limit=1; 



// check for an empty string and display a message.

if ($trimmed == "")

  {

  echo "<p>error</p>";

  exit;

  }



// check for a search parameter

if (!isset($var))

  {

  echo "<p>We dont seem to have a search parameter!</p>";

  exit;

  }



//connect to your database ** EDIT REQUIRED HERE **

mysql_connect("localhost","cast",""); //(host, username, password)



//specify database ** EDIT REQUIRED HERE **

mysql_select_db("trailercast") or die("Unable to select database"); //select which database we're using





// Build SQL Query  

$query = "select * from phpizabi_video where processed=1 AND id like \"%$trimmed%\""; // EDIT HERE and specify your table and field names for the SQL query





$numresults=mysql_query($query);

$numrows=mysql_num_rows($numresults);



// If we have no results, offer a google search as an alternative



if ($numrows == 0)

  {

echo  sorry;

  }



// next determine if s has been passed to script, if not use 0

  if (empty($s)) {

  $s=0;

  }



// get results

  $query .= " limit $s,$limit";

  $result = mysql_query($query) or die("Couldn't execute query");



// begin to show results set







// now you can display the results returned

  while ($row= mysql_fetch_array($result)) {



  $title = trim($row['url']);




  }





    

// make a simple variabel 
$strflv = $title;

/* separating each word in previous 
variabel with explode() function, with double "greater than" sign as a delimiters */
$flvArray = explode("
", $strflv);

foreach($flvArray as $flv)
{
print "<track><location>".$flv."</location></track>";
} 



?>

</trackList>
</playlist>

 

 

output looks like this

 

<playlist version="1" xmlns="http://xspf.org/ns/0/">
<trackList>
<track><location>add.flv
</location></track>
<track><location>movietariler.flv
</location></track>
<track><location>add2.flv</location></track>
</trackList>
</playlist>

 

 

need it to look like this - other wise the flash player dont work..

 

<playlist version="1" xmlns="http://xspf.org/ns/0/">
<track><location>add.flv</location></track>
<track><location>movietariler.flv</location></track>
<track><location>add2.flv</location></track>
</trackList>
</playlist>

 

 

 

please can you tell me where im going wrong sorry im still learning....

 

(edited by kenrbnsn to change the

to


)

Link to comment
https://forums.phpfreaks.com/topic/74499-php-explode-help/
Share on other sites

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.