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 Code (markup): <?php while($secinfo = mysql_fetch_array( $secdata )) { echo "<hr width='100%'>"; echo "<h1>" . $secinfo['Event_Title'] . " <sub>" . $secinfo['Show_Type'] . "</sub></h1>"; echo "<h1><sup><i> " . $secinfo['Date'] . " " . $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>"; } ?> PHP: Line 58 is the line with the button on it... what am I doing wrong? It's driving me mad!
You've got a syntax error on this line: Remove the ; after $secinfo['Event_UID'] and all shall be fine
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>"; PHP: This will fix the error, but clicking the button will produce a javascript error... Please, explain farther exactly what you want to do.