Click here to Skip to main content
14,209,923 members
Rate this:
Please Sign up or sign in to vote.
See more:
this is my code and tablename:table1

i tried the php code for generating random numbers and i get that but how can i get

the inserted that into sql database

What I have tried:

$connection = mysqli_connect('localhost', 'root', '');
if (!$connection){
    die("Database Connection Failed" . mysqli_error($connection));
$select_db = mysqli_select_db($connection, 'tesync');
if (!$select_db){
    die("Database Selection Failed" . mysqli_error($connection));

for ($i=1;$i<=100;$i++)

$randomNumber= rand(1111111111,9999999999);

 echo $randomNumber.'<br>';
Updated 11-Apr-17 22:07pm
Mohibur Rashid 12-Apr-17 3:03am
This is mysql
any way try google. you will get your answer
Richard MacCutchan 12-Apr-17 3:28am
Probably by coding an INSERT statement.
Member 13122800 12-Apr-17 4:07am
where i hve to insert the sql query
Richard MacCutchan 12-Apr-17 4:13am
Wherever you need the data added to the database.
Member 13122800 12-Apr-17 8:22am
give me the code by copying b/w the above code and one more thing is as the generated numbers getting they automatically inserted into wampp phpmyadmin sql db tables
Richard MacCutchan 12-Apr-17 8:55am
We are not here to do your work for you.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Once you have generated the number, you can insert it in a table like you do for any other datum. Here you may find code samples: PHP Insert Data Into MySQL[^].
Member 13122800 12-Apr-17 8:24am
tried pls i need code copy the above and sent me back the final code for me and 1 more thing is as the generated numbers automatically inserted into phpmyadmin sql table

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Advertise | Privacy | Cookies | Terms of Service
Web06 | 2.8.190617.3 | Last Updated 12 Apr 2017
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100