Solved

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

Posted on 2014-03-06
4
330 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 56

Expert Comment

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

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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

733 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