Forum Moderators: coopster

Message Too Old, No Replies

PHP doesn't update MySQL queries

         

dbzfyam

6:24 pm on Aug 31, 2007 (gmt 0)

10+ Year Member



I recently changed servers on my host due to new servers. On my old server, I had PHP 4.4.3 and MySQL 5.0.26. On the new one I have PHP 5.1.4 and MySQL 4.1.21. For some reason, my site doesn't seem to be working properly on the new server (worked fine on the old one). It does seem to fetch data from the database and display it, but when I try to add, update or delete rows, it just doesn't do anything.

I have included a PHP script from my admin panel (removed some irrelevant code) below which doesn't work anymore. I also tried replacing "mysql" with "mysqli" in the code without success.

Can anyone help me with this?

Thanks in advance,
Stefan


<?php
include_once ("database.php");
include_once ("asecurity_header.php");
include("wysiwyg.php");
mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname) or die(mysql_error());
if ($_GET['page'] == "update") {
$title = $_POST['titel'];
$content = $_POST['content'];
$activated = $_POST['active'];
$sql = "UPDATE mp_site_info_bottom SET title='$title', content='$content', activated='$activated' WHERE ID=1";
$query = mysql_query($sql);
}
?>

eelixduppy

6:28 pm on Aug 31, 2007 (gmt 0)



Add the following:

$query = mysql_query($sql) [b]or die(mysql_error())[/b];

Give us the error that this produces.

dbzfyam

6:43 pm on Aug 31, 2007 (gmt 0)

10+ Year Member



Tried that aswell but it doesn't display any error.

Edit: Found the problem. Apparently, my editors (openWYSIWYG) don't work properly under the new server when I add,update or delete rows without www in the address bar (for example website.com instead of www.website.com). When I do add www it does work.

Thanks for trying to help.

Stefan