Hi all,
I am a newb to php and I have become very stuck in my learning travels.
I think what I am looking for is very simple I just cant seem to find it, and I have now been frustrated for a few days looking.
This is what I want to do (in very brief shorthand mode);
$var1;
if ($something) {
... update DB where id = $var1 ...
}
if ($link) {
$var1 = $id
return $var1
}
if (!$var1) {
$sql = "SELECT * FROM add1";
$result = mysql_query($sql);
while ($myrow = mysql_fetch_array($result)) {
printf("<a href=%s?id=%s&link=yes>%s</a><br>", $PHP_SELF, $myrow['id'], $myrow['title']);
}
}
SO basically there are three sections
update database (which will not get run till last) but must use $var1 for the id part
change $var1 SOMEHOW??? so that the original $var1 is changed through out the script
on first run through script display a list with all database entries, until id is selected (...and then for all the time the user uses this script let $var1 be that id)
I have tried using functions but they do not seem to be doing the trick, global within a funciton works calling the variable in but I cannot seem to figure out how to return a changed 'master' variable???
Please help.