Captain09 Posted August 20, 2012 Share Posted August 20, 2012 I don't have any knowledge about mysql so: how to code that it should delete the entry in the table where end = 1? mysql connect is no problem thanks Captain09 Quote Link to comment https://forums.phpfreaks.com/topic/267347-delete-mysql-entry-in-a-table/ Share on other sites More sharing options...
Christian F. Posted August 20, 2012 Share Posted August 20, 2012 http://www.tutorialspoint.com/mysql/mysql-delete-query.htm Quote Link to comment https://forums.phpfreaks.com/topic/267347-delete-mysql-entry-in-a-table/#findComment-1370891 Share on other sites More sharing options...
Captain09 Posted August 20, 2012 Author Share Posted August 20, 2012 here is my file: mysql_connect(SQL_SERVER, SQL_USER, SQL_PASS); mysql_select_db(SQL_DB); $sql = mysql_query("SELECT * FROM ".TB_PREFIX."adventure"); DELETE FROM ".TB_PREFIX."adventure WHERE end="1" mysql_select_db('adventure'); $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('Could not delete data: ' . mysql_error()); } mysql_close($conn); and I get this error: Parse error: syntax error, unexpected T_STRING in /var/customers/webs/Killer0709/deladventure.php on line 5 Quote Link to comment https://forums.phpfreaks.com/topic/267347-delete-mysql-entry-in-a-table/#findComment-1370903 Share on other sites More sharing options...
Pikachu2000 Posted August 20, 2012 Share Posted August 20, 2012 You have a random query string in the middle of your code, not assigned to a variable or used in a function. Quote Link to comment https://forums.phpfreaks.com/topic/267347-delete-mysql-entry-in-a-table/#findComment-1370919 Share on other sites More sharing options...
Captain09 Posted August 20, 2012 Author Share Posted August 20, 2012 where??? :o Quote Link to comment https://forums.phpfreaks.com/topic/267347-delete-mysql-entry-in-a-table/#findComment-1370965 Share on other sites More sharing options...
Pikachu2000 Posted August 20, 2012 Share Posted August 20, 2012 You really don't see it? Doesn't your editor support syntax highlighting? Look at the post above and see if you can spot it. Quote Link to comment https://forums.phpfreaks.com/topic/267347-delete-mysql-entry-in-a-table/#findComment-1370967 Share on other sites More sharing options...
Captain09 Posted August 20, 2012 Author Share Posted August 20, 2012 nope no idea Quote Link to comment https://forums.phpfreaks.com/topic/267347-delete-mysql-entry-in-a-table/#findComment-1370968 Share on other sites More sharing options...
Christian F. Posted August 20, 2012 Share Posted August 20, 2012 Sounds like you'll need to step by here and here. Quote Link to comment https://forums.phpfreaks.com/topic/267347-delete-mysql-entry-in-a-table/#findComment-1370971 Share on other sites More sharing options...
Captain09 Posted August 20, 2012 Author Share Posted August 20, 2012 just tell me I never worked with mysql Quote Link to comment https://forums.phpfreaks.com/topic/267347-delete-mysql-entry-in-a-table/#findComment-1370984 Share on other sites More sharing options...
fenway Posted August 20, 2012 Share Posted August 20, 2012 just tell me I never worked with mysql Why should we 'just tell you' -- this is site for people to exchange ideas -- not a site to demand answers. If you really don't understand these comments, then this isn't your script. Which means you shouldn't be changing it without understanding how it works. Quote Link to comment https://forums.phpfreaks.com/topic/267347-delete-mysql-entry-in-a-table/#findComment-1370990 Share on other sites More sharing options...
Pikachu2000 Posted August 21, 2012 Share Posted August 21, 2012 Aside from that, it isn't a MySQL problem. It's a basic php syntax problem, and the error is a php error message. Quote Link to comment https://forums.phpfreaks.com/topic/267347-delete-mysql-entry-in-a-table/#findComment-1370994 Share on other sites More sharing options...
Captain09 Posted August 21, 2012 Author Share Posted August 21, 2012 one moment Quote Link to comment https://forums.phpfreaks.com/topic/267347-delete-mysql-entry-in-a-table/#findComment-1370996 Share on other sites More sharing options...
Captain09 Posted August 21, 2012 Author Share Posted August 21, 2012 mysql_connect(SQL_SERVER, SQL_USER, SQL_PASS); mysql_select_db(SQL_DB); mysql_query("SELECT * FROM ".TB_PREFIX."adventure"); mysql_query("FROM ".TB_PREFIX."adventure WHERE end= 1"); mysql_close; new error(s): Warning: mysql_connect(): Access denied for user 'SQL_USER'@'176.9.37.48' (using password: YES) in /var/customers/webs/Killer0709/deladventure.php on line 2 Call Stack: 0.0002 644936 1. {main}() /var/customers/webs/Killer0709/deladventure.php:0 0.0002 645448 2. mysql_connect() /var/customers/webs/Killer0709/deladventure.php:2 Warning: mysql_select_db(): Access denied for user ''@'localhost' (using password: NO) in /var/customers/webs/Killer0709/deladventure.php on line 3 Call Stack: 0.0002 644936 1. {main}() /var/customers/webs/Killer0709/deladventure.php:0 0.0009 645272 2. mysql_select_db() /var/customers/webs/Killer0709/deladventure.php:3 Warning: mysql_select_db(): A link to the server could not be established in /var/customers/webs/Killer0709/deladventure.php on line 3 Call Stack: 0.0002 644936 1. {main}() /var/customers/webs/Killer0709/deladventure.php:0 0.0009 645272 2. mysql_select_db() /var/customers/webs/Killer0709/deladventure.php:3 Warning: mysql_query(): Access denied for user ''@'localhost' (using password: NO) in /var/customers/webs/Killer0709/deladventure.php on line 4 Call Stack: 0.0002 644936 1. {main}() /var/customers/webs/Killer0709/deladventure.php:0 0.0011 645296 2. mysql_query() /var/customers/webs/Killer0709/deladventure.php:4 Warning: mysql_query(): A link to the server could not be established in /var/customers/webs/Killer0709/deladventure.php on line 4 Call Stack: 0.0002 644936 1. {main}() /var/customers/webs/Killer0709/deladventure.php:0 0.0011 645296 2. mysql_query() /var/customers/webs/Killer0709/deladventure.php:4 Warning: mysql_query(): Access denied for user ''@'localhost' (using password: NO) in /var/customers/webs/Killer0709/deladventure.php on line 5 Call Stack: 0.0002 644936 1. {main}() /var/customers/webs/Killer0709/deladventure.php:0 0.0013 645296 2. mysql_query() /var/customers/webs/Killer0709/deladventure.php:5 Warning: mysql_query(): A link to the server could not be established in /var/customers/webs/Killer0709/deladventure.php on line 5 Call Stack: 0.0002 644936 1. {main}() /var/customers/webs/Killer0709/deladventure.php:0 0.0013 645296 2. mysql_query() /var/customers/webs/Killer0709/deladventure.php:5 I do not understand the world anymore... Quote Link to comment https://forums.phpfreaks.com/topic/267347-delete-mysql-entry-in-a-table/#findComment-1370998 Share on other sites More sharing options...
Pikachu2000 Posted August 21, 2012 Share Posted August 21, 2012 Where have you defined the constants SQL_SERVER, SQL_USER, and SQL_PASS? You should be getting 'undefined constant' notices regarding those as well. Quote Link to comment https://forums.phpfreaks.com/topic/267347-delete-mysql-entry-in-a-table/#findComment-1370999 Share on other sites More sharing options...
Captain09 Posted August 21, 2012 Author Share Posted August 21, 2012 in the config it says too: mysql_connect(SQL_SERVER, SQL_USER, SQL_PASS); mysql_select_db(SQL_DB); $sql = mysql_query("SELECT * FROM ".TB_PREFIX."config"); $result = mysql_fetch_array($sql); Quote Link to comment https://forums.phpfreaks.com/topic/267347-delete-mysql-entry-in-a-table/#findComment-1371000 Share on other sites More sharing options...
Christian F. Posted August 21, 2012 Share Posted August 21, 2012 You know, the reason I gave you those links instead of "just telling you" was because you really do need to learn the basics. Everything you've posted so far has demonstrated a clear and desperate lack of knowledge about the basics, which you will need to correct in order to get this working. You wouldn't just jump into a rally car to race it against professionals, if you didn't even know how to drive in the first place. Would you? Quote Link to comment https://forums.phpfreaks.com/topic/267347-delete-mysql-entry-in-a-table/#findComment-1371004 Share on other sites More sharing options...
Captain09 Posted August 21, 2012 Author Share Posted August 21, 2012 oh man I can enough php for that the only thing I have to find out is how it should connect to the dbase cause I see no data in this script... That you just post things like Learn the Basics doesn't help me actually... Quote Link to comment https://forums.phpfreaks.com/topic/267347-delete-mysql-entry-in-a-table/#findComment-1371007 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.