Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $digits = array(9,8,7,6,5,4,3,2,1);
- $primes = array(2,3,5,7,11);
- for ($first = 0; $first < count($digits)-1; $first++) {
- $num1 = $digits[$first];
- for ($second = 1; $second < count($digits)-2; $second++) {
- $num2 = $digits[$second];
- for ($third = 0; $third < count($primes)-1; $third++) {
- $num3 = $num1 * $primes[$third];
- $num4 = $num2 * $primes[$third];
- $questionlead = "Simplify <br>" .$num3. " : " . $num4 ;
- $ans = $num1. " : " . $num2 ;
- $dbhost = 'nope';
- $dbuser = 'notfor';
- $dbpass = 'you';
- $conn = mysql_connect($dbhost, $dbuser, $dbpass);
- if(! $conn ) {
- die('Could not connect: ' . mysql_error());
- }
- $sql = "INSERT INTO QuestionDB(TopicID, TopicName, SubtopicID, SubtopicName, Question, Answer, Difficulty, Author, Projectable) VALUES (6,'Ratio',1,'Simplifying ratio','".$questionlead. "','".$ans. "',1,'Richard Tock','Yes')";
- mysql_select_db('db_name');
- $retval = mysql_query( $sql, $conn );
- if(! $retval ) {
- die('Could not get data: ' . mysql_error());
- }
- }
- }
- }
- mysql_close($conn);
- ?>
Add Comment
Please, Sign In to add comment