0

Hi,

The following script gives back bummer as print, so the storing to database hasn't worked. What is wrong?

<?php

function db_connect(){

	$connect = new MySQLi("localhost", "justinmijn_root", "***", "justinmijn_nba");

	// mysql_connect_errno() retourneert 0 als er geen fouten zijn
	if (!$connect || mysqli_connect_errno() != 0) {
		throw new Exception('Er kan geen connectie tot stand gebracht worden. De volgende fout heeft zich voorgedaan:' . mysqli_connect_errno().
		' ' . mysqli_connect_error() . '<br /><br /> Als zich dit blijft voordien, gelieve de site administrator te contacteren');
	} else {
		return $connect;
	}
}


$aantalsp1w = 1;
$aantalsp1l = 2;
$aantalsp1p = 3;
$aantalsp2l = 4;
$aantalsp2w = 5;
$aantalsp2p = 6;

$team = "Boston Terriers";
$experts = "timmi";
$season = "2007-2008";

$con = db_connect();

$sides = ("'" . $aantalsp1w . "-" . $aantalsp1l . "-" . $aantalsp1p);
$totals = ("'" . $aantalsp2w . "-" . $aantalsp2l . "-" . $aantalsp2p);

$query = $con->query("INSERT INTO nba (team,expert,season,sides,totals) VALUES ('$team', '$experts', '$season', '$sides', '$totals')");

if ($query){
	print("jippie");
}else{
	print("bummer");
}
?>

Grtz

Edited by Kligham: n/a

2
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by Kligham
0

This is the output:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1-2-3', ''5-4-6')' at line 1

0

Ouch, didn't looked at that. I normally used it to write it to copy it in excel.

Thanks!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.