Solved

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

Posted on 2014-03-06
4
313 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 51

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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…

706 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

19 Experts available now in Live!

Get 1:1 Help Now