This is my first post on this forum so i hope it will prove useful.
First of all I'm new to mysql and php, I've only coded in xhtml, css so far, now I'm trying to make a simple quiz, I did a little research, and found a simple quiz script(PHP-MySQL-Quiz 1.0) by widgetmonkey. Ever since(actually this morning
-------------
Notice: Undefined variable: table in C:\Program Files\EasyPHP 2.0b1\www\quizv1.0\quizv1.0\quiz1.php on line 7
Notice: Undefined variable: db in C:\Program Files\EasyPHP 2.0b1\www\quizv1.0\quizv1.0\quiz1.php on line 7
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in C:\Program Files\EasyPHP 2.0b1\www\quizv1.0\quizv1.0\quiz1.php on line 7
Notice: Undefined variable: submit in C:\Program Files\EasyPHP 2.0b1\www\quizv1.0\quizv1.0\quiz1.php on line 9
Notice: Undefined variable: PHP_SELF in C:\Program Files\EasyPHP 2.0b1\www\quizv1.0\quizv1.0\quiz1.php on line 12
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Program Files\EasyPHP 2.0b1\www\quizv1.0\quizv1.0\quiz1.php on line 15
--------------
in my browser. I think it does not connect properly to the database, maby you guys can help me out.
This are the db connection details:
config.php containing:
Code: Select all
<?
$database = "quiz_db";
$user = "quiz_usr";
$pass = "bauhaus";
$hostname = "localhost";
$table = "quiz";
?>
contentdb.php containing:
Code: Select all
<?
include("config.php");
$db = mysql_connect("$hostname", "$user","$pass");
mysql_select_db("$database",$db);
?>
and then the actual php file containing the quiz:
Code: Select all
<?php
include("contentdb.php");
$display = mysql_query("SELECT * FROM $table ORDER BY id",$db);
I have only posted the code lines which I think contain the problem, If you need more details just ask.
I configured the usr and password in mysql, created the db, and imported the table quiz from the installation kit of the quiz.
Hope this is enough to make an idea.
Thanks in advance!