Jump to content

Recommended Posts

I have created updateable databases using dreamweaver code. On my last host, I kept mysteriously losing record rows, that then showed up as "overhead" under usage in phpMyAdmin. I thought it was the host, but the same problem is occuring with my new host. I dont know what is wrong. Somebody said it might be my password, does this make any sense? The data loss is totally random, ie any day, any time, any row. Below is my code generated by dreamweaver for the page the data is displayed on and below that is the code for the page the data is inserted on. The site is www.johnherrigel.com. THe page where I input data in is www.johnherrigel/Office/ojournal.php. Any helps or direction someone can point me in would be greatly appreciated. Thanks for your help. John

 

 

Page it displays on:

 

Header section:

<?php require_once('Connections/John.php'); ?>

<?php

$maxRows_rsMain = 1;

$pageNum_rsMain = 0;

if (isset($_GET['pageNum_rsMain'])) {

$pageNum_rsMain = $_GET['pageNum_rsMain'];

}

$startRow_rsMain = $pageNum_rsMain * $maxRows_rsMain;

 

mysql_select_db($database_John, $John);

$query_rsMain = "SELECT `date`, title, description FROM journal ORDER BY `date` DESC";

$query_limit_rsMain = sprintf("%s LIMIT %d, %d", $query_rsMain, $startRow_rsMain, $maxRows_rsMain);

$rsMain = mysql_query($query_limit_rsMain, $John) or die(mysql_error());

$row_rsMain = mysql_fetch_assoc($rsMain);

 

if (isset($_GET['totalRows_rsMain'])) {

$totalRows_rsMain = $_GET['totalRows_rsMain'];

} else {

$all_rsMain = mysql_query($query_rsMain);

$totalRows_rsMain = mysql_num_rows($all_rsMain);

}

$totalPages_rsMain = ceil($totalRows_rsMain/$maxRows_rsMain)-1;

?>

 

Where it displays:

 

 

<?php do { ?>

<tr>

<td align="left" valign="top"><span class="style2"><?php echo $row_rsMain['date']; ?></span>-<?php echo $row_rsMain['description']; ?></td>

</tr>

<?php } while ($row_rsMain = mysql_fetch_assoc($rsMain)); ?>

</table>

 

 

Page I insert it data from:

 

Header Code

 

<?php require_once('../Connections/John.php'); ?>

<?php

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

{

$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

 

switch ($theType) {

case "text":

$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

break;

case "long":

case "int":

$theValue = ($theValue != "") ? intval($theValue) : "NULL";

break;

case "double":

$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";

break;

case "date":

$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

break;

case "defined":

$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;

break;

}

return $theValue;

}

 

$editFormAction = $_SERVER['PHP_SELF'];

if (isset($_SERVER['QUERY_STRING'])) {

$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);

}

 

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {

$insertSQL = sprintf("INSERT INTO journal (`date`, title, description) VALUES (%s, %s, %s)",

GetSQLValueString($_POST['date'], "text"),

GetSQLValueString($_POST['title'], "text"),

GetSQLValueString($_POST['description'], "text"));

 

mysql_select_db($database_John, $John);

$Result1 = mysql_query($insertSQL, $John) or die(mysql_error());

 

$insertGoTo = "/office.php";

if (isset($_SERVER['QUERY_STRING'])) {

$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";

$insertGoTo .= $_SERVER['QUERY_STRING'];

}

header(sprintf("Location: %s", $insertGoTo));

}

 

mysql_select_db($database_John, $John);

$query_rsEntry = "SELECT * FROM journal ORDER BY `date` DESC";

$rsEntry = mysql_query($query_rsEntry, $John) or die(mysql_error());

$row_rsEntry = mysql_fetch_assoc($rsEntry);

$totalRows_rsEntry = mysql_num_rows($rsEntry);

?>

 

Content section

<form method="post" name="form1" action="<?php echo $editFormAction; ?>">

<div align="center">

<table align="center">

<tr valign="baseline">

<td nowrap align="right">Title:</td>

<td><input type="text" name="title" value="" size="32">

*Optional </td>

</tr>

<tr valign="baseline">

<td nowrap align="right" valign="top">Entry:</td>

<td><textarea name="description" cols="50" rows="5"></textarea>

</td>

</tr>

<tr valign="baseline">

<td colspan="2" align="right" nowrap><div align="center">

<input type="submit" value="Add Entry">

</div></td>

</tr>

</table>

<input type="hidden" name="date" value="<?php echo date('m/d/y'); ?>">

<input type="hidden" name="MM_insert" value="form1">

</div>

</form>

<p align="center" class="style1">Edit an Entry by clicking on the date </p>

 

<div align="center">

<table border="0">

<?php do { ?>

<tr>

<td><a href="../Office/editentry.php?ENTRY=<?php echo $row_rsEntry['id']; ?>"><?php echo $row_rsEntry['date']; ?></a></td>

</tr>

<?php } while ($row_rsEntry = mysql_fetch_assoc($rsEntry)); ?>

</table>

 

Link to comment
https://forums.phpfreaks.com/topic/3003-loss-of-data-to-overhead/
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.