Jump to content

[SOLVED] Unable to UPDATE into my database. Rediculous


Richzilla

Recommended Posts

Over night having changed nothing on my server and my php page I cannot add anything through scripts to my database. The script I was using to great success is below. For absolutely no apparent reason I can no longer update anything to the mySQL databse.

Nothing has changed on the working page. I don't even get any error messages, such as cannot connect etc. Is there anything in the setup or admin of mySQL that can be causing this?

Essentially, the script below is updating data on the database from a form on the previous page. I'm then echoing out the new result which is correct. However, when going back to the previous page the old data is still there and the database remains unchanged!!

What is going wrong???

[code<? 
$id = $_POST['id'];
$event = $_POST['event'];
$date = $_POST['date'];
$user="xxxx";
$pass="xxxx";
$host = "xxxx";
$dbase="xxxx";
mysql_connect($host,$user,$pass);
@mysql_select_db($dbase) or die("Unable to select database");
$query = "UPDATE events SET event='$event' , date='$date' WHERE id='$id'";
$result = mysql_query($query) or die(mysql_error());
$query = "SELECT * FROM events WHERE id='$id'";
$result=mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result))
  { 
$event = $row['event'];
$date = $row['date'];
}
mysql_close();
?>

<?
$page = $_GET['id'];
$link = "<a href=http://www.mysite.co.uk/update_event.php?id=";
$goback = ">go back</a>";
?>
<br>
<table width="900" border="0" align="center">
<tr><td>
<span class="trk_list_headers">You have updated the following information on the database : <br /></span>:
</td>

<table width="900" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td width="30%" align="left"><span class="time_main_text">Event : </span></td>
    <td width="70%" align="left"><span class="style1"><? echo $event ?></span> <br></td>
  </tr>
  <tr>
    <td width="30%" align="left"><span class="time_main_text">Date : </span></td>
    <td width="70%" align="left"><span class="style1"><? echo $date ?> </span><br><br /></td>
  </tr>
  <tr>
  </td>
    <table width="900" align="center"><span class="time_main_text">If this information was incorrect please <? echo "$link$page$goback" ?> and correct the error. </span></td>

  </table>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.