Jump to content

Coding error


honkan

Recommended Posts

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. 

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.