mjurmann Posted December 10, 2006 Share Posted December 10, 2006 Hey there. I'm building a CMS for my client, but I'm having problems. The information to be edited is filtered correctly according to "id" on the edit page. Once changes are made in the text areas boxes, and the submit button is clicked, the page is supposed to go to a update_processor page that will add the new information posted by the form to the database. Once the information is updated, the user is redirected via the Header command to the Admin's index page. I have done this many times before, and it has always worked. However, I've never got it to work with this host. I'm not sure if there is a setting I have to change or something I have to look for that allows the database to be updated via the UPDATE command. The DELETE command doesn't work either. (Haven't tried the ADD, but I'm sure it won't either.) Here is my code on the processor page:[code]<?php$host = "myhostipaddress";$user = "myusername";$pwd = "mypassword";$dbConn = mysql_connect($host,$user,$pwd);// Connect to Database$database = "alanhaft_cms";mysql_select_db($database);$query_updateEntry = "UPDATE about_cms SET id='".$_GET['id']."', paragraph1='".$_POST['p1']."', paragraph2='".$_POST['p2']."', paragraph3='".$_POST['p3']."', paragraph4='".$_POST['p4']."', paragraph5='".$_POST['p5']."' WHERE id=".$_GET['id'];$updateEntry = mysql_query($query_updateEntry);header("Location: ../index.php");?>[/code]Please help me guys! I'm using network solutions as the host and domain providers! Quote Link to comment Share on other sites More sharing options...
jbehen Posted December 10, 2006 Share Posted December 10, 2006 This might sound dumb, but the network solutions mysql servers just had a case of the stupids in the last 15 minutes. I was having issues with it as well, running an UPDATE query.I only found out it was the mysql servers when I tried to run the translated query through phpmyadmin.See if the query works directly. If not, troubleshoot from there. You may find the issue was the server, and not the code. That was my issue about 4 minutes ago.Jusy my $0.02 Quote Link to comment Share on other sites More sharing options...
mjurmann Posted December 10, 2006 Author Share Posted December 10, 2006 I really appreciate the response, However, I've been trying this since late last night - probably about 12 hours of looking at my code more times than I'd like to admit! Anyone else? I feel this has to be an option that is turned off, but I'm not sure. Quote Link to comment Share on other sites More sharing options...
jbehen Posted December 10, 2006 Share Posted December 10, 2006 Let me throw another dumb idea out there, as I am not an SQL expert by any stretch...You are setting the "id" field as well as using it to filter your query...Seems like something is wrong with that? Quote Link to comment Share on other sites More sharing options...
mjurmann Posted December 10, 2006 Author Share Posted December 10, 2006 Are you telling me I shouldn't have the SET id ? and just use it for the WHERE ? Quote Link to comment Share on other sites More sharing options...
mjurmann Posted December 10, 2006 Author Share Posted December 10, 2006 Can someone please help me, this is driving me mad. Quote Link to comment Share on other sites More sharing options...
twofivethreetwo Posted December 10, 2006 Share Posted December 10, 2006 Try removing the ' for the _GET's. It would look like this for all the $_GET's you have; $_GET[id] ... Do this only for the _GET's in your sql. Quote Link to comment Share on other sites More sharing options...
alpine Posted December 10, 2006 Share Posted December 10, 2006 just a try:[code]<?phpif(empty($_GET['id'])){ die("No id");}else{ $id = $_GET['id']; settype($id, integer);}$host = "myhostipaddress";$user = "myusername";$pwd = "mypassword";$dbConn = mysql_connect($host,$user,$pwd);// Connect to Database$database = "alanhaft_cms";mysql_select_db($database);$query_updateEntry = "UPDATE about_cms SET paragraph1='".$_POST['p1']."', paragraph2='".$_POST['p2']."', paragraph3='".$_POST['p3']."', paragraph4='".$_POST['p4']."', paragraph5='".$_POST['p5']."' WHERE id='$id'";$updateEntry = mysql_query($query_updateEntry) or die(mysql_error());header("Location: ../index.php");exit();?>[/code] Quote Link to comment Share on other sites More sharing options...
mjurmann Posted December 10, 2006 Author Share Posted December 10, 2006 No luck - that didn't work. Same issue - it's not updating. Quote Link to comment Share on other sites More sharing options...
mjurmann Posted December 10, 2006 Author Share Posted December 10, 2006 [quote author=alpine link=topic=118095.msg482326#msg482326 date=1165792478]just a try:[code]<?phpif(empty($_GET['id'])){ die("No id");}else{ $id = $_GET['id']; settype($id, integer);}$host = "myhostipaddress";$user = "myusername";$pwd = "mypassword";$dbConn = mysql_connect($host,$user,$pwd);// Connect to Database$database = "alanhaft_cms";mysql_select_db($database);$query_updateEntry = "UPDATE about_cms SET paragraph1='".$_POST['p1']."', paragraph2='".$_POST['p2']."', paragraph3='".$_POST['p3']."', paragraph4='".$_POST['p4']."', paragraph5='".$_POST['p5']."' WHERE id='$id'";$updateEntry = mysql_query($query_updateEntry) or die(mysql_error());header("Location: ../index.php");exit();?>[/code][/quote]I'm getting an error that says "No id" on the next page! What does this mean? Ahhh I can't believe that! Quote Link to comment Share on other sites More sharing options...
mjurmann Posted December 10, 2006 Author Share Posted December 10, 2006 Alpine, give me your paypal e-mail right now. I wish I could hug you right now but I'll just send you some money instead! THANK YOU SO MUCH AHHHH!!!!!! Quote Link to comment Share on other sites More sharing options...
alpine Posted December 10, 2006 Share Posted December 10, 2006 *lol*i'll never be rich by this anyhow so keep your money!This points however out the use of debugging! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.