PHP Classes

substr and echo php

Recommend this page to a friend!

      Top level forums  >  PHP Specialists  >  General  >  substr and echo php  
Subject:substr and echo php
Summary:can you use a php echo in a substring in lieu of the string
Messages:4
Author:Greg Z
Date:2009-10-12 21:57:14
Update:2009-10-13 09:47:59
 

  1. substr and echo php   Reply   Report abuse  
Picture of Greg Z Greg Z - 2009-10-12 22:32:09
Hello. I'm trying to call up a mysql dbase item number for a substr to look at and evaluate (to alter product page titles for similar items in a large database). In the simple example below ... which is as far as I got, I meant to look at the item number and if it ends in 6, say it ends in 6. Of course, not working. If I just sub a numder for the php echo, it works, but not when I try the php echo. Is there an easy way to accomplish this, is my syntax just off, or ? Any help would be greatly appreciated.

Thanks.

<?php

if (substr(<?php echo $row_Recordset1['Item_Num']; ?>, -1) == '6') echo "Number ends with 6!";
else echo "Number doesn't end with 6!";

?>

There are 3 replies in this thread, which are not being displayed.
Browsing this forum thread replies is available only to premium subscribers.


Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum.