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