-
Posts
66 -
Joined
-
Last visited
Posts posted by 684425
-
-
not this because it generates alphanumeric random output and i want XY(random, unique integer, fixed length) = XY9162942 or XY6433389
Sorry i forgot to mention fixed length in previous post.
-
I am trying to create a registration form where users put their name, email and password only.
but i want to write an auto generated account number into database table for each user e.g; XY1234567 where XY should not change 1234567 auto generated random number and no duplicates (in numbers only).
example...
XY1234567
XY2345678
XY2233455
i found code
$num_of_ids = 10000; //Number of "ids" to generate. $i = 0; //Loop counter. $n = 0; //"id" number piece. $l = "AAA"; //"id" letter piece. while ($i <= $num_of_ids) { $id = $l . sprintf("%04d", $n); //Create "id". Sprintf pads the number to make it 4 digits. echo $id . "<br>"; //Print out the id. if ($n == 9999) { //Once the number reaches 9999, increase the letter by one and reset number to 0. $n = 0; $l++; } $i++; $n++; //Letters can be incremented the same as numbers. Adding 1 to "AAA" prints out "AAB". }
but its not working as i want. Any help please?
-
By using $_GET['r]
You will do another if/else statement to include the appropriate file.
You maybe better of creating a function so you pass $_GET['x'] and $_GET['r'] to it and it returns the path to the file(s) to be included.
Please guide me how to do this? If you can share an example?
-
<script type="text/javascript" src="clock.js">
That assumes "clock.js" is in the same directory as the actual script being executed, which is probably not the case. Use a full path to clock.js, or a URL, like src="/assets/js/clock.js" or "http://yoursite.com/assets/js/clock.js".<script type="text/javascript" src="clock.js"> <script type="text/javascript" src="tip.js">
both these files are in same directory along with index.php
tip.jis is working fine but clock.js don't work.
You said "you're using php for inline variables. You need to pass them through a parameter function instead"
how can i do this?
-
Edit: Oh I see, it's because you're using php for inline variables. You need to pass them through a parameter function instead if you want to use that js externally.
Any example?
-
Again, this is not a PHP problem. This is an HTML problem.
I am sorry i have posted it by mistake in php section. How can i correct it?
-
Code works when...
<script type="text/javascript"> var currenttime = '<?php print gmdate('F d, Y H:i:s', time() + (1 * 60 * 60))?>' var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December") var serverdate=new Date(currenttime) function padlength(what){ return (what.toString().length==1)? "0"+what : what } function displaytime(){ serverdate.setSeconds(serverdate.getSeconds()+1) var datestring=montharray[serverdate.getMonth()]+" "+padlength(serverdate.getDate())+", "+serverdate.getFullYear() var timestring=padlength(serverdate.getHours())+":"+padlength(serverdate.getMinutes())+":"+padlength(serverdate.getSeconds()) document.getElementById("servertime").innerHTML=datestring+" "+timestring } window.onload=function(){ setInterval("displaytime()", 1000) } </script>
Code not works when...
<script type="text/javascript" src="clock.js">
I want to use second option. Any help?
-
Someone suggested to use switch case but i don't know how to do it. any help?
-
The same thing in a site
<ul class="col-sm-2 col-sm-offset-2"> <li><a href="/">Home</a></li> <li><a href="https://secure.payza.com/login">Log In</a></li> <li><a href="https://secure.payza.com/signup">Sign Up</a></li> </ul>
The site is online.
-
I am using xampp.
<a href="/">Home Page</a>
The above code (when clicked in browser) takes me to the localhost instead of localhost/website
How can i clear this issue?
-
The answer is yes, but you need to associate whatever GET requests you want to the files you want to include in addition to other files or data (content in an array?)
because i am poor in english, maybe i didn't get what you exactly asked. but i will try to explain what i am trying to do.
URL from my last reply http://domain.com/x=account&r=news&id=345
so,
x=account (include account.php)
&r=news(include news.php within account.php)
&id=345 (get content from database and display)
The example given is similar, you could expand onto it in the same way.
i did copy that example and tried to modify it but failed. because i am new to php.
also i found a (mistake?) in your example.
//variable $pages not defined. //i changed $pages to $links and it worked fine. if (isset($_GET['x']) && in_array(trim($_GET['x']), $pages)) {
What i wanted is ...
<a href="get.php?x=news">get1</a> <a href="get.php?x=updates">get2</a> <?php $title = "Home | page"; if (isset($_GET['x'])) { if ($_GET['x'] == "news"){ $title = "News | Page"; include "news.php"; } elseif ($_GET['x'] == "updates"){ $title = "Updates | Page"; include "updates.php"; } } echo "<title>$title</title>"; ?>
but this is for GET x only. how can i add GET r ??
Is there a specific reason why you can't use a database? It's the best way to save and display data.
I am using a database dear. I have explained above.
-
So - perhaps you can re-write your question using the same terms throughout to make it clearer what you want to do
I did not know there is a time limit for editing a post. (misunderstanding sometimes because i am weak in english)
The question was, i want to make URLs like;
http://domain.com/x=account&r=profile
http://domain.com/x=account&r=news&id=345
http://domain.com/x=account&r=updates&id=567
x is used for navbar and r is used for any content on account page.
I asked that can it be done using php only.? without any database connection.
-
I did this to be a little safer using parameter values in an include
Thanks dear for your sharing.
-
You mention 3 links. Then you mention 3 URLs. What is the connection or isn't there one?
My mistake. links = hyperlinks = URLs
-
I have the following three links in same page.
http://localhost/folder/file.php?x=link1
http://localhost/folder/file.php?x=link2
http://localhost/folder/file.php?x=link3
i want to show URLs as they are...
link1 is to include a file named "x.php"
link2 is to include a file named "y.php"
link3 is to include a file named "z.php"
Can it be done in php only?
PS: its not about creating hash ids. and i want to do it without any sql db connection.
Account number help.
in PHP Coding Help
Posted
just random looking and unique, because a registered user will need that account number to login to his account.
if possible and if you guide me, i want to do it. please guide