Exceedinglife's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Active Members
Active Posts:
59 (0.07 per day)
Joined:
01-July 12
Profile Views:
711
Last Active:
User is offline Yesterday, 03:13 PM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Windows
Favorite Browser:
FireFox
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Subaru
Dream Kudos:
0
Icon   Exceedinglife has not set their status

Posts I've Made

  1. In Topic: Display data from 2 tables from phpmyadmin in 1 table in html

    Posted 21 Oct 2014

    table2 is my query to pull the numbers out of the table so i would say result of query?
    my $result variable is calling my 1st query which is all the info in my first table that works fine with no issues
    the problem is getting the data from the second table in the correct spots of my html table.
    i believe $result->close() is ending my html table because there is no further data to read
    im not sure maybe i dont need it because i close my connection later on

      			<?php
    			  	$sql = "SELECT userID, firstName, lastName, email, address FROM users";	//, phone
    			  	$table2 = "SELECT homePhone, cellPhone FROM usersphone";
    				$phoneResults = mysqli_query($mysqli, $table2);		//=$mysqli->query($table2);
    				
    			    if ($result = $mysqli->query($sql)) 
    			    {
    			      if ($result->num_rows > 0) 
    			      {
    			        echo "<table>\n";
    			        echo "  <tr class=\"heading\">\n";
    			        echo "    <td>ID</td>\n";
    			        echo "    <td>firstname</td>\n";
    			        echo "    <td>lastname</td>\n";
    					echo "    <td>email</td>\n";
    					echo "    <td>address</td>\n";
    					echo "    <td>Home phone</td>\n";
    					echo "    <td>Cell phone</td>\n";
    			        echo "  </tr>\n";
    			        // loop through each of the results to build the table rows
    			        // the fetch_object() method returns the columns as a property on the object
    			        // which can be accessed using "->" (method annotation)
    			        while($row = $result->fetch_object()) 
    			        {
    			          echo "  <tr>\n";
    			          echo "    <td><a href='javascript:nameall()'>" . $row->userID . "</a></td>\n";
    			          echo "    <td>" . $row->firstName . "</td>\n";
    			          echo "    <td>" . $row->lastName . "</td>\n";
    					  echo "    <td>" . $row->email . "</td>\n";
    					  echo "    <td>" . $row->address . "</td>\n";
    					  //table 2 display phone numbers
    					  echo "    <td>";  
    					  	while ($row = mysqli_fetch_array($table2)) {
    					  //		$phone1 = $row['homePhone'];
    						//  echo "$phone1 ";	//		$row->homePhone
    					  	}
    						echo "</td>";
    					  //$row->phone . "</td>\n";
    					  
    			          echo "  </tr>\n";
    			        }
    			        echo "</table>";
    			        // close the result set
    			        $result->close();
    			      } 
    			      else 
    			      {
    			        echo "No employees in database.";
    			      }
    			    } 
    			    else 
    			    {
    			      echo "ERROR: Could not execute query: $sql. " . $mysqli->error;
    			    }			      
    			    // close connection
    			    $mysqli->close();
    			?>
    


    After i figure out how to read the data then i am working on my login which looks like this maybe you can help me with that as well after i figure this out

    $username = $mysqli->escape_string($username);
    				    
    					 $sql = "SELECT COUNT(*) FROM users WHERE email = '$username'";//username
    				      if ($result = $mysqli->query($sql)) 
    				      {
    				        $row = $result->fetch_array();
    				        // if yes, fetch the encrypted password
    				        if ($row[0] == 1) 
    				        {
    				          $sql = "SELECT password FROM users WHERE email = '$username'"; //username
    						         
    				          if ($result = $mysqli->query($sql)) 
    				          {
    				            $row = $result->fetch_object();    
    				
    				            $hash = $row->password;
    							
    							
    							if (crypt($password, $hash) == $hash) 
    				            {              
    				              echo 'Your login credentials were successfully verified.'; 
    							  
    							  session_start();
    							  $_SESSION['username'] = $username;
    							  
    							  $queryLogin = "SELECT * FROM users WHERE email = '{$_SESSION["username"]}' ";
    							  $myResult = $mysqli->query($queryLogin);
    							  $myRow = $myResult->fetch_array();
    							  
    							  $fname = $row["firstName"];
    							  
    							  
    							  echo "<input type=\"text\" name=\"xyz\" value='<?php echo $fname; ?>' >";
    							   
    				            /*
    							//<input type="text" name="xyz" value=<?php echo $val; 
    							//echo "<input type=\"text\" name=\"xyz\" value='$val'>";
    							 *<input type="text" name="text1" value="<?php echo $row["usr_password"]; ?>">
    							 * 
    							 * 
    							 * 
    							 * 		$id = $_GET['id'];
     								 	$sql="select * from Doctor where DocID='$id'";
    									$result=mysql_query($sql);
    									$row=mysql_fetch_array($result);
    							 * 
    							 *   <input type = "text" name = "DocName" value = "<? echo $row['DocName']; ?>" >
    							 * */
    							 // UPDATE tablename SET columnName $variable etc... WHERE id = $id;
    							
    							
    							/*
    							 * $Name=$_POST['unames'];
    								$data=mysql_query("SELECT * FROM tbl_sample where Name='$Name'");
    
    								$info=mysql_fetch_array($data);
    								while($info=mysql_fetch_array($data)){}
    							 */
    							} 
    				            else 
    				            {
    				              echo 'You entered an incorrect password.';            
    				            }
    				          } 
    $mysqli->close();
    
    
  2. In Topic: Display data phpmyadmin in txtbox and have a profile picture

    Posted 15 Oct 2014

    <header>
    		<h1>Please enter user information.</h1>
    	</header>
    		<!-- PHP Code / Entering into Database, and more -->
    		<?php
    			$server = getenv('OPENSHIFT_MYSQL_DB_HOST');
    			$user = getenv('OPENSHIFT_MYSQL_DB_USERNAME');		
    			$password = getenv('OPENSHIFT_MYSQL_DB_PASSWORD');
    			$database = 'lab03LoginUsers';
    			
    			$mysqli = new mysqli($server, $user, $password, $database);
    			
    			if ($mysqli === false) 
    		    {
    		      die("ERROR: Could not connect to database. " . mysqli_connect_error());
    		    }
    			//When submit button is clicked ->
    			if(isset($_POST['submit']))
    			{
    				$inputError = false;
    				//put firstname field in a variable.
    				if (empty($_POST['firstName'])) 
    	      		{
    		        	echo 'ERROR: Please enter a valid firstname';
    	    	    	$inputError = true;        
    	    		} 
    	    		else 
    	      		{	//properly escape the field
    	      			$fName = $mysqli->escape_string($_POST['firstName']);
    	    		}
    if($inputError != true)
    				{
    					//insert query
    					$sqlInsertQuery = "INSERT INTO Users (address, email, firstName, lastName, password)
    					VALUES ($address', '$email', '$fName', '$lName', '$salt', )";
    					
    					if ($mysqli->query($sqlInsertQuery) === TRUE)
    					{
    						echo 'New employee record added with ID: '  . $mysqli->insert_id;  
    					}
    <div>
    			<form method="post" id="registerForm">
    				<fieldset>
    					<legend>Information</legend>
    					<div class="registerDiv">
    						<label for="firstName">First name:</label>
    						<input type="text" name="firstName" id="firstName" placeholder="Enter your name" />
    						<br><br>
    					</div>
    				</fieldset>
    			</form>
    		</div>
    
    <?php
      				if(!isset($_POST['btnSubmit']))
    				{
    			?>	
    					<form method="post" action="index.php">
    						<label for="username">Username:</label>
    						<input type="text" name="username" />
    						<br>
    						<label for="password">Password:</label>
    						<input type="text" name="password" />
    						<br>
    						<input type="submit" name="btnSubmit" value="Log In!" />
    					</form>
    			<?php
    			//the form is submitted check everything to login successfully
    				}
    				else 
    				{
    					 $username = $_POST['username'];
          $password = $_POST['password'];
    				}
     $sql = "SELECT COUNT(*) FROM users WHERE username = '$username'";
          if ($result = $mysqli->query($sql)) 
          {
            $row = $result->fetch_array();
            // if yes, fetch the encrypted password
            if ($row[0] == 1) 
            {
              $sql = "SELECT password FROM users WHERE username = '$username'";        
              if ($result = $mysqli->query($sql)) 
              {
                $row = $result->fetch_object();    
    
                $hash = $row->password;
                // take a look at what the hashed password value looks like:
                // echo $hash;
    
                // verify that the hash matches the plain password
                if (crypt($password, $hash) == $hash) 
                {              
                  echo 'Your login credentials were successfully verified.';  
                } 
    			?>
    
    
  3. In Topic: Display data phpmyadmin in txtbox and have a profile picture

    Posted 14 Oct 2014

    I want to auto populate textboxes with the data from phpmyadmin database.
    Once the data is in the textboxes then i want to do an update query so i can update the textboxes with the current data that is inserted.
    Also i want to be able to add a profile image to each profile.
  4. In Topic: RelationDatabase PHPmyadmin 2 tables 1 form insert statement dynamic t

    Posted 2 Oct 2014

    im not sure how to find the name of my dynamically made textbox and then ill have to make a insert statement to enter those numbers into my database
    Can you please help me with inserting into a second table and figuring out the id of my dynamic txt box this is what i tried

    txtPhone.id = 'number'+txtboxcounter;
  5. In Topic: DatePicker WPF trying to make a DateTime

    Posted 30 Jun 2014

    i think i may have fixed it
    my class was only missing the word public i believe the datepicker will be stored as a datetime? now all my errors went away once i changed it to public class user lol

My Information

Member Title:
D.I.C Head
Age:
23 years old
Birthday:
January 24, 1991
Gender:
Location:
Wisconsin
Full Name:
Andrew
Years Programming:
1
Programming Languages:
Java
HTML
CSS
JavaScript
Little bit of PHP
C# currently learning

Contact Information

E-mail:
Click here to e-mail me

Friends

Exceedinglife hasn't added any friends yet.

Comments

Exceedinglife has no profile comments yet. Why not say hello?