I have made a database called survey and a table called results. The results table has 7 fields: degree, relevance, level, convienence, recommend, add
I'm having problems with the following block of code-
<?php
$degree=4;
$link=mysql_connect("localhost","mysql")
or die("could not connect");
mysql_select_db("survey") or die("could not open database");
function hup(){
$link;
$query="INSERT INTO results (degree,relevance,level,convienence,recommend,add)
VALUES('1','2','3','4','5','6')";
$query or die ("wrong");
echo "ok";
$result=mysql_query("select * from results") or
die(mysql_error());
while ($row=mysql_fetch_array($result)){
echo "<b>Degree:</b>";
echo $row["degree"];
echo "<b>\n";
echo "<b> Course Relevance:</b>";
echo $row["relevance"];
echo "<b>\n";
echo "<b>Level of instrution:</b>";
echo $row["level"];
echo "<b>\n";
echo "<b>Convienence of class times:</b>";
echo $row["convienence"];
echo "<b>\n";
echo "<b>Would recommend courses at SSCC to others:</b>";
echo $row["recommend"];
echo "<br><br>";
echo "<b>Suggested additions to course offerings:</b>";
echo $row["add"];
}
mysql_free_result($result);
}
hup();
?>
When I run this, instead of seeing the values 1,2,3,4,5,6 printed to the browser, all I see is "ok". Also, when I look at my database with PHP MyAdmin nothing has been inserted to results.
Any clues as to where I've gone wrong with this? I'm connecting to the db just fine, but not much seems to happen after that.
/* Sure, go ahead and code in your fancy IDE. Just remember: it's all fun and games until someone puts an $i out */