Solved

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

Posted on 2014-03-06
4
324 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 54

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
This article discusses four methods for overlaying images in a container on a web page
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.
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 …

809 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