Debt Consolidation - Wordpress Themes - Debt Consolidation - Free Ecards - Debt Consolidation

PDA

View Full Version : Delete Button Error


aquasonic
Jun 3rd 2008, 1:42 am
Hi,

I'm trying to add a delete button to a page so that the row can be deleted but I'm getting the following error:
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/fhlinux159/w/w-a-a.co.uk/user/htdocs/new_site/indexu.php on line 58

<?php

while($secinfo = mysql_fetch_array( $secdata ))
{
echo "<hr width='100%'>";
echo "<h1>" . $secinfo['Event_Title'] . "&nbsp;&nbsp;&nbsp;<sub>" . $secinfo['Show_Type'] . "</sub></h1>";
echo "<h1><sup><i>&nbsp;&nbsp;&nbsp;" . $secinfo['Date'] . "&nbsp;" . $secinfo['Time'] . "</i></sup></h1>";
echo "<p>" . $secinfo['Synopsis'] . "</p>";
echo "<p>" . $secinfo['Box_Office'] . "</p>";
echo "<p><button onclick=" . DELETE FROM FrontPage WHERE Event_UID = $secinfo['Event_UID']; . ">DELETE THIS EVENT</button></p>";
}
?>

Line 58 is the line with the button on it... what am I doing wrong? It's driving me mad!

xlcho
Jun 3rd 2008, 1:49 am
You've got a syntax error on this line:
echo "<p><button onclick=" . DELETE FROM FrontPage WHERE Event_UID = $secinfo['Event_UID']; . ">DELETE THIS EVENT</button></p>";
Remove the ; after $secinfo['Event_UID'] and all shall be fine :)

aquasonic
Jun 3rd 2008, 1:53 am
I still get the same error?

This is so frustrating - I can't see what's wrong?!

xlcho
Jun 3rd 2008, 3:17 am
I'm sorry, I did not pay much attention the first time. The whole idea of your script is wrong. It seems to me that you want to execute SQL query onclick of that button. That cannot happen with pure javascript. Use a form, submit it and then excute the query.
To get rid of the syntax error change the last line with this code:
echo "<p><button onclick='DELETE FROM FrontPage WHERE Event_UID =". $secinfo['Event_UID'] . "'>DELETE THIS EVENT</button></p>";
This will fix the error, but clicking the button will produce a javascript error...
Please, explain farther exactly what you want to do.