473,395 Members | 1,558 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

generating data problem

Hi!

I am working on script that ll generate some random data, ll need it later
on to fil db for testing.
but know to my problem, I have limited generation of data to different
char_sets depending on need, but
the generated data is mixing all char_sets and I dont se why , so actually
it's generates data on pwd condition, where all chat_set are allowed.
hope you can help!

<?php
function generateSign ( $var , $length ){

$charset_1 = "0123456789";
$charset_2 = "abcdfghjkmnopqrstvwxyz";
$charset_3 = "ABCDEFGHIJKLMNOPQRESTUVWXYZ";
$possible =""; //<-- I allways reset it to null (?)

if ( $var == 'num') {
$possible = $charset_1;
}

if ( $var = 'text'){
$possible = $charset_2;
$possible .= $charset_3;
}

if ( $var = 'pwd' ){
$possible = $charset_1;
$possible .= $charset_2;
$possible .= $charset_3;
}

if ( $var = null){
die('Use: text , num, pwd. In function');
}

$i = 0;
$password = "";
while ( $i < $length ) {
$sign = substr( $possible, rand( 0, strlen( $possible )-1 ), 1 );
if ( !strstr( $generatedData, $sign ) ) {
$generatedData .= $sign;
$i++;
}
}
return $generatedData;
}

$antal= 0;
while( $antal < 10 ){
$namn = strtolower( generateSign( 'text', '12' ) ); //<-- ll generate text
sting including numbers
$phone = generateSign('num', '8' );//<-- ll generate text sting including
char
$email = strtolower( generateSign('text' , '6' ) ); //<-- ll generate text
sting including numbers
$pwd = md5( generateSign('pwd', '4') );
echo $antal.' , '.$namn.' , '.$pwd.', '.$phone.' , '.$email.' <BR>';
$antal++;
}
?>

--
Thanx in advance
________________________

Nov 22 '05 #1
3 1321
oh sorry for even possting it.. hehe
didn't se misstyping.. = instead of ==
all works fine..
Nov 22 '05 #2
In article <op.sz6eydu4eel3e6@big>, no****@note.com (Carramba) wrote:
*Subject:* Re: generating data problem
*From:* Carramba <no****@note.com>
*Date:* Sun, 13 Nov 2005 12:16:51 +0100

oh sorry for even possting it.. hehe
didn't se misstyping.. = instead of ==
all works fine..

You're not the first, you certainly won't be the last...
- Steve
Nov 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ryan | last post by:
We have an MIS system which has approx 100 reports. Each of these reports can take up to several minutes to run due to the complexity of the queries (hundreds of lines each in most cases). Each...
3
by: Steve Dussinger | last post by:
Hi All: I am attempting to use an XSL stylesheet to take data from an existing DOM document, and place it into a different existing DOM document. The problem I'm having is that I get the...
10
by: Al Christoph | last post by:
Please forgive me if this is the wrong place to post this. The last place I posted got me a fairly rude response. I guess vb.db people just don't want to think about XML as database. At any rate,...
7
by: Mary | last post by:
Hi, I need some assistance with a query. To be honest, I'm not even sure it can be done. I'll try to keep the information limited to only what's relevant to what I have and what I am trying to...
1
by: louis_la_brocante | last post by:
Dear all, I am having trouble generating a client proxy for a webservice whose methods return a "complex" type. The type is complex in that it is a class whose members are a mix of primitive...
2
by: Simon Wittber | last post by:
I'm building a web application using sqlalchemy in my db layer. Some of the tables require single integer primary keys which might be exposed in some parts of the web interface. If users can...
3
by: deciacco | last post by:
I'm trying to write a label printing SDI app with a small preview on the main form itself. Every time I run the InvalidatePreview event on the preview control to redraw the preview I get the...
20
MMcCarthy
by: MMcCarthy | last post by:
This problem was proposed to me but not really my area of expertise so I thought I would open it up to the forum to see if anyone had any bright ideas. The problem is generating Microsoft Word...
0
by: Aswanth | last post by:
I'm Generating Reports in SSRS-2005.. Previously I got the Data from One Database & Generated Reports.. Now I used to get the Data from Two Different Databases(ie Database-1 & Database-2) & to...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.