473,856 Members | 1,662 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to seperate values and place in array

424 Contributor

this is quite a simple question....I have generated 2000 passwords for an ebook, and i want to place them all into a database so that when a person purchases the ebook they are then lead to a page where they have to confirm their email address and will then be shown a password for the ebook. the passwords are called at random from a db.

instead of putting them in one by one i want to just copy and paste them (seperated by commas) into one textarea that once i submit the form php will seperate them by the commas and place them in an array to put into the database

what is the best method to do this? can someone point me in the right direction
Oct 8 '09 #1
3 2664
5,058 Recognized Expert Expert

Why do you generate the passwords ahead of time? Why not just create a random password when the user purchases the ebook and add it to the database then?

Or, better yet, have the user choose his own password.

Anyways, if you have a comma-separated list of strings, you can use explode to split them into an array, and then implode to re-assemble them.

A MySQL query to insert multiple values into a field should be:
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO `table`(`field`) VALUES('val1'), ('val2'), ('valN');
Oct 8 '09 #2
424 Contributor
im generating the passwords before hand because the passwords have to be including when the ebook is compiled.....th is is just a means to get the password to the person that buys the ebook.

unfortunately there is no other way to do it with the security features of ebook compilers.
Oct 8 '09 #3
8,658 Recognized Expert Moderator Expert
if you connect to your DB with a MySQL client, you can can bypass forms and PHP, for most clients support direct SQL execution.
Oct 8 '09 #4

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

Similar topics

by: TonyB | last post by:
Hi, I've searched the group and need more information and guidance on this issue I need to resolve next week. I work for the local school system and I am working on a way to parse a CSV file of class lists from MS Excel. It is a ~2MB file with all teachers and all their classes in it. I thought I would use Python to do this since many people I know tell me how great it is. The real sticking point is there are duplicates of each...
by: Sue Adams | last post by:
I have a form on an asp page and am trying to write the code to place the values of all checkboxes that have been selected, into an array. The checkbox values will be used in a dynamic sql statement to retrieve information from an access database, to be displayed ont he page. Since I''ve never worked with arrays before I''ve been running tests and displaying values on the next page to help me figure out my code. my array code reads like this:...
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) { document.images.src = eval("mt" +menu+ ".src") } alert("imgOff_hidemenu"); hideMenu=setTimeout('Hide(menu,num)',500);
by: JeffM | last post by:
Quick C# question: I have comma delimited values in a string array that I want to pass to seperate variables. Any tips on splitting the array? Thanks in advance! JM
by: dandorey1 | last post by:
I'm currently in the process of writing a realtime telephony application. I've designed it with a fairly simply plugin architecture. When I first started reading about this the general suggestion was to load each plugin in a seperate app domain. However performance is a large concern for me. Can anyone give me an idea of the performance impact I'm going to take if I do start using a different app domain? Many of these plugins will be...
by: sandy | last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory', within my class Directory (Can you already smell disaster?) Each Directory can have subdirectories so I thought to put these in an array. The application compiles but aborts without giving me any useful information. What I suspect is happening is infinite recursion. Each Directory object creates an array of Subdirectories each of which has an array of...
by: noddy | last post by:
I have a mysql table called Users The userID field values start at 100 and increment up from there I am trying to transfer values from this table into a javascript array Here is what the code looks like: <?php $queryUser = mysql_query("SELECT * FROM Users...etc $row_queryUser = mysql_fetch_assoc($queryUser); $lengthUsers = mysql_num_rows($queryUser) ; ?>
by: blitzztriger | last post by:
Hello!! how do i insert values into mysql , after parsing a submiting textbox?? I made the arrays, so this should be a basic insertion of them in the db, but something is missing, or in the wrong place...can anyone help me?? i didnt made anything in the VALUES (unless the POST ), because i bet the error is there (yes, the arrays are missing): $sql = "INSERT INTO dgplanets ( ID, coords , player name , alliance , name , ground , orbit ,...
by: lancewassing | last post by:
I'm hoping this question is simple. I am trying to create a login script for my already in place client manage using php. I have created a text file filled with usernames and passwords delimited by the "/" character. The file looks like this: lance/wassi norm /wassi amand/yandt aaron/willi miche/young i have an html form which uses the following code to post the userinput... this part works fine:
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.