Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13
  1. #1
    Member
    Join Date
    Nov 2002
    Location
    Elmira, NY
    Posts
    41
    Member #
    261
    I have a script that I use to update my pages via the internet. This works fine on all my other cpanel servers. But when I use this on my company's hosting account at Apollo Hosting it wont update the pages. Everything appears to wor properly but in the end it will not update the database. Can anyone see anything wrong with this that may prevent it from working properly.

    PHP Code:
    <script language="JavaScript">
    <!--
    function MM_jumpMenu(targ,selObj,restore){ //v3.0
      eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
      if (restore) selObj.selectedIndex=0;
    }

    function MM_findObj(n, d) { //v3.0
      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
    }

    function MM_jumpMenuGo(selName,targ,restore){ //v3.0
      var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
    }
    //-->
    </script>

    <?

    require "../config.inc";

    $edit $_GET['edit'];
    $id $_GET['id'];

    # edit - show
    if ($edit == "show") {

    $db mysql_connect("$dbhost""$dbuser""$dbpassword"); 
    mysql_select_db("$dbname",$db);

    $result mysql_query("SELECT * FROM site WHERE id = '$id'",$db);
    $content mysql_fetch_array($result);

    do {
    $id = ($content["id"]);
    $title = ($content["title"]);
    $text = ($content["text"]);

    echo 
    "
    <form method=\"post\" action=\"?id=
    $id&edit=done\">

    <input type=\"hidden\" name=\"id\" value=\"
    $id\">

    <b>Page Title</b><br>
    <INPUT TYPE=\"TEXT\" NAME=\"title\" size=\"35\" maxlength=\"70\" class=\"text-field\" value=\"
    $title\"><p>

    <b>Page Content</b><br>
    <TEXTAREA NAME=\"text\" ROWS=\"30\" COLS=\"85\" class=\"text-field2\">
    $text</TEXTAREA><p>

    <input type=\"Submit\" name=\"submit\" value=\"Enter Information\" style=\"border:1px solid #C80708; background-color: #cccccc; color: #000000; font-weight: bold\">"
    ;

    } while (
    $content mysql_fetch_array($result));

    echo 
    "</form>";

    #edit - done
    } elseif ($edit == "done") {

    $db mysql_connect("$dbhost""$dbuser""$dbpassword"); 
    mysql_select_db("$dbname",$db);

       
    $id $_POST['id'];
       
    $title $_POST['title'];
       
    $text $_POST['text'];


            
    $sql "UPDATE site SET id='$id',title='$title',text='$text' WHERE id=$id";
            
    //replace news with your table name above 
               
    $result mysql_query($sql);
            echo 
    "<center><span class=\"main\">Thank you! Information updated.<p>
            <a href=\"edit_pages.php\">Edit Another Page</a>&nbsp;|&nbsp;
            <a href=\"index.php\">&raquo; Back to Control Panel</a></span></center>"



    #edit - else
    } else {

    $db mysql_connect("$dbhost""$dbuser""$dbpassword"); 
    mysql_select_db("$dbname",$db);

    $result mysql_query("SELECT * FROM site ORDER BY id",$db);
    $content mysql_fetch_array($result);

    echo 
    "<form name=form2>
    <select onChange=\"MM_jumpMenu('parent',this,0)\" name=menu2>
    <option value=\"\">Make a Selection</option>"
    ;

    do {
    $id = ($content["id"]);
    $title = ($content["title"]);

    echo 
    "<option value=\"?id=$id&edit=show\">$title</option>";

    } while (
    $content mysql_fetch_array($result));

    echo 
    "</select></form>";

    }

    ?>

  2.  

  3. #2
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    What isn't working? Is it giving you an error? Is none of the output coming up? Could you be a little more specific? :-)

  4. #3
    Member
    Join Date
    Nov 2002
    Location
    Elmira, NY
    Posts
    41
    Member #
    261
    everything appears to work properly, no errors at all. Its just if i insert information into the form and then click the button to update it, it appears that it updates the database but really doesnt. I works fine on one server, but this new one it doesnt.

  5. #4
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    Well, if no errors come up and all the output comes out as expected, are you sure you're putting the information in the same place you're pulling it from? Otherwise, I have no idea what's up, sorry :-/

  6. #5
    Member
    Join Date
    Nov 2002
    Location
    Elmira, NY
    Posts
    41
    Member #
    261
    I dont know what is wrong with their sorry web hosting. I have had nothing but touble doing anything on their server. This has worked fine for me for years on every host I have ever been on. Now I move this to their server and it gets stupid on me.

  7. #6
    Member
    Join Date
    Nov 2002
    Location
    Elmira, NY
    Posts
    41
    Member #
    261
    Try it out... http://synergyrecycling.com/edit_pag...id=5&edit=show . It is getting the information from the database and displaying it in the form. It allows you to type the information into the form, but when its actually supposed to update the database it says it does with no errors and when you look at the page http://synergyrecycling.com/index.php it doesnt actually update it. Btw this works fine on my cPanel 10 development server. Once moved and all the information like database name and used has been chenged it doesnt update.

    Also does someone know how to connect to a mysql database remotely? I have tried the ip address of the remote server and ipaddress:3306 where localhost is replaced and i couldnt connect. I have set cpanel to accept remote connections and it wont connect.

    PHP Code:
    <?php

    $dbhost 
    "localhost";

    $dbname "xxxxxxxxxxx";

    $dbuser "xxxxxxxxxx";

    $dbpassword "xxxxxxxxxx";

    ?>

  8. #7
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Echo out $sql and see if it looks correct.

    If it does look good-to-go, but it doesnt seem to actually update, run it through phpMyAdmin and see if it invokes an error.

  9. #8
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    Hmmm... Can you get to the datbase logs? Or the web server logs? Look for strange entries there.

  10. #9
    Member
    Join Date
    Nov 2002
    Location
    Elmira, NY
    Posts
    41
    Member #
    261
    I set the $sql to echo like suggested above everything I change looks fine and the changes echo but they arent writting to the database. So I guess its something with the UPDATE call it makes.

  11. #10
    Member
    Join Date
    Nov 2002
    Location
    Elmira, NY
    Posts
    41
    Member #
    261
    I am using the same database name, username, password for the update as I am for to call the information into the database.


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 05:25 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com