Solved

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

Posted on 2014-03-06
4
327 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 55

Expert Comment

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

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
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…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

856 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