0

The php in the javascript code is coming back as the php statememnt rather than the $_GET value is there something in the config that needs to be changed? This worked on a university apache server but doesnt seem to be in this case, PHP and javascript is working on other pages just fine. The delete works fine too.

<SCRIPT LANGUAGE="JavaScript">
  setTimeout(function(){
  alert("<?echo $_GET['deletename']?> Deleted, you will now return to the Artist Search...")
    window.location = "http://www.aaaaa.tk/CI/index.php/about?deletedartist=<?echo $_GET['deletename']?>";
  }, 100);

 </script>
 <link rel="stylesheet" type="text/css" href="main.css">
 </head>
 <?php

 $artistid = $_GET['deleteid'];

$username="X";
$password="X";
$database="X";
mysql_connect(localhost,$username,$password) or die("Could not connect : " . mysql_error()); 
@mysql_select_db($database) or die( "Unable to select database");
/* Performing SQL query */ 
$query = "DELETE FROM fbartist WHERE id =$artistid"; 
$query2 = "ALTER TABLE fbartist AUTO_INCREMENT=1;"; 
$result = mysql_query($query) or die("Delete Query failed :".$query."" . mysql_error()); 
$result2 = mysql_query($query2) or die("Auto Increment Query failed : " . mysql_error()); 

mysql_close(); 
?>

Thanks for any help given.

1
  • Is it the missing semicolon after your alert statement? Commented Jun 30, 2013 at 14:41

1 Answer 1

2

Either try

alert("<?php echo ....

or

check php.ini for short_open_tag = on, see here.

Sign up to request clarification or add additional context in comments.

1 Comment

Yes it was the missing php at the beginning tag, I thought I had done all of those, my bad. Thanks for your help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.