[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



<a  rel="nofollow" href="http://us2.php.net/substr";>http://us2.php.net/substr</a>

Regards,
Jonathan Chum
Systems Developer
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A I S M e d i a , I n c . - &quot;We Build eBusinesses&quot; 
115 Perimeter Center Terrace, Suite 540
Atlanta, GA 30346 
Tel: 770.350.7998 ext. 502 / Fax: 770.350.9409
<a  rel="nofollow" href="http://www.aismedia.com";>http://www.aismedia.com</a> / jchum at aismedia.com 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


-----Original Message-----
From: ale-bounces at ale.org [<a  rel="nofollow" href="mailto:ale-bounces";>mailto:ale-bounces</a> at ale.org]On Behalf Of
Nathan J. Underwood
Sent: Tuesday, February 17, 2004 3:12 PM
To: ale at ale.org
Subject: [ale] [OT] PHP Question


Is there a way to say &quot;Just give me the first n characters of a string&quot; 
in PHP?  For example, if the string was &quot;johndoe&quot;, and I just wanted the 
first 3 characters, or &quot;joh&quot;?  I think I could do it with some kind of 
regex, but I can't seem to come up with one that works.  It will be used 
in a MySQL query when it's done, like the following:

$string = &quot;johndoe&quot;;
$newstring = justgivemetheleft3($string);

$query = &quot;SELECT * from table where name like &quot;$newstring%&quot;

I can't say give me everything that matches johndoe, because some of 
them are john doe, some are john_doe, some are john, etc.  But, the 
first 3 will always be right.
_______________________________________________
Ale mailing list
Ale at ale.org
<a  rel="nofollow" href="http://www.ale.org/mailman/listinfo/ale";>http://www.ale.org/mailman/listinfo/ale</a>


</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00567" href="msg00567.html">[ale] [OT] PHP Question</a></strong>
<ul><li><em>From:</em> lists at cybertechcafe.net (Nathan J. Underwood)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00568.html">[ale] [OT] PHP Question</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00570.html">[ale] [OT] PHP Question</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00570.html">[ale] [OT] PHP Question</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00571.html">[ale] ALE NW meeting Thursday</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00569"><strong>Date</strong></a></li>
<li><a href="threads.html#00569"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>