PHP - Keep Zero In Front Of Digit?
This for loop:
for ($m = 01; $m <= 12; $m++) Will output: 1 2 3 4 etc. And NOT: 01 02 03 04 My question is: how can I make the number be 2 digits and have it output together with the ZERO? And when it's reaching the number 10 it should continue outputting: 10 11 12 And not 010 011 etc. Similar TutorialsHi :-) How can I align digit as you can see in the screen shot.
<?php function MaFonction($x){ for ($i=0 ; $i<=360 ; $i+=$x){ echo $i . " ==> " . deg2rad($i) . "<br />"; } } ?> <?php MaFonction(15 ); ?>
Thank you ;-) I know this should be easy.... However, to validate a 7-digit phone number, I wrote this: Code: [Select] <?php if(!empty($_POST['mobile_number'])) { if(!is_numeric($_POST['mobile_number']) || strlen($_POST['mobile_number']) != 7) { $errors[] = 'Please enter a 7-digit number without spaces or dashes for your <strong>Mobile</strong>.'; } else { $_SESSION['mobile_number'] = $_POST['mobile_number']; } } else { $_SESSION['mobile_number'] = ''; } ... but now I realise that numeric/integer validation won't work because where I am - in Ireland - mobile numbers can start with an initial zero, too. So, the following mobile numbers are possible: 0123456 0224466 How can I ensure that: each digit in the mobile number is numeric an initial zero is possible there are exactly 7 digits I suppose I loop through each digit, ensuring that that digit is numeric and break out of the loop if a non-numeric digit is encountered..? Any suggestions? TIA Below is my code... I'm new to OOP so forgive me if it's poorly designed. What i'm trying to do is make sure that asset_key never get's duplicated. So when time comes to insert a new record, i can rest assures that asset_key will not duplicate. For some reason $random_number never get's back a value; Code: [Select] <?php class Randomize { function createRN() { $num = rand(100000,999999); $sql = "SELECT * FROM mer_asset_header WHERE asset_key = '$num'"; $go = oci_parse($conn, $sql); oci_execute($go); $count = oci_num_rows($go); if($count = 1) $repeat = Randomize::createRN(); else return $num; } } $random_number = new Randomize; $random_number->createRN(); ?> I should also mention, that if the query finds that asset_key, it should also run createRN() again untill it gets a unique one. Thanks for the help in advance! Hi, in Mysql have a row with FLOAT 10,2 In form put the number 20.20 and after reload in form show: 20.200000762939 Hey, If i have a string which contains numbers and symbols... such as 1:2:4 (its not always : for the symbol it changes) Is there a function that can convert the numbers that are 9 or less to have a 0 infront of them such as: 01:02:04 (also this is not timestamp format - just normal strings) This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=311051.0 Front end web developer and a application developer?
is one better than the other?
also is getting a 1 year certificate in one of the above with lots of experience in relation to designing and coding land someone a job in this field?
Is a degree nessesary right now? in order to get a job in one one of these fields or can one do that part time wile working but holding a certificate in one of these fields with freelance experience
What does it mean Like.. !@file_get_contents('url'); or.. !file_get_contents or @file_get_contents hello , could anyone please point me on how can i read the data i input from an html page to appear on the mysql front server. ive print screen my problem this is the signup page ,where i input the user name and password here's the signup page html code """<html> <head> </head> <body> <h1>Personal Info</h1> <form name="form" method="post" action="SignUp.php"> <p>UserName:<input type="text" name="usrn" /></p> <p>Password:<input type="password" name="pass" /></p> <p><input type="submit" value="Sign Up"/> <input type="submit" value="Clear" /></p> </form> </body> </html> """"" and this is the mysqlserver ,where i want the username and password i entered to show here's the php code i wrote """"<?php $usr=$_POST["usrn"]; $pass=$_POST["pass"]; $db=mysql_connect("localhost","root",""); mysql_select_db("realestate",$db); $q="insert into Customer Values('$usr','$pass')"; mysql_query($q); mysql_close(); ?>""""" i would really appreciate any help from you guys. Thank you. Code: [Select] <?php if(isset($_SERVER['PHP_AUTH_USER'])) { echo "<a href='schedule.php'>Request A Skype Session</a>"; } ?> works great for someone that islogged in my htpasswd, however, I would like to hide Code: [Select] <a href="/members/index.php">Login</a> if they are logged in, how do i go about doing the opposite of the first code i linked...sorry if it sounds complicated This is driving me nuts and I'm hoping someone can help me figure it out. I have a site with PHP/MySQL. I have a form where people can submit a comment. This comment then goes into a MySQL database and gets displayed back on another page of the website. NOTE: I put this question in the PHP Forum because I think the problem is happening somewhere BEFORE the info gets entered into MySQL. But of course, I could be wrong. The problem is that some of the comments are coming in with a "\" in front of apostropes, but NOT ALL OF THEM (which is really confusing me). For example, someone entered this comment which shows in the MySQL database exactly like this... I predict Lena's gonna win a lifetime Grammy. It's long overdue. Someone else entered a comment which shows in the MySQL database exactly like this... can\\\'t wait to see first pics of the next addition. Congrats! They both have apostrophes in them, but only that second one added those slashes (and 3 of them for some reason). There are more instances of this where some comments have the slashes before the apostrophe and some don't. Anyone know what might be causing this seemingly random insertion of slashes? Is there a way to trim everything off in front of the last backslash in the string? Code: [Select] $trimFile = $fList[$i]; Example: In this path: \\\\myftp/downloads/tom/work/word_docs\\legal\test.pdf I only want to display test.pdf. Thanks, Jake Hi, I am trying to get my contact form from page into header. I have been at his for days now, I can get the contact form into the header with this <?php echo do_shortcode( '[contact-form 1 "Contact form 1"]' ); ?> but can not get it to sit centrally and in front of image.
This is my site, http://www.cloudchasing.co.uk/
The site style that I am trying to emulate is this one http://www.premierwi...screens.co.uk/
Pleeeease help a newcomer
This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=330652.0 Guys: What is the way to remove white spaces in front of a form entry ? Should I use regular expression for this ? Thanks. This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=325383.0 Sample array: array('one','two','three','_zero'); How could I sort this array so that _zero moves to the front.. Any items that begin with an underscore should be moved to the front of the array to get something like so: _zero, one, two, three Thanks This is a two parter... mostly a discussion as I am currently not employing the purpose of these "things"
I am creating an autoparsing webapp that has unlimited use... whatever a person can think of
It accesses camera, microphone, gyro/accelerometer, flash etc... mostly it takes in data and does something to it according to the parsing tool
I'm not saying this is new, in fact I spent a while using Touch Develop which is a scripting "thing" by Microsoft, the problem was lag
That is another thing that concerns me, without web access the web-app is useless right? So I'm wondering if it is possible to copy your current setup and either translate it to the mobile languages like Java, C#/XML, Objective C or somehow a platform independent alternative
Anyway...
I'm not sure if I can access front end code, like <div class="whatever"> safely using injection
Well injection you just bind parameters but what if the incoming string is literally malicious ?
Also as far as autoparsing optimization goes, what I mean by that is
I intended to create a character by character comparison, obviously or at least to me, starting with easier stuff first like
for example a link is entered
http://www.something.com
then the autoparser compares each character one at a time from left to right
|1|2|3|4|5|6|7|8|9|10|
|h|t|t|p|:|/|/|w|w|w|...etc...
But I would check for existing formats starting with the shortest first and also checking from right and left, eg. .mp4 is obvious as a file type
I'll have more once I actually know what I need just looking to discuss I suppose... sorry if that is not appropriate feel free to delete this thread
In the future the users who have modified their personal accounts would benefit from an "AI" thing that is specific to their personalities based on what they have enabled
Edited by greenace92, 28 December 2014 - 09:37 AM. Hi I am new to php, I am trying to capture the url and place into a variable but I only get the 1st digit to show, I just cant see what I am doing wrong. Sorry to ask such a basic question but I just can't work it out, I have attached a screen shot of all me code, your help would be very very much appreciated. How can I make sure that when I submit an new form and new ID (record) is created it is always 4-Digits. record 14 = 0014, record 225 = 0225. Thanks |