Solved

What is a code example of combing the login, select, update using php.

Posted on 2014-03-06
4
319 Views
Last Modified: 2014-03-10
followup to
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_28366958.html#a39865569

this is an example of a mysql connection and php function combined.

I have thought of ways to create code but my code is very disorganized.  

What is a code example of combing the login, select, update using php.
0
Comment
Question by:rgb192
4 Comments
 
LVL 52

Expert Comment

by:Julian Hansen
ID: 39911708
The referred question is about prepending and appending - not about login and select?
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 39912260
If by "login" you mean PHP client authentication, this article shows the way.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_2391-PHP-login-logout-and-easy-access-control.html

Words like "login" and "select" have not got any single specific meaning in computer science.  They are terms of art, but the meanings range over a lot of intellectual territory.  So when you ask for an example of "login" it's like asking for an example of "England."  There are so many answers that it's not possible to predict which one(s) might be useful to you.

If you want to try to explain what you're looking for in a little more detail, we can probably help you find something that satisfies the need for an example.
0
 
LVL 24

Accepted Solution

by:
mankowitz earned 500 total points
ID: 39912486
I think what you want is an example of connecting to the db and doing the update. Is this what you want?

<?php
$con=mysqli_connect("example.com","peter","abc123","my_db");
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

$result = mysqli_query($con,"SELECT * FROM Persons");
$updatecmds = array();

while($row = mysqli_fetch_array($result))
  {
 $updatecmds[] = "UPDATE tbl SET column3='" .
     mysqli_real_escape_string($con, 'begin' . $row['column2']  . 'end') . "';";  
  }

mysqli_close($con);

foreach ($cmd in $updatecmds)
    mysqli_query($con, $cmd);
?>
0
 

Author Closing Comment

by:rgb192
ID: 39917972
thanks
login, select, update
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
php ssh2_scp_send 1 48
incrementing radio button names and ids using php 5 37
How can i modify my File download link ? 6 47
What is the best PDF generator to use? 1 28
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now