honkan Posted April 18, 2013 Share Posted April 18, 2013 I'm VERY new at any kind of coding, and tryed to follow some instruction for creating a simple forum. <?php session_start(); require"db_connect.php"; $sql = "ELECT forum_id, forum_navn, FROM forum"; if($query = $db->prepare($sql))( $query->bind_result($f_id, $f_name); $query->execute(); $query->store_result(); )else( echo $db->error; ) ?> nets me the error ( ! ) SCREAM: Error suppression ignored for ( ! ) Parse error: syntax error, unexpected ';' in C:\wamp\www\mcklubb\test3.php on line 6 when I try to test to page. I can'f figure it out. Any help is apriciated. If this is not something I can ask for help for here I apologize. Quote Link to comment https://forums.phpfreaks.com/topic/277119-coding-error/ Share on other sites More sharing options...
Psycho Posted April 18, 2013 Share Posted April 18, 2013 You need to pay closer attention to your code. 1. Your query is malformed. $sql = "ELECT forum_id, forum_navn, FROM forum"; There should not be a comma after the last field (forum_nav) and the "FROM" keyword 2. To create code blocks, you use the curly braces, {}, not parent (). You are using parens to create the code blocks for the IF/ELSE conditions Quote Link to comment https://forums.phpfreaks.com/topic/277119-coding-error/#findComment-1425645 Share on other sites More sharing options...
Barand Posted April 18, 2013 Share Posted April 18, 2013 Also, the query should begin with "SELECT" and not "ELECT" Quote Link to comment https://forums.phpfreaks.com/topic/277119-coding-error/#findComment-1425650 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.