182x Posted July 20, 2007 Share Posted July 20, 2007 hey guys, just wondering where I went wrong with this syntax? Thanks $get= "SELECT * FROM use WHERE Id = $Id AND acc= $acc"; $query= mysql_query($get, $link_id) or die(mysql_error()); $temp=mysql_fetch_array($query) $del="DELETE FROM tech WHERE techId= $temp['Id']"; $mysql_query($del, $link_id)or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/60886-syntax-error/ Share on other sites More sharing options...
benjaminbeazy Posted July 20, 2007 Share Posted July 20, 2007 $mysql_query($del, $link_id)or die(mysql_error()); should be mysql_query($del, $link_id)or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/60886-syntax-error/#findComment-302959 Share on other sites More sharing options...
182x Posted July 20, 2007 Author Share Posted July 20, 2007 Still getting the same syntax error seems to be with this part of the code WHERE techId= $temp['Id']"; any ideas? Link to comment https://forums.phpfreaks.com/topic/60886-syntax-error/#findComment-302966 Share on other sites More sharing options...
vbnullchar Posted July 20, 2007 Share Posted July 20, 2007 try this <?php $del="DELETE FROM tech WHERE techId= '$temp[id]'"; ?> Link to comment https://forums.phpfreaks.com/topic/60886-syntax-error/#findComment-302969 Share on other sites More sharing options...
benjaminbeazy Posted July 20, 2007 Share Posted July 20, 2007 Still getting the same syntax error seems to be with this part of the code WHERE techId= $temp['Id']"; any ideas? try WHERE techId = {$temp['Id']}"; if $query is returning more than 1 result you need to add a limit or use a loop... Link to comment https://forums.phpfreaks.com/topic/60886-syntax-error/#findComment-302970 Share on other sites More sharing options...
182x Posted July 20, 2007 Author Share Posted July 20, 2007 with both I recieve the following error, anymore syntax suggestions? Parse error: syntax error, unexpected T_VARIABLE Link to comment https://forums.phpfreaks.com/topic/60886-syntax-error/#findComment-303018 Share on other sites More sharing options...
TheFilmGod Posted July 20, 2007 Share Posted July 20, 2007 WHERE techId= "$temp['Id']"; ??? What about that? Link to comment https://forums.phpfreaks.com/topic/60886-syntax-error/#findComment-303047 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.