Jump to content

Sigmahokies

Members
  • Content count

    24
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Sigmahokies

  • Rank
    Newbie
  1. Flexible in array for table in the Database

    hi just someguy, please forgive me for my grammar, I'm Deaf, so ASL is my prime language, English is my second language. Anyway, I'm trying to create new variable by loop which must be follow number of array. In the many database, there are various number of columns, so I need to set up the flexible array that can insert in value in the database. For example, if one table has three columns, so have to set up with three array, if table has four columns, so have to set up four array. feel me? So, I need to create variable to get post from the name in HTML, which need to same number from array. For example, if post get four value from HTML, have to have four variable. if post get three value from HTML ,have to have three variable. I'm doing my best to improve my grammar in next time.
  2. Flexible in array for table in the Database

    Hi everyone, I am trying to set up the flexible with array, like set up the array by count the columns in tables in the Database, so I am still figure how to create variable word through loop to allow equalized from $_post as if $_post appear in two or three or four...I figured out to set up the $_post in loop, but I haven't find a way to have create new variable to equalized with $_post in loop in same time. here my code <!doctype html> <html> <head> <title>Add name and number</title> <link href="defaultdatabase.css" rel="stylesheet" type="text/css"> </head> <h2>Add any DSDJ information to database</h2> <?php require ("require2.php"); $sql = "show tables from NewDSDJ"; $list = mysqli_query($GaryDB, $sql); while ($row = mysqli_fetch_array($list)) { $table[] = $row[0]; $option = ''; foreach ($table as $rows) { $option .= "<option value='{$rows}'>{$rows}</option>"; } } ?> <form action="addname.php" method="post"> <table> <tr><th>Select the table</td><td> <select name="subject"> <?php echo $option; ?> </select></td><td><input type="submit" name="selected" value="select"></td></tr> </table> </form> <form> <table> <?php if (isset($_POST['selected'])) { $selected = $_POST['subject']; $column = "select column_name from information_schema.columns where table_name = '" . $selected . "'"; $list5 = mysqli_query($GaryDB, $column); while ($array = mysqli_fetch_array($list5)) { $input = ''; foreach ($array as $row5) { $input = "<tr><td>{$row5}:</td><td colspan='2'><input type='text' name='label[]'></td></tr>"; } echo $input; } if (isset($_POST['insert'])) { foreach ($array as $row6) { $ins = "{$row6},"; } for ($i = 0; $i < count($array); $i++) { $label = $_POST['label']; } echo $label; $insert = "insert into " . $selected . " (" . $ins . ") values (" . $label . ")"; mysqli_query($GaryDB, $insert) or die("Could not insert"); } }echo "<tr><td><input type='submit' name='insert'></td></tr>"; mysqli_close($GaryDB); ?> </table> </form> </html> Look at above of $insert, that is one I haven't figure how to create variable word to get data from name in form in HTML. Can you help? Thanks, Gary Taylor
  3. Images in array

    Hi everyone, I am still learning Java. I am trying to create an array with images. I have images in folder, but I can't figure how to start to have images in array. How can I do that? I checked around in google, none of them make sense, more likely off topic to image icon. I need to tell java to pull all images from folder into array, so i can process programming. can you please show how to do that? Thank you so much. Gary
  4. do and while loop

    Hi ingolme, Don't worry about it now, I found a way to make do...while loop works! Thanks.
  5. do and while loop

    Are you talking about method that above of all must inside like public void (args) {}? all code are inside args already. If you want, I can show you a full of source in Java.
  6. do and while loop

    NetBean. It shows highlight error in do and while line. I checked the method has been correct, but it won't do loop. all method and compare are inside, I wrote code after parameter. Java source said while accept != as not equal. isn't that strange? I know what method is. I have been learning about OOP already, I am moving into intermediate level now.
  7. do and while loop

    Then tell me what is wrong with those codes?
  8. do and while loop

    Hi everyone, this is my second thread, I hope you can help me why do and while won't do loop as I put them in... public class GameGuess extends Thread { int a; public void Send(int a) { this.a = a; } do { int p1 = (int) ((Math.random() + 5) * 10); int p2 = (int) ((Math.random() + 5) * 10); System.out.print("Player 1: " + p1); System.out.print("Player 2: " + p2); if (p1 != a) { System.out.print("Player 1 get wrong guess."); } else if (p1 == a) { System.out.print("The Player 1 wins!"); } else if (p2 != a) { System.out.print("Player 2 get wrong guess"); } else if (p2 == a) { System.out.print("The Player 2 wins!"); } } while (p1 != a || p2 != a);
  9. trying to prevent repeat random number in array

    Hi justsomeguy, Yes, i am trying to set up the random between 50 and 60, but not in order. I am trying to create the game. I want to have player 1 and player 2 making a guess number, if it is not match the secret number, then store into array to make sure player 1 and player 2 can't repeat number (like program can check to see if number is exist in array, then guess number that does not exist in array), until player 1 or player 2 make match the secret number to win. Hey, Please be patient with me if my grammar in english is terrible, because I am fluent in ASL. Thank you so much!
  10. Hi everyone, I am beginner ti learn Java, I am trying to stop the repeat number in array, but it won't work. Anyone who have idea? it will be appericate...here my code to create random number that between 50 to 60, then put in 10 array, but few number are repeated... int [] myArray = {0,1,2,3,4,5,6,7,8,9}; int pop = 0; for (int i = 0; i < myArray.length; i++0 { pop = (int) ((Math.random() + 5) *10); for (int j = 0; j < myArray.length; j++) { if (pop != MyArray[j]) { myArray[j] = pop; }
  11. while with checkbox

    which query that I made error?
  12. while with checkbox

    Hi everyone I am trying to create the one table columns (I will do multiply columns later) with checkbox, it is good for people who show up for meeting or activity. I am trying to make a check that post in next below from checking chart, but it won't post at all, what did i do wrong? Can you help me? Thanks, Gary </table></fieldset></form><h2>Checbox works with database</h2><form action="portfolio.php" method="POST"><table><?php $list = "SELECT ID, FirstName, LastName FROM sample";$list2 = mysqli_query($connect, $list); if (mysqli_num_rows($list2)) {while ($row5 = mysqli_fetch_assoc($list2)) {echo "<tr><td>".$row5['FirstName']."</td><td>".$row5['LastName']."</td><td><input type='checkbox' value='".$row5['ID']."' name='check'></td></tr>";}}?><tr><td colspan="3"><input type="submit" name="check3" value="who showed up"></td></tr></table><table><?php if ($_POST['check3']) {$check = $_POST['check']; if ($check) {$select = "SELECT FirstName, LastName FROM sample WHERE = ID '%".$check."%'";$run = mysqli_query($connect, $select); if (mysqli_num_rows($run)) {while ($ran = mysqli_fetch_assoc($run)) {echo "<table>";echo "<tr><td>".$ran."</td></tr>";echo "<table>";}}}}?></table></form>
  13. Paid share hosted or Virtual Private Server?

    Oh well, I need a something that allow remote database access, I'm sure only Paid hosted website and VPS are allowed, none of free website do that. I just want to start to work with database to create a portfolio website that show I can work in PHP and Database Management in PHP. Also, I will like to practice on CSS. I have VPS, but it is not really good cooperate with me. I am planning to cancel it if it continue stubborn. Gary
  14. I want to see your opinion about website Which is best to sign up for create website in OS: Paid share hosted (GoDaddy.com, i-page.com, atspace.com, etc) or Virtual Private Server? Please let me know ASAP Thanks! Gary
  15. Random Poker card

    Oh cool, it worked, it is in JavaScript, right? Can i make an image in this script? But why i get "undefine of shade", "undefine of heart"...I will like to remove this "undefine" Thanks!
×