In over my head :(

Hi all I am new to the forum :smiley: I have been given the job of doing some work on our osticket system database, because I am the only one who knows some html (or the word html). I have no experience with php but am keen to lean / upskill 8)

I have managed to create a table in mysql and now I have no idea how to modify an existing piece of code to query the db and return the results.

It has taken me a week to do and I am now working after hours (so I don’t look to stupid at work:P)
Now it’s saying unexpected T_STRING, expecting ‘]’ on line 80
I have been going crazy trying to find the missing ] can some one please help me?

[php]<?php
require(‘staff.inc.php’);

$page=’’;
$answer=null; //clean start.

$nav->setTabActive(‘directory’);
$nav->addSubMenu(array(‘desc’=>‘Staff Members’,‘href’=>‘directory.php’,‘iconclass’=>‘staff’));
$nav->addSubMenu(array(‘desc’=>‘Venue’,‘href’=>‘venue.php’,‘iconclass’=>‘premade’));
$nav->addSubMenu(array(‘desc’=>‘New Venue’,‘href’=>‘add_venue.php’,‘iconclass’=>‘newPremade’));
require_once(STAFFINC_DIR.‘header.inc.php’);

$query=sprintf(“SELECT * FROM ost_venue;”);
$result=mysql_query($query);

// Count table rows
$count=mysql_num_rows($result) or die(mysql_error());;
print “$count venue found”;
?>

<?php $class = 'row1'; $counter = 0; while($rows=mysql_fetch_array($result)){ ?> <?php $class = ($class =='row2') ?'row1':'row2'; $counter = $counter +1; } ?>
Delete Enabled venue_name sn name number venue_number Department Last Updated
>On>Off

<option value=“deptId” <? if($rows['Action'] == "deptId"){print "SELECTED";}?>>Department<option value=“staffId” <? if($rows['Action'] == "staffId"){print "SELECTED";}?>>Staff

<? echo $rows['updated']; ?>
<?php $ISENABLED = $_POST['isenabled']; $venue_name = $_POST['venue_name']; $sn = $_POST['sn]; $name = $_POST['name']; $number = $_POST['number']; $venue_number = $_POST['venue_number']; $Other = $_POST['Other']; $DELETE = $_POST['deleteVenue'];

// Check if button name “Submit” is active, do this

if(isset($_POST[‘Submit’])){
for($i=0;$i<$count;$i++){
$sql1=“UPDATE ost_venue SET isenabled=’$ISENABLED[$i]’, Category=’$CATEGORY[$i]’,sn=’$SN[$i]’, name=’$NAME[$i]’, venue_name=’$VENUE_NAME[$i]’, number=’$NUMBER[$i]’, venue_number=’$venue_number[$i]’, updated=NOW() WHERE id=’$id[$i]’”;
$result=mysql_query($sql1);
if(isset($DELETE[$i])){
$sql2=“DELETE from ost_venue WHERE id=’$DELETE[$i]’”;
$result2=mysql_query($sql2);
}
}

?>

<?

}

mysql_close();
require_once(STAFFINC_DIR.‘footer.inc.php’);
?>[/php]

$sn = $_POST['sn];

should be:

$sn = $_POST[‘sn’];

missed a quote…

How did you spot that? do you have an wusiwyg editor that will show that? or are you just that good :smiley:

Thanks ErnieAlex

Now to get it to all work!

Well, just studied it for a bit… LOL Got lucky… Glad I could help… CYA in the bitstream…

Sponsor our Newsletter | Privacy Policy | Terms of Service