troubleshooting Question

Copy values from a column and then adding .jpg  to this value and paste it to the new column

Avatar of patrik20
patrik20 asked on
PHPMySQL Server
10 Comments1 Solution272 ViewsLast Modified:
Hi
I have added a new column to a table and I will copy the values from that a different column ( from the same table ) and then adding .jpg  to this values and paste it to the new column.
Can please somebody correct my database query and my phpscript.


SQL query on database not works:
 
UPDATE `profile_pic` SET `pic1` = `username` + `.jpg`
 
Even this script not works:
<?php 
require_once 'admin/serverdata.php';
$conn = mysql_connect("$dbHost","$dbUser","$dbPass");
$db = mysql_select_db("$dbName");
$result=mysql_query("select * from profile_pic");
$rowimage=mysql_fetch_assoc($result);
$pic1=$rowimage["username"];
$pic1jpg= $pic1.'.jpg';
$result= mysql_query("UPDATE profile_pic SET pic1 = '$pic1jpg'");
?>
ASKER CERTIFIED SOLUTION
StraySod

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 10 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros