Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MYSQL


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Random Password Generator?


I have 3 tables as follows:

Lesson:

lesson_id | lesson_name |
-------------------------|
1 | Lesson One |
2 | Lesson Two |
3 | Lesson Three |
4 | Lesson Four |
--------------------------

student_lesson:

lesson_id | student_id |
----------------------|
1 | 44 |
1 | 45 |
1 | 46 |
1 | 47 |
----------------------|

class_lesson:

lesson_id | class_id |
-------------------|
1 | 901 |
2 | 902 |
3 | 903 |
4 | 904 |
-------------------|

The following query:

SELECT crs_lesson.lesson_id, lesson_name,
count(crs_student_lesson.student_id) AS student_count,
count(crs_class_lesson.class_id) AS class_count
FROM crs_lesson
LEFT JOIN crs_student_lesson USING (lesson_id)
LEFT JOIN crs_class_lesson USING (lesson_id)
GROUP BY crs_lesson.lesson_id

Produces the following result:

lesson_id | lesson_name | student_count | class_count |
------------------------------------------------------|
1 | Lesson One | 4 | 4 |
2 | Lesson Two | 0 | 0 |
3 | Lesson Three | 0 | 0 |
4 | Lesson Four | 0 | 0 |
------------------------------------------------------|

This shows that the second count is always set to the same value as the first count even though the values should be different.




View Complete Forum Thread with Replies

Related Forum Messages:
Random Password Vs. User Created Password For Site Login
Are there any security issues or other concerns that make one preferable? The client is pushing for user created passwords.

I'm mapping out the basic functionality and front-end for a MySQL/PHP back-end that will be completed by a third party. I'm a novice to MySQL but familiar with PHP and their interaction. Mainly looking for anything to support one method over the other.

View Replies !
SQL Generator
I order data in an excel sheet, export via an old fashioned sql generator I have, and then import to mysql DB
I am looking for any good (even paid) SQL generator. Know any?

I found many via hostscripts.com and download.com but none of them worked as expected, or was easy to manage for me. I can't remember all the ones I tried, but I really tried many. I would appreciate it if you would kindly share your experience on this.

View Replies !
PHP Generator On Mac
some software for mac that can generate php scripts for managing mysql databases?

For windows there is the great phpmaker, high configurable, and can generate a customized web application for update the database, but there isn't any mac version.

View Replies !
Data Generator
Does anyone know of a free data generator to populate a mysql database with some test data?

View Replies !
The Best Mysql Report Generator
what is the best way to generate reports for Mysql
db.
Please name the software or application.

View Replies !
Relationship Diagram Generator?
just wondering if I could mysqldump a schema from a exsiting database, is there any relationship generator that can help me to get a diagram of how the tables are related?

View Replies !
Mysql Interface Generator
I wanted to know if there are any program that generates a webpage with the forms to insert data into the db.

Example: I have a table with {id, url, desc}
The program must generate a page with text fields to enter this information.

View Replies !
FreeWare Data Generator
Is There any of you know some 'freeware' data generator for mySQL out there?

View Replies !
Automatic Form Generator
Does anyone know of a free software package that would query the schema of a MySQL table and automatically (or interactively) generate a PHP web form for querying/inserting/updating rows of the table? I've done some googling for this and the closest free thing I found was something called Xdobry that was too confusing and badly translated from German.

View Replies !
Scribe Report Generator For MySQL And Other RDBMS
We are looking for beta-testers for our new product - Scribe Report
Generator. At this moment, Scribe supports 6 relational databases, including
Oracle, MS SQL Server 2000, and Sybase.

Very briefly: Scribe is written in Java, is based on visual programming and
can be extended by adding user-written Java classes; it comes with the API
library to let other Java-based apps run Scribe reports programmatically.

The details are on our website: www.gestalt.com/Scribe (temporary location).

User: guest
Password: star

We offer a free license to everyone who provides us with a feedback on bugs,
inconsistencies, or constructive criticism that helps us refine Scribe.

View Replies !
Random Rows, Non-random Ordering
Normally to select random rows from a table I'd do something like:

SELECT field1, field2, RAND() AS random
FROM mytable
ORDER BY random
LIMIT 5
Unfortunately, this time I need 5 random rows sorted on a different field:

SELECT field1, field2, RAND() AS random
FROM mytable
ORDER BY field2
LIMIT 5
Is there a way that I can still sort by field2 and yet still select 5 rows at random? Could the former query be run as a subquery and then a second ORDER BY clause run on those results? Worst-case I can re-sort the results in my host language, but a pure SQL solution would be best I think.

Bonus points if the answer can always put a particular row first in the results.

View Replies !
Password :: Enter Password, System Beeps And Window Disappear
Whenever I type in mysql password in the command prompt, where it says: Enter password, the system just beeps and the mysql window disappears.

View Replies !
Move Site To New Host Now Password($password) Does Not Work
SELECT & FROM members WHERE username = '$USERNAME' AND password = password('$password')

View Replies !
Mysql Password() & Unix Crypt Password...
I am creating a user administration system where system administrator
can activate services for a user, like webspace, a mail account or a
subdomain.

I now want to create a function that creates mysql databases and grant
the right privileges to a user. But the problem is that mysql wants to
have the plaintext password for the user in the "grant ... identified by
'pwd'" field, or in a manual query to update the password in the
mysql.user table with PASSWORD('pwd').

I have another database which holds the passwords for the users, these
password are stored the moment a user signs up and are used to activate
services, for example ssh access to the machine. The stored passwords
are encrypted using crypt(). So for adding a ssh service to a user, I
simply do echo "$user:$pwdhash" | chpasswd -e.

I have chosen crypt because some programs (like proftpd) don't take md5
sums.

The problems is that I don't have the plaintext password. So I cannot
add a mysql db.

So I need to create a user in mysql with a crypt password.
I tried to just "grant all privileges ... identified by 'nothing'"
and then afterwards update the mysql.user table and putt the crypt
password in there but it doesn't work like that.

Does anyone have any idea on how I could fix this, how can I create a
user in mysql without having his plaintext password and only having a
crypt hash of it.

I thought about not only storing a crypt hash, but also an md5 hash and
a mysql PASSWORD() hash.. but I think that's an ugly solution.

View Replies !
I Can Connect With Db Password Or Blank Password
I have a password setup for root (% and localhost) in Mysql 5.0.26, I can connect ok no problem. I can also connect with blank password! I know it is checking the password cuz it fails if it's wrong.

I'm sure I have only one account as well (tried to delete, recreate, etc... no change)
select * from user where user='root';
| localhost | root | *F3AD8B3C44772C17F66767F29D948D9C255BD824 | Y ...
| % | root | *F3AD8B3C44772C17F66767F29D948D9C255BD824 | Y ...

Is there an option to accept blank password!? I have this problem only for root user; Other accounts are fine.

View Replies !
Password :: Obtain Password To Database
How can I easily obtain the password to a mySQL database? Its mine, its on my server, and I have mySQL installed.

View Replies !
Password :: Change Password
I have trixbox 1.2.3 running and in freePBX it told me I need to change the password in mysql. I went into mysqladmin and privileges. I updated the passwords for a2billinguser and root.

Now I am denied from access to mysql and all services that use mysql don't work. How do I restore the default that trixbox used. I have a very large major system here and cannot just blow it away.

View Replies !
Password :: How To Get Root Password
Is there anyway of knowing the root password of a MySQL database?? I know we can change the root password to a new one, but I want the root password of an existing database. Is this possible?

View Replies !
Random Row
I am trying to get one random row at a time. Right now I am using this SQL:

Code:

SELECT * FROM `trtrack` ORDER BY RAND( ) LIMIT 0 , 1

But it's really slow, some queries taking up to .5 to 1 second. Is there any other way? I use PHP.

View Replies !
Add A Random Value
in php, this would simply be rand(1,5)
in mysql, I tried

update `table` set column=(column+rand(1,5));

but that was not a correct guess.
how can I add a random value of 1 digit bt x and y?

View Replies !
Sql Random Pwd
i read somewhere that it is not safe to use a mysql randomly generated password . I have a table with many records and want to reset everyone's password to a random alpha-numeric password.
What is the best way to do this one ? something using a php random pwd and then update the table ? or there is something better than that ?

View Replies !
I Changed Root Password But I Can Not Login With Changed Password
I changed the password of root with
update user set password=password('newpassword')

Then I exited. But when I want to login again , it cannot authenticate the root
I should tell you that a hacker had changed my root password before. Because it was not encrypted before.

View Replies !
Random Select
When I do a select with a limit I get always the same records. Usually this
is the desidered effect. But now I want to do a random select. So every time I do a select I should get a different set of results. What is the best way to achieve this effect?

View Replies !
Random Images
is there sombody who can helpme witht he following, i am ''pretty new'' to
php and am looking for a script to show images randomly at a 10/ 15 seconds
interval.

View Replies !
Random Number
I have a list of email addresses in a text file.
I want to create a table and have them added to a new table with 3 columns/fields - ID, Email, and UID

ID - Integer - auto increment
Email - varchar 40
UID - Unique random value 15 characters (varchar)

How do I get the UID added such that it is random and unique.
Can MySQL do this?

View Replies !
Checking For Random ID
Let's say that I generate a randon id using this method (if there is a better one, please post it):

$id = sha1(mt_rand(1, 500));

If it is crucial to make sure that this does not exist in the database (let's say I need a million of these in my database, and not a single one can be the same as another), how would I check that?

Do I just retrieve all the ids from the table and compare them to the newly generated one? What is the impact on resources/speed?

View Replies !
Generating Random
I have a database set up and all I need to do is make a field with just something random for each entry that is already in the database. Something just 5 numbers and/or letters is fine. How would I go about doing this?

View Replies !
Select Random Row
I have read that

"select * from table_name order by rand()" will gives poor performance when there are thousands of rows in the table. Does the same holds true even if there is a where condition (returns only hundres of rows at most)?
For example:

"select * from table_name where col1=2 order by rand()". If I have thousands of rows in the table but the where condition limit it down to couple of hundred, will this query still gives bad performance?

View Replies !
Random Index
Is there a way to display search results in random order?

View Replies !
Random Join
What is the best way to randomly join 2 tables?

table "users" contains a list of unique User IDs.

table other_user_data contains a list of User IDs (and other fields) that do not match the user IDs in the first table. There can be multiple rows per user ID in other_user_data.I would like that every time i run the query, the users in the users table should be matched with any other user in the second table and return users.user_id and multiple rows from other_user_data that "match".

View Replies !
Random Order
Suppose I have a table with 10 records in it.
I can select them with either ascending or desending order. Is it possible that I can select them in random order, so sequences is different each time?

View Replies !
Random Output
is there any way to do a mysql RANDOM output? Like e.g. if I got a table and I want to have every row displayed of the table, but by random (changing whenever you look at it), but every entry being displayed once

View Replies !
Random Record
I have a table that has several hundered rows with one column being "LastRated", a DATETIME field.
Currently I am pulling a random record from this table with:

SELECT * FROM tblImages ORDER BY Rand() LIMIT 1

Is there anyway I can re-work this query so that it is much more likely to pick on of the records with an older LastRated?Even if it were to only randomly pull a record from the 50 oldest LastRateds that would be fine.

View Replies !
Random Topic
www.habbomedia.ca/topic. I made that using php and html but what i want to do is add theinto different tables, one english and one chinese, etc... and they are acessed by a php file example english.php, that reads only the english table's words and displays a random on upon each refresh.... is this possible?

View Replies !
Random Rows
I understand the preferred way to select random rows is as follows:
SELECT * FROM tbl_name ORDER BY RAND();
my problem is, I also need "order by" to sort the results in alphabetical order. how can I do both?
in other words, let's say I have 200 rows. I want 30 randomly selected, but I want those 30 alphabetised.


View Replies !
Random Ports
mysql 5.0 was working fine in Debian "etch".

Then I installed awstats, which changed something somewhere and now the server starts on a random port. However, no clients can FIND it! How do I resolve this issue?

View Replies !
Get REALLY Random Records
I've been using this as the alternative to RAND() which is damn slow on tables with lots of records:

SELECT t1.id, t2.id AS t2ID
FROM table1 AS t1
LEFT JOIN table2 AS t2 ON (t2.id = t1.t2_id)
JOIN (SELECT FLOOR(MAX(id)*RAND()) as id FROM table1) AS rt ON t1.id >= rt.id
WHERE t1.active = 1
LIMIT 1

Now the problem is when i change "LIMIT 1" to "LIMIT 5" for example, the records pulled out of the table are not really random. Only the first record is random! The 4 remaining records are just record 1 + 1.

So, the result for "LIMIT 5" is:

1st record: id=34 (totally random record)
2nd record: id=35 (not a random record but 1st record + 1)
3rd record: id=36 (not a random record but 2nd record + 1)
and so on..

It just adds + 1 to first record.

View Replies !
Select At Random?
I have a db that I'm using as a mailing list. In many (but not all) cases, there are several contacts per company. I rarely want to send my mail to more than 1 person at any one company, and I never want to send to more than 3.

I don't have any criteria that I can use to select which contact to select, so I want to do it essentially at random. So I want to contruct a SELECT query that says, "when there are >1 contact at company X, pick 1 (or 2) of them at random. When there is only 1 contact at a company, include that contact/company in the result as well."

I'm sure there's an easy way to do this, but having searched online and read a lot of the 1500-page manual, I haven't figured it out.

View Replies !
Random Crash
I got MySQL(5.0.24a-community-max-nt) installed on a Windows2003 production machine and thats why it restarts randomly.

View Replies !
Random Column?
arcade table with columns:

`username`,`gamename`,`score`

To get the highscores for each of the games, I run this query:

SELECT `username`,`gamename`,MAX(score) FROM `arcade_highscores` GROUP BY `gamename`

It returns the proper highest score for each game, but the username seems to be completely random.

View Replies !
Auto_Increment At Random
im using the MySQL Control Panel 0.9.4. I can do this with SQL so I assume MySQL can as well?:

I want to have a user fill out a form on my site, then when their information is inserted into the database I want it to automatically generate the User ID #. I went ahead and set this up and checked, “Auto_Increment”. And it works. The only problem is that it increases the increment by 1 each time. I have a Length of 11 and want it to randomly mix up all the numbers. I want to avoid a member changing the 1 increment to access someone else’s account. Is there a way to have the number generate at random rather than by 1 increment at a time in MySQL?

View Replies !
Random Records
I'm trying to get a random record for use with my website. I've tried figuring out some premade code and it's led me nowhere..

Here's basically the rundown...

I have a database setup by my site's shopping cart system, and in it are 2 tables i need to read from, "specials" and "featured". I want to pull 4 random entries from "specials" and 1 from "featured" to have posted on my site's main page outside of the store.

I know how to connect to and select the database, I even know how to send queries, but the whole selecting a random entry is what's got me at a brick wall.

I'm not used to PHP and MySQL, i'm just now learning after 4 years of using Perl(and never using a database system, but creating my own database-like files).

View Replies !
Random Pick
When an artist isn't picked, there is a random artist picked. Now I have it setup so it counts the rows, and picks a random number from 1-nr of rows. This number is then used as the id and gotten a mysql query from this id.

$query = mysql_query("SELECT * FROM `artists`");
$total = mysql_num_rows($query);
$random=rand(1,$total);
$right = mysql_query("SELECT * FROM `artists` WHERE `id`=$random");

Now, I want something a bit different. I also have ABC....Z, by the first letterof Artist Name. If the first letter is picked, but no artist, I want the random artist to be start with this letter. I wanted to use something like above but the id won't be in order. it could be like 1, 20, 32, etc etc.

View Replies !
Random Query
I have been tasked with getting daily quotes out of a sql database, there needs to be 3 that are randomly selected. I have not found any documentation in regards to doing this.

How would I qurey a database and pull 3 quotes of the day out randomly. This should even occur when a user refreshes the page, is there a sql function that would do this? or do I need to do it via php, perl, etc...

View Replies !
Selecting Random
so i have a table with three columns: sentence, auto_id and createdate (datetime). I want to display random sentences (from sentence) up to 15 from each day. That's easy enough:
$query = "SELECT sentence FROM sentences WHERE createdate LIKE '$today%' ORDER BY RAND() limit 15";
but now I'm running into a problem and that is if a user submits a huuuge block of sentences into this db I end up displaying mostly that users stuff (and often only that users stuff) so I'd like to come up with a query that will use the information afforded it to select:only one or two randomly selected sentence(s) from each entry and return it randomly up to 15.
what does that query look like?

View Replies !
Random Row Order
What do I need to put into a SQL statement for it to retrieve 100 Random Rows (containing certain criteria in the WHERE clause). Something like this (theoretically) is what i'm looking for:

SELECT *
FROM table
WHERE field="yes"
ORDER RANDOM
LIMIT 0, 25

Any Ideas?

View Replies !
Random Selection
Basically I have this:

(category INT,type INT,item TEXT)

I want to be able to select (say) 20 distinct random records with category=x and type=y.
How can I do that ?

View Replies !
Order By Random
Is there anyway to order records randomly? instead of order by id desc to order it randomly?

View Replies !
Random Data
I keep getting random data put in to by database??? Any idea how to stop this?

View Replies !
Inserting Random #
I have a db name image records. It has 3 columns recno_no, file_name and active_fl.

is there a way to insert 100 random #'s into the database table and its columns for testing?

View Replies !
Random Retrieving
data in myTable

(id) name
(1) Tom
(4) Jane
(8) John
I have data in myTable like the above.

Can I retrieve one of names in name column randomly?

View Replies !

Copyright 2005-08 www.BigResource.com, All rights reserved