By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,347 Members | 1,390 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,347 IT Pros & Developers. It's quick & easy.

substr value changes when submit to mysql

P: 28
Hello Guys,

Just wondering how I can make the substr value changes when submit into mysql.

something like:
someone typed A123456 on a blank field and submit into mysql. the Value will only display 123456 in mysql

Thanks a lot
Feb 14 '08 #1
Share this Question
Share on Google+
7 Replies


nomad
Expert 100+
P: 664
Hello Guys,

Just wondering how I can make the substr value changes when submit into mysql.

something like:
someone typed A123456 on a blank field and submit into mysql. the Value will only display 123456 in mysql

Thanks a lot
take a look at the substr() function

nomad
Feb 14 '08 #2

ronverdonk
Expert 2.5K+
P: 4,258
Hello Guys,

Just wondering how I can make the substr value changes when submit into mysql.

something like:
someone typed A123456 on a blank field and submit into mysql. the Value will only display 123456 in mysql

Thanks a lot
Most probable cause would be a mistake in offset value of the the substr() function. Starts at 0 (zero) and not 1 (one).

Ronald
Feb 14 '08 #3

P: 28
Most probable cause would be a mistake in offset value of the the substr() function. Starts at 0 (zero) and not 1 (one).

Ronald
something like?
Expand|Select|Wrap|Line Numbers
  1.  
  2. <?php
  3. substr=ltrim($sn,"A")
  4. ?>
  5.  
Feb 15 '08 #4

ronverdonk
Expert 2.5K+
P: 4,258
something like?
Expand|Select|Wrap|Line Numbers
  1.  
  2. <?php
  3. substr=ltrim($sn,"A")
  4. ?>
  5.  
That is not the SUBSTR() function, that is the LTRIM() function.
See the PHP documentation for a full description HERE

Ronald
Feb 15 '08 #5

nomad
Expert 100+
P: 664
take a look at the substr() function

nomad
for some reason some of my code was not posted.

you could do this
$test = "phpcoder";
echo substr($test, 3) ; //prints "coder"

nomad
Feb 15 '08 #6

P: 28
Issue Resolved, Here is the code
Expand|Select|Wrap|Line Numbers
  1. $Text = ltrim($Text, 'A');
  2.  
Feb 15 '08 #7

ronverdonk
Expert 2.5K+
P: 4,258
Anything that helps you out.

Ronald
Feb 15 '08 #8

Post your reply

Sign in to post your reply or Sign up for a free account.