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
https://forums.phpfreaks.com/topic/277119-coding-error/
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
https://forums.phpfreaks.com/topic/277119-coding-error/#findComment-1425645
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.