Jump to content

html inside function


jebadoa

Recommended Posts

Hi gurus,  I am just getting started in PHP and trying to figure this out.  I have a clip from a page that repeats in several places.  It would be good as a function, but it has html in it.  How do I deal with that?  Here is the code:

 

  <div class="panelScrollBox">  

 

<?php

$data = mysql_query("SELECT * FROM videos WHERE category='br'")

or die(mysql_error());

 

while($info = mysql_fetch_array( $data ))

{

?>  

<div class="panelDivider">

<a href="of.html"><img src="/images/<?php print $info['thumb']; ?>

" alt="ALTDATA" border= "0"class="panelVid" /></a>

<span class="videoTitle"><?php print $info['title']; ?></span>  <br />

<?php print $info['price']; ?> (Quicktime)

<strong><?php print $info['length']; ?></strong>. <br />

<a href="<?php print $info['buymovbtn']; ?>"

target="ej_ejc" class="ec_ejc_thkbx"

onClick="javascript:return EJEJC_lc(this);">

<img src="images/buyMOV.png" border="0"

alt="Add to Cart"/></a><br /><br />

  </div>

<?php

}

?>

</div>

Link to comment
https://forums.phpfreaks.com/topic/116609-html-inside-function/
Share on other sites

Thanks!  That works, and now I am trying to pass a value in so that it will select videos from a certain category:

      function displayVideos($cat)

   

and my query is

      $data = mysql_query("SELECT * FROM videos WHERE category='$cat'")

 

I call the function with:

<?php

include('sbfunctions.php');

displayVideos("pitching");

?>

but it displays videos from another category  ???

(not sure how you displayed code in blocks....

Link to comment
https://forums.phpfreaks.com/topic/116609-html-inside-function/#findComment-599611
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.