Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules
Author Message
missdanni
Hangin' Around



Joined: Jul 06, 2005
Posts: 25

PostPosted: Wed Jul 06, 2005 6:21 pm Reply with quote

I have been looking at these 2 functions for too long and I cant seem to see why it is not submitting the changes. A fresh set of eyes would be really great.

They are 2 admin functions for a venues mod.

First function vmodvenue gets the data and allows you to edit, that part works out fine.

The second part vmodgo is to send the changed data to the database ... but it is not doing that at all.

Help please Razz

Code:
function vmodvenue($vid){

global $prefix, $db;
    $result = $db->sql_query("SELECT * from ".$prefix ."_venues where vid='$vid'");
    OpenTable();
    echo "<center><b>"._vedit_."</b></center>";
    CloseTable();
    echo "<br>";
    OpenTable();
    echo "<center><b>"._vedit_."</b></center><br><br>";
   while($row = $db->sql_fetchrow($result)) {
    $vid =  $row["vid"];
   $vname =  $row["vname"];
   $vphone =  $row["vphone"];
   $vemail =  $row["vemail"];
   $vlocation =  $row["vlocation"];
   $vwebsite =  $row["vwebsite"];
   $vdescription =  $row["vdescription"];
   $vhours =  $row["vhours"];
   $vdress =  $row["vdress"];
   $vspecials =  $row["vspecials"];
   $vcover =  $row["vcover"];
   $vages =  $row["vages"];
   $vnotes =  $row["vnotes"];
   $vlogo =  $row["vlogo"];
   $vuser_id = $row["vuser_id"];
   }
echo " <form action=\"admin.php?op=vmodgo\" method=\"post\">";
echo " <table width=\"80%\"  border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"2\">";
echo "   <tr>";
echo "     <td width=\"30%\">"._vid_."</td>";
echo "     <td width=\"70%\"><input name=\"$vid\" value=\"$vid\" type=\"text\" size=\"45\"></td>";
echo "   </tr>";
echo "   <tr>";
echo "     <td width=\"30%\">"._vname_."</td>";
echo "     <td width=\"70%\"><input name=\"$vname\" value=\"$vname\" type=\"text\" size=\"45\"></td>";
echo "   </tr>";
echo "   <tr>";
echo "     <td>"._vphone_."</td>";
echo "    <td><input name=\"$vphone\" value=\"$vphone\"type=\"text\" size=\"45\"></td>";
echo "   </tr>";
echo "   <tr>";
echo "     <td>"._vemail_."</td>";
echo "     <td><input name=\"$vemail\" value=\"$vemail\" type=\"text\" size=\"45\"></td>";
echo "   </tr>";
echo "   <tr>";
echo "     <td>"._vlocation_."</td>";
echo "     <td><input name=\"$vlocation\" value=\"$vlocation\" type=\"text\" size=\"45\"></td>";
echo "   </tr>";
echo "   <tr>";
echo "     <td>"._vwebsite_."</td>";
echo "     <td><input name=\"$vwebsite\" value=\"$vwebsite\" type=\"text\" size=\"45\"></td>";
echo "   </tr>";
echo "   <tr>";
echo "     <td>"._vdescription_."</td>";
echo "     <td><textarea name=\"$vdescription\" cols=\"41\">$vdescription</textarea></td>";
echo "   </tr>";
echo "   <tr>";
echo "     <td>"._vhours_."</td>";
echo "     <td>      ";
echo " <textarea name=\"$vhours\" cols=\"41\">$vhours</textarea> ";     
echo " <br></td>";
echo "   </tr>";
echo "   <tr>";
echo "     <td>"._vdress_."</td>";
echo "     <td><input name=\"$vdress\" value=\"$vdress\" type=\"text\" size=\"45\"></td>";
echo "   </tr>";
echo "   <tr>";
echo "     <td>"._vspecials_."</td>";
echo "     <td><input name=\"$vspecials\" value=\"$vspecials\" type=\"text\" size=\"45\"></td>";
echo "   </tr>";
echo "   <tr>";
echo "     <td>"._vcover_."</td>";
echo "     <td><input name=\"$vcover\" value=\"$vcover\" type=\"text\" size=\"45\"></td>";
echo "   </tr>";
echo "   <tr>";
echo "     <td>"._vages_."</td>";
echo "     <td><input name=\"$vages\" value=\"$vages\" type=\"text\" size=\"45\"></td>";
echo "   </tr>";
echo "  <tr>";
echo "     <td>"._vnotes_."</td>";
echo "     <td><textarea name=\"$vnotes\" cols=\"41\">$vnotes</textarea></td>";
echo "   </tr>";
echo "   <tr>";
echo "     <td>"._vlogo_."</td>";
echo "     <td><input name=\"$vlogo\" value=\"$vlogo\" type=\"text\" size=\"45\"></td>";
echo "   </tr>";
echo "   <tr>";
echo "     <td>"._vuser_id_."</td>";
echo "     <td><input name=\"$vuser_id\" type=\"text\" size=\"45\" value=\"$vuser_id\"></td>";
echo "   </tr>";
echo "   <tr>";
echo "     <td>&nbsp;</td>";
echo "     <td>&nbsp;</td>";
echo "   </tr>";
echo "   <tr>";
echo "     <td>&nbsp;</td>";
echo "     <td><div align=\"center\">";
echo "       <input type=\"submit\" value=\"Save Changes\"> [ <a href=\"admin.php?op=deletevenue&amp;vid=$vid\">" . _DELETE . "</a> ]";
echo "     </div></td>";
echo "   </tr>";
echo " </table>";
echo " </form>";
CloseTable();
};

function vmodgo($vid, $vname, $vphone, $vemail, $vlocation, $vwebsite, $vdescription, $vhours, $vdress, $vspecials, $vcover, $vages, $vnotes, $vlogo, $vuser_id){
global $prefix, $dbi;
   $vid = intval($vid);
    $vname = stripslashes(check_html($vname, "nohtml"));
    $vphone = stripslashes($vphone);
    $vemail = stripslashes($vemail);
    $vlocation = stripslashes($vlocation);
    $vwebsite = stripslashes($vwebsite);
   $vdescription = stripslashes($vdescription);
    $vhours = stripslashes($vhours);
    $vdress = stripslashes($vdress);
    $vspecials = stripslashes($vspecials);
   $vcover = stripslashes($vcover);
    $vages = stripslashes($vages);
    $vnotes = stripslashes($vnotes);
    $vlogo = stripslashes($vlogo);
   $vuser_id = stripslashes($vuser_id);
   mysql_query("UPDATE ".$prefix."_venues SET vname='$vname', vphone='$vphone', vemail='$vemail', vlocation='$vlocation', vwebsite='$vwebsite', vdescription='$vdescription', vhours='$vhours', vdress='$vdress', vspecials='$vspecials', vcover='$vcover', vages='$vages', vnotes='$vnotes', vlogo='$vlogo', vuser_id='$vuser_id' WHERE vid='$vid'",$dbi);
    Header("Location: admin.php?op=editvenue");
};
 
View user's profile Send private message
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Wed Jul 06, 2005 7:18 pm Reply with quote

Before I look any further, rewrite the second function like this
Code:
function vmodgo($vid, $vname, $vphone, $vemail, $vlocation, $vwebsite, $vdescription, $vhours, $vdress, $vspecials, $vcover, $vages, $vnotes, $vlogo, $vuser_id){

global $prefix, $db;
   $vid = intval($vid);
    $vname = stripslashes(check_html($vname, "nohtml"));
    $vphone = stripslashes($vphone);
    $vemail = stripslashes($vemail);
    $vlocation = stripslashes($vlocation);
    $vwebsite = stripslashes($vwebsite);
   $vdescription = stripslashes($vdescription);
    $vhours = stripslashes($vhours);
    $vdress = stripslashes($vdress);
    $vspecials = stripslashes($vspecials);
   $vcover = stripslashes($vcover);
    $vages = stripslashes($vages);
    $vnotes = stripslashes($vnotes);
    $vlogo = stripslashes($vlogo);
   $vuser_id = stripslashes($vuser_id);
   $result = $db->sql_query("UPDATE ".$prefix."_venues SET vname='$vname', vphone='$vphone', vemail='$vemail', vlocation='$vlocation', vwebsite='$vwebsite', vdescription='$vdescription', vhours='$vhours', vdress='$vdress', vspecials='$vspecials', vcover='$vcover', vages='$vages', vnotes='$vnotes', vlogo='$vlogo', vuser_id='$vuser_id' WHERE vid='$vid'");
   if (!result) {
      die('MySql said: '.mysql_error());
   }
    Header("Location: admin.php?op=editvenue");
}
 
View user's profile Send private message
missdanni







PostPosted: Wed Jul 06, 2005 7:40 pm Reply with quote

Thanks.

Well I redid the function like you said and ran the script agian and it did the same thing but no error.

It goes through the motions and ends back where it should but no data is passed.
 
Raven







PostPosted: Wed Jul 06, 2005 8:58 pm Reply with quote

Great. Now, right before the global statement, add this line
Code:
die('$vid = '.$vid);

Run it again and post back your results.
 
missdanni







PostPosted: Thu Jul 07, 2005 6:06 am Reply with quote

Ok did that and ran it agian.

Results: Nothing

$vid=

= was blank.
 
missdanni







PostPosted: Thu Jul 07, 2005 6:38 am Reply with quote

Im an idiot lol

I had the names & values set with $

Code:
 name=\"$vid\" value=\"$vid\" 


Thanks for the help Raven!
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©