Jump to content

ArcAiN6

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ArcAiN6's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. wow.. that was very insightful to the problem at hand, i'll be sure to use that information the next time i have a real crisis on my hands...
  2. crap... not fixed... //is NOT correct... this actually selects the first id in the table... $sql = "UPDATE e107_user_extended SET user_DKP = user_DKP + '$dkp' WHERE user_extended_id = 1"; //DOES NOT WORK $sql = "UPDATE e107_user_extended SET user_DKP = user_DKP + '$dkp' WHERE user_extended_id = '$select' "; //also does not work $sql = "UPDATE e107_user_extended SET user_DKP = user_DKP + '$dkp' WHERE user_extended_id = '.$select.' ";
  3. i got it $sql = "UPDATE e107_user_extended SET user_DKP = user_DKP + '$dkp' WHERE user_extended_id = 1"; WooT!
  4. hrm.... that did seem to change the error message a bit now i'm recieving: rror adding submitted DKP: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE user_extended_id =' at line 1 and if i try to continue and select a user i recieve this error: Error adding submitted DKP: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE user_extended_id = 1' at line 1 i think after i fix the syntax issue, i'll need to do something to hide / not parse the rest of the code untill a user is selected, and an input posted by the user. as it sits now, it appears to be trying to do the whole script on every loading of the page..
  5. ok... so i was having a tard moment... the database name wasn't correct, and also there was nothing to actually empliment the changes... now that i've solved those two problems, i'm getting an error message... following is an altered post (evidently 15mins is too long to wait to modify my post above ) I am currently in the midst of writing some code for a site I'm building, and perhaps it's because it's so late, or perhaps I've gotten in over my head. But i simply can't figure this out. The code is supposed to select a user from the database by name in a drop down menu (that works fine) display their current total of dkp (this function is also working correctly) and then offer the admin an opportunity to update / add to the current total of DKP for the user (this is NOT working at all) it also returns an error " Error adding submitted DKP: Unknown column '$select' in 'where clause' " following is the code. any help in this matter would be most appreciated. Thank you for your time ArcAiN6 <? // Connect database mysql_connect("localhost","myDBusername","myDBpass"); mysql_select_db("myDBname"); // If submitted, check the value of "select". If its not blank value, get the value and put it into $select. if(isset($_GET['select'])&& $_GET['select'] !=""){ $select=$_GET['select']; } ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <form id="form1" name="form1" method="get" action="<? echo $PHP_SELF; ?> "> <h4>Select Toon's Name :</h4> <select name="select"> <option value="">--- Select ---</option> <? // Get records from database (table "e107_user_extended"). $list=mysql_query("select * from e107_user_extended order by user_extended_id asc"); // Show records by while loop. while($row_list=mysql_fetch_assoc($list)){ ?> <option value="<? echo $row_list['user_extended_id']; ?>" <? if($row_list['user_extended_id']==$select){ echo "selected"; } ?>> <? echo $row_list['user_toonm']; ?></option> <? // End while loop. } ?> </select> <input type="submit" name="Submit" value="Select" /> </form> <hr> <p> <? // If you have selected from list box. if(isset($select)&&$select!=""){ // Get records from database (table "e107_user_extended"). $result=mysql_query("select * from e107_user_extended where user_extended_id='$select'"); while ($row = mysql_fetch_assoc($result)) { echo ' User - Current DKP<strong>' . '<p>' . $row['user_toonm'] . " - " . $row['user_DKP'] . '</p>'; } } echo '<br><br><h3>Update this Toon\'s DKP?<h3><br>'; if(isset($_POST['dkp'])&& $_POST['dkp'] !=""){ $dkp=$_POST['dkp']; } ?> <form id='form2' name='form2' action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <label><h3>Type total DKP earned here:</h3><br /> (for example joe has 10dkp, and he earned 3 dkp tonight, input 3 into the field)<br> <input name="dkp" type="text" value="0" size="8" maxlength="8"> </label><br /> <input type="submit" value="SUBMIT" /> </form> <? //check that the input is actually a number // Execute update $sql = 'UPDATE e107_user_extended SET user_DKP = user_DKP + $dkp WHERE user_extended_id = $select'; if (@mysql_query($sql)) { echo '<p>DKP has been added.</p>'; } else { echo '<p>Error adding submitted DKP: ' . mysql_error() . '</p>'; } // Close database connection. mysql_close(); ?> </p> </body> </html>
  6. I am currently in the midst of writing some code for a site I'm building, and perhaps it's because it's so late, or perhaps I've gotten in over my head. But i simply can't figure this out. The code is supposed to select a user from the database by name in a drop down menu (that works fine) display their current total of dkp (this function is also working correctly) and then offer the admin an opportunity to update / add to the current total of DKP for the user (this is NOT working at all) following is the code. any help in this matter would be most appreciated. Thank you for your time ArcAiN6 <? // Connect database mysql_connect("localhost","myDBuser","myDBpass"); mysql_select_db("myDBname"); // If submitted, check the value of "select". If its not blank value, get the value and put it into $select. if(isset($_GET['select'])&& $_GET['select'] !=""){ $select=$_GET['select']; } ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <form id="form1" name="form1" method="get" action="<? echo $PHP_SELF; ?> "> <h4>Select Toon's Name :</h4> <select name="select"> <option value="">--- Select ---</option> <? // Get records from database (table "e107_user_extended"). $list=mysql_query("select * from e107_user_extended order by user_extended_id asc"); // Show records by while loop. while($row_list=mysql_fetch_assoc($list)){ ?> <option value="<? echo $row_list['user_extended_id']; ?>" <? if($row_list['user_extended_id']==$select){ echo "selected"; } ?>> <? echo $row_list['user_toonm']; ?></option> <? // End while loop. } ?> </select> <input type="submit" name="Submit" value="Select" /> </form> <hr> <p> <? // If you have selected from list box. if(isset($select)&&$select!=""){ // Get records from database (table "e107_user_extended"). $result=mysql_query("select * from e107_user_extended where user_extended_id='$select'"); while ($row = mysql_fetch_assoc($result)) { echo ' User - Current DKP<strong>' . '<p>' . $row['user_toonm'] . " - " . $row['user_DKP'] . '</p>'; } } echo '<br><br><h3>Update this Toon\'s DKP\?<h3><br>'; if(isset($_POST['dkp'])&& $_POST['dkp'] !=""){ $dkp=$_POST['dkp']; } ?> <form id='form2' name='form2' action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <label><h3>Type total DKP earned here:</h3><br /> (for example joe has 10dkp, and he earned 3 dkp tonight, input 3 into the field)<br> <input name="dkp" type="text" value="0" size="8" maxlength="8"> </label><br /> <input type="submit" value="SUBMIT" /> </form> <? //check that the input is actually a number // Execute update $sql = 'UPDATE user_extended SET user_DKP = user_DKP + $dkp WHERE user_extended_id = $select'; // Close database connection. mysql_close(); ?> </p> </body> </html>
  7. ok... i rewrote everything.. but now i'm not getting any type of responce.. i.e. it supposed to tell me if everything went OK, or if something went wrong... just getting a blank page... the form is not included as it's very large.. don't wanna over post.. if you guys need to see it let me know.. patch1.php [code] <?php $dbhost = "localhost"; $user = "xxxxxx"; $pw = "xxxxxxx"; $dbname = "xxxxxxxxxx"; $join = $_POST["join"] $memb = $_POST["memb"] $count = $_POST["count"] $date = date('l dS \of F Y h:I:s A'); $dbcnx = @mysql_connect($dbhost, $user, $pw);   if (!$dbcnx) {     echo( "<p>Unable to connect to the " .           "database server at this time.</p>" );     exit(); } mysql_select_db($dbname, $dbcnx); $sql = "UPDATE ibf_members,ibf_member_extra SET ibf_members.mgroup=5, ibf_member_extra.signature='Banned on $date by nExfUn script' WHERE ibf_members.id=ibf_member_extra.id AND ibf_members.mgroup=$memb AND ibf_members.posts<$count AND ibf_members.joined< UNIX_TIMESTAMP()-$join;"; if ( @mysql_query($sql) ) {   echo("<p>Update affected " . mysql_affected_rows() . " rows.</p>"); } else {   echo("<p>Error performing update: " . mysql_error() . "</p>"); } ?> [/code]
  8. I recently started a project with a group, and after lengthy discussion, i've decided that the best way to patch / update thier mysql driven forums. I was planning on using some sort of form to let the administrator select witch patch to apply, but i've run into a snag, whenever i select teh data on the form, and click submit, the screen is then blank.. here is what i have so far in it's entirity. I look forward to your suggestions and ideas :) [DIR]= /home/http/vhosts/xxxxxxxxxx.com/subdomains/cf/htdocs Form.php located in [DIR]/patches/: [code]<?php echo ("<html>"); echo ("<body>"); echo (""); echo ("<form action='complete.php' method='post'>"); echo ("<select name='Patch'>"); echo ("<option value='patch.php'>Mass Inactive Users ban</option>"); echo ("<option value=''>n/a</option>"); echo ("<option value=''>n/a</option>"); echo ("<option value=''>n/a</option>"); echo ("<option value=''>n/a</option>"); echo ("<option value=''>n/a</option>"); echo ("<option value=''>n/a</option>"); echo ("<option value=''>n/a</option>"); echo ("<option value=''>n/a</option>"); echo ("<option value=''>n/a</option>"); echo ("<option value=''>n/a</option>"); echo ("<option value=''>n/a</option>"); echo ("<option value=''>n/a</option>"); echo ("<option value=''>n/a</option>"); echo ("<option value=''>n/a</option>"); echo ("<option value=''>n/a</option>"); echo ("<option value=''>n/a</option>"); echo ("<option value=''>n/a</option>"); echo ("<option value=''>n/a</option>"); echo ("<option value=''>n/a</option>"); echo ("</select>"); echo ("<input type='submit' name='submit' value='Patch'>"); echo ("</form>"); echo (""); echo ("</body>"); echo ("</html>"); ?>[/code] Complete.php located in [DIR]/patches/: [code] <?php include = 'includes/config.php'; include = 'includes/opendb.php'; mysql_select_db($dbname, $dbcnx); include = 'includes/$patch'; if ( @mysql_query($sql) ) {   echo("<p>Update affected " . mysql_affected_rows() . " rows.</p>"); } else {   echo("<p>Error performing update: " . mysql_error() . "</p>"); } ?> [/code] config.php Located in [DIR]/includes/patches/: [code] <?php // This is an example of config.php $dbhost = 'localhost'; $dbuser = 'xxxxx'; $dbpass = 'xxxxxx'; $dbname = 'xxxxxxxxxxx'; // DO NOT EDIT BELOW THIS LINE $patch = $_POST["Patch"]; $date = date('l dS \of F Y h:I:s A'); ?> [/code] opendb.php Located in [DIR]/includes/patches/: [code] <?php     // Connect to the database server   $dbcnx = @mysql_connect("localhost", $dbuser, $dbpass);   if (!$dbcnx) {     echo( "<p>Unable to connect to the " .           "database server at this time.</p>" );     exit(); } ?> [/code] patch.php located in [DIR]/patches/ [code] <?php $sql = "UPDATE ibf_members,ibf_member_extra SET ibf_members.mgroup=5, ibf_member_extra.signature='Banned on $date by nExfUn script' WHERE ibf_members.id=ibf_member_extra.id AND ibf_members.mgroup=151 AND ibf_members.posts<20 AND ibf_members.joined< UNIX_TIMESTAMP()-2592000;"; ?> [/code] as you can see, i've attempted to make it so the admin can choose wich patch to apply by using a dropdown menu. But i've also parted everything out so it may be used again in other parts or or other standalone patches at a later date. The reason i'm attempting to do it this iway is to ease the burden on myself and the sql coder so we only need to write out as little as possible. Any help with this would be much appreciated. Sorry for including all of the files, but i thought it would be more clear to everyone that way.
  9. WEE... IT's ALIVE!!! I upgraded my MySQL server... evidently it was woefully out of date (v3.32.x) thank you guys so very much for the help :) all is peachy keen now :)
  10. hmm... somethign isn't right somewhere... maybe it's on my system, but neither suggestion worked.. I'm stillr ecieving the error...
  11. did you define the $template variable? i.e. $template = 'blah' where blah is the name of the template folder.. Or if storing the template information in the database, you will need to make a connection to the database to retrieve the template name and store it as the $template variable.
  12. I've been tweaking this for a while now, and i still can't seem to get it to work,... If anyone has any suggestions, or ideas, please let me know what could possibly be wrong with this script.. I recieve an error, but as i'm not very good with MySQL i haven't the faintest idea how to fix it.. [code] <?php //Edit before execution // change below is your assigned mySQL username $user = "xxxxxxxxxx"; // change to the pw below is your assigned mySQL password $pw = "xxxxxxxxx"; // change to the database you have permission to connect to $db = "xxxx";     //Set current Date-time we need two I to display two minute digits $date = date('l dS \of F Y h:II:s A');     // Connect to the database server   $dbcnx = @mysql_connect("localhost", $user, $pw);   if (!$dbcnx) {     echo( "<p>Unable to connect to the " .           "database server at this time.</p>" );     exit(); } mysql_select_db($db, $dbcnx); $sql = "UPDATE ibf_members,ibf_member_extra SET ibf_members.mgroup=5, ibf_member_extra.signature= \"Banned on:" .$date ." by nExfUn script\" WHERE ibf_members.id=ibf_member_extra.id AND ibf_members.mgroup=151 AND ibf_members.posts<20 AND ibf_members.joined< UNIX_TIMESTAMP()-2592000;"; if ( @mysql_query($sql) ) {   echo("<p>Update affected " . mysql_affected_rows() . " rows.</p>"); } else {   echo("<p>Error performing update: " . mysql_error() . "</p>"); } ?> [/code] an online buddy did the SQL portion for me, but he's not been online for almost a week now, and i get the following error when i try to run the script: [quote] Error performing update: You have an error in your SQL syntax near 'ibf_member_extra SET ibf_members.mgroup=5, ibf_member_extra.signature= "Banned' at line 1 [/quote] any help would be most appreciated :) -=[ ArcAiN6 ]=-
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.