Did a program create a bad script?
Posted: Sun Feb 08, 2004 4:25 pm
I used a program called PHP Database Wizard to create the PHP for a project I'm working on. I then started pulling the info into notepad then editing the html so that it was in the look I wanted to pull off what I need. However the update function does not work properly. Instead of updating the information, it only repulls the data from the MySQL db. Seeing as how I've only worked with PHP for a couple of weeks, can any of the experts here help me figure this out and get it running?
I am running the latest stable edtions of PHP, Apache (as a local host), and MySql.
I think it has something to do with those periods but I'm too inexperienced with this to figure out whats really going on.
I am running the latest stable edtions of PHP, Apache (as a local host), and MySql.
I think it has something to do with those periods but I'm too inexperienced with this to figure out whats really going on.
Code: Select all
<?php
require_once('Db\db_connection.php');
global $MyDb;
$actPage = $HTTP_SERVER_VARSї"PHP_SELF"];
$maxRows = 24;
$pageNr = 0;
$rowbg = 'true';
$pageNr = $_POSTї'pageNr'];
$orderSql = $_POSTї'orderSql'];
$selectAllSql = "SELECT * FROM txtprices ".$filterSql;
$ResultAll = $MyDb->f_ExecuteSql($selectAllSql);
$ResultAllRows = $MyDb->f_GetSelectedRows($ResultAll);
$startRow = $pageNr * $maxRows;
$selectSql = "SELECT * FROM txtprices";
$limitSql = " LIMIT ".$startRow." , ".$maxRows;
$selectSql = $selectSql.$filterSql.$orderSql.$limitSql;
$Result = $MyDb->f_ExecuteSql($selectSql);
$Resultset = $MyDb->f_GetRecord($Result);
$ResultRowNr = $MyDb->f_GetSelectedRows($Result);
$actRow=0;
?>
<html>
<head>
<title>Ticket Prices</title>
<link href="Style/style.css" rel="stylesheet" type="text/css">
<script languange="javascript" src="Scripts/script.js"></script>
</head>
<body>
<form name="UpdateForm" method="post" action="<?php echo $PHP_SELF ?>">
<table width="330" border="0" align="center" cellpadding="0" cellspacing="0" class="tableborder">
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<th class="th1" width="70">Ticket ID</th>
<th class="th1" width="130">Ticket Type</th>
<th class="th1">Regular Prices</th>
<th class="th1">Group Prices</th>
</tr>
<?php do { ?>
<tr <?php if ($rowbg =='true') { $rowbg='false'; echo 'class="tr1"';} else { $rowbg='true'; echo 'class="tr2"';} echo "onMouseOver="this.className='tract'""; if ($rowbg == 'true') echo ' onMouseOut="this.className=''tr2''"'; else echo 'onMouseOut="this.className=''tr1''"';?> >
<td class="td1"><font face="verdana" color="#000000"><?php if ($Resultsetї'txtid'] != "") echo $Resultsetї'txtid']; else echo " ";?> </font></td>
<td class="td1"><font face="verdana" color="#000000"><?php if ($Resultsetї'type'] != "") echo $Resultsetї'type']; else echo " ";?> </font></td>
<td class="td1" align="center">
<input class="input_normal"
type="text"
name="rprices"
id="rprices"
value="<?php echo $Resultsetї'rprices']; ?>"
size="10"
maxlength="7"
onFocus="this.className='inputact'"
onBlur="this.className='inputOk'">
</td>
<td class="td1" align="center">
<input class="input_normal"
type="text"
name="gprices"
id="gprices"
value="<?php echo $Resultsetї'gprices']; ?>"
size="10"
maxlength="7"
onFocus="this.className='inputact'"
onBlur="this.className='inputOk'">
</td>
</tr>
<?php } while ($Resultset = $MyDb->f_GetRecord($Result)); ?>
</table>
</td>
</tr>
</table>
<center><input type="image" src="Images/update.gif" name="SubmitForm" border=0></center>
</form>
</body>
</html>
<?php
$updateSql = "UPDATE txtprices SET "
.",rprices="".$_POSTї'rprices']."""
.",gprices="".$_POSTї'gprices']."""
." WHERE = '".$_GETї'']."'";
$MyDb->f_ExecuteSql($updateSql);
?>