Jump to content

Substr


ecabrera

Recommended Posts

ok so i wan to use substr but i gives me Warning: substr() expects parameter 2 to be long, string given in C:\xampp\htdocs\ede\index.php on line 48

 

here the code

 

<?php
include "staff/scripts/connect.php";

$query = mysql_query("SELECT * FROM headlines ORDER BY id DESC LIMIT 3");
$rows = mysql_fetch_assoc($query);

$author = stripslashes($rows['author']);
$date = stripslashes($rows['date']);
$picture = stripslashes($rows['picture']);
$headline = stripslashes($rows['headline']);

mysql_close();
?>
<h2 class="boxtitle">Latest Headlines</h2>
<?php do{ ?>

<div id="boxhome">

<img src="staff/headlineimg/<?php echo $rows['picture']; ?>" width="100px" height="90px" class="boximg"></img>
<div class="boxtitle1">
<font color="#A61E0A"><strong><?php echo $rows['title']?></strong></font><br>
<?php echo substr(0,$headline,6)?>
</div>

</div>

<?php }while($rows = mysql_fetch_assoc($query))?>
</div>

Link to comment
https://forums.phpfreaks.com/topic/260908-substr/
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.