I'm new to php and think this should work but I can't figure out if I'm doing something wrong with syntax or what. This is the script that handles my submitted data from a form.
I set php variables to the posted data from the form, it echos out the correct data in the variables, the problem is with updating the record in the database, it doesn't...
The table in the DB has 3 attributes, adID, iconURL, webURL.
The form has 2 input textfields, and a hidden field, iconPath, webPath, and recordN.
<?php
$recNum = $_POST["recordN"];
$iconU = $_POST["iconPath"];
$webU = $_POST["webPath"];
echo 'Number of record updated: ' . $recNum;
echo '<br />New Icon Path: ' . $iconU;
echo '<br />New Web Path: ' . $webU;
$con = mysql_connect("localhost","admin","pass");
if (!$con) { die('Could not connect: ' . mysql_error()); }
mysql_select_db("DBNAME", $con);
mysql_query("UPDATE adSources set iconURL = $iconU, webURL = $webU
WHERE adID = $recNum");
mysql_close($con);
echo '<br /><a href="http://mydomain.com/thePage.html" target="_blank">Return to main page</a>' . "\n";
?>
So where adID = recNum, I want to overwrite iconURL = $iconU and webURL = $webU
I have the value in $iconU and $webU that I want to use, and iconURL and webURL are the names of the fields in the database. I read them just fine and can display them by those names just fine, I just can't update this.
I granted full permissions in the db for the user and all that.
Any help? Php seems so freakin ugly compared to other languages.