I have a problem... I have installed PHP Apache and Mysql on my windows system PHP and Mysql is the new version but Apache is 1.35. When i try to insert information into the database with this code you see bellow it doesn't work... but i can extract information from the database and put it on a webpage... Can't see what the trouble is...
<?php
include './global/dblib.php';
if(!empty($Submit)){
$sql="INSERT INTO ubn_klotter(id,namn,text) VALUES ('$id','$namn','$text')";
mysql_query("$sql");
}
$result = mysql_query("SELECT * FROM ubn_klotter ORDER BY id ASC");
?>
Here is a menu code i made in php that also doesn't work localy but on the main webserver it works like a charm... When clicking on Webshop there should be a foldout and show the links in Webshop but it doesn't work for some reson...
<?php
function lista(){
global $val;
if($val=="info"){
echo"<table width=\"50\" border=\"0\">";
echo" <tr>";
echo" <td nowrap=\"nowrap\"><img src=\"./images/unfold.gif\"border='0'>Information<br><img src=\"./images/space.gif\"><a href='news.php' target='mainFrame' class='forumlink'>Nyheter</a><br><img src=\"./images/space.gif\"><a href='villkor.php' target='mainFrame' class='forumlink'>Köpvillkor</a><br></td>";
echo" </tr><tr>";
echo" <td nowrap=\"nowrap\"><img src=\"./images/fold.gif\"border='0'><a href=\"left.php?val=shop\" class=\"forumlink\">Webshop</a></td>";
echo" </tr><tr>";
echo" <td nowrap=\"nowrap\"><img src=\"./images/fold.gif\"border='0'><a href=\"left.php?val=kont\" class=\"forumlink\">Kontakta</a></td>";
echo" </tr><tr>";
echo"</table>";
}
else if($val=="shop"){
echo"<table width=\"50\" border=\"0\">";
echo" <tr>";
echo" <td nowrap=\"nowrap\"><img src=\"./images/fold.gif\" border='0'><a href=\"left.php?val=info\" class=\"forumlink\">Information</a></td>";
echo" </tr><tr>";
echo" <td nowrap=\"nowrap\"><img src=\"./images/unfold.gif\" border='0'>Webshop<br>";
echo" <img src=\"./images/space.gif\" border='0'><img src=\"./images/fold.gif\" border='0'><a href=\"left.php?val=Cell Entertainment\" class=\"forumlink\">Cell Entertainment</a><br>";
echo" <img src=\"./images/space.gif\"><a href=\"left.php?val=Games-Workshop\" class=\"forumlink\"><img src=\"./images/fold.gif\" border='0'>Games Workshop</a><br>";
echo" <img src=\"./images/space.gif\"><a href=\"left.php?val=Utförsäljning\" class=\"forumlink\"><img src=\"./images/fold.gif\" border='0'>Utförsäljning</a><br><br>";
echo" <img src=\"./images/space.gif\"><a href='kassa.php' class='forumlink' target='mainFrame' class='forumlink'>Gå till kassan</a></td>";
echo" </tr><tr>";
echo" <td nowrap=\"nowrap\"><img src=\"./images/fold.gif\" border='0'><a href=\"left.php?val=kont\" class=\"forumlink\">Kontakta</a></td>";
echo" </tr>";
echo"</table>";
}
//Länkarna till GW
else if($val=="Games-Workshop"){
$result = mysql_query("SELECT * FROM webshop_kategori WHERE foretag = '$val' ORDER BY kategori ASC");
echo"<table width=\"50\" border=\"0\">";
echo" <tr>";
echo" <td nowrap=\"nowrap\"><img src=\"./images/fold.gif\" border='0'><a href=\"left.php?val=info\" class=\"forumlink\">Information</a></td>";
echo" </tr><tr>";
echo" <td nowrap=\"nowrap\"><img src=\"./images/space.gif\" border='0'><img src=\"./images/fold.gif\" border='0'><a href=\"left.php?val=Cell Entertainment\" class=\"forumlink\">Cell Entertainment</a><br>";
echo" <img src=\"./images/space.gif\"><img src=\"./images/unfold.gif\" border='0'>Games Workshop<br>";
while ($row = mysql_fetch_array($result)){
echo "<img src=\"./images/space.gif\" width=\"57\" height=\"16\" /><a href=\"val.php?val=$row[kategori]&foretag=$val\" target=\"mainFrame\" class=\"forumlink\"><font size=\"2\">$row[kategori]</font></a><br>";
}
echo"<img src=\"./images/space.gif\"><img src=\"./images/fold.gif\" border='0'>Utförsäljning<br><br><img src=\"./images/space.gif\"><a href='kassa.php' class='forumlink' target='mainFrame' class='forumlink'>Gå till kassan</a></td>";
echo" </tr><tr>";
echo" <td nowrap=\"nowrap\"><img src=\"./images/fold.gif\" border='0'><a href=\"left.php?val=kont\" class=\"forumlink\">Kontakta</a></td>";
echo" </tr>";
echo"</table>";
}
//Länkarna till Utförsäljning
else if($val=="Utförsäljning"){
$result = mysql_query("SELECT * FROM webshop_kategori WHERE foretag = '$val' ORDER BY kategori ASC");
echo"<table width=\"50\" border=\"0\">";
echo" <tr>";
echo" <td nowrap=\"nowrap\"><img src=\"./images/fold.gif\"><a href=\"left.php?val=info\" class=\"forumlink\">Information</a></td>";
echo" </tr><tr>";
echo" <td nowrap=\"nowrap\"><img src=\"./images/fold.gif\">Webshop<br><img src=\"./images/space.gif\"><a href=\"left.php?foretag=Cell Entertainment\" class=\"forumlink\"><img src=\"./images/fold.gif\" border='0'>Cell Entertainment</a><br><img src=\"./images/space.gif\"><a href=\"left.php?val=Games-Workshop\" class=\"forumlink\"><img src=\"./images/fold.gif\" border='0'>Games Workshop</a><br>";
echo"<img src=\"./images/space.gif\"><img src=\"./images/unfold.gif\">Utförsäljning<br>";
while ($row = mysql_fetch_array($result)){
echo "<img src=\"./images/space.gif\" width=\"57\" height=\"16\" /><a href=\"val.php?val=$row[kategori]&foretag=$val\" target=\"mainFrame\" class=\"forumlink\"><font size=\"2\">$row[kategori]</font></a><br>";
}
echo" <img src=\"./images/space.gif\"><a href='kassa.php' class='forumlink' target='mainFrame' class='forumlink'><a href='kassa.php' class='forumlink' target='mainFrame' class='forumlink'>Gå till kassan</a></a></td>";
echo" </tr><tr>";
echo" <td nowrap=\"nowrap\"><img src=\"./images/fold.gif\"><a href=\"left.php?val=kont\" class=\"forumlink\">Kontakta</a></td>";
echo" </tr>";
echo"</table>";
}
//Länkarna till Cell
else if($val=="Cell Entertainment"){
$result = mysql_query("SELECT * FROM webshop_kategori WHERE foretag = '$val' ORDER BY kategori ASC");
echo"<table width=\"50\" border=\"0\">";
echo" <tr>";
echo" <td nowrap=\"nowrap\"><img src=\"./images/fold.gif\" border='0'><a href=\"left.php?val=info\" class=\"forumlink\">Information</a></td>";
echo" </tr><tr>";
echo" <td nowrap=\"nowrap\"><img src=\"./images/unfold.gif\">Webshop<br><img src=\"./images/space.gif\"><img src=\"./images/unfold.gif\">Cell Entertainment<br>";
while ($row = mysql_fetch_array($result)){
echo "<img src=\"./images/space.gif\" width=\"57\" height=\"16\" /><a href=\"val.php?val=$row[kategori]&foretag=$val\" target=\"mainFrame\" class=\"forumlink\"><font size=\"2\">$row[kategori]</font></a><br>";
}
echo" <img src=\"./images/space.gif\"><a href=\"left.php?val=Games-Workshop\" class=\"forumlink\"><img src=\"./images/fold.gif\" border='0'>Games Workshop</a><br>";
echo" <img src=\"./images/space.gif\">Utförsäljning<br>";
echo" <img src=\"./images/space.gif\"><a href='kassa.php' class='forumlink' target='mainFrame' class='forumlink'>Gå till kassan</a></td>";
echo" </tr><tr>";
echo" <td nowrap=\"nowrap\"><img src=\"./images/fold.gif\"><a href=\"left.php?val=kont\" class=\"forumlink\">Kontakta</a></td>";
echo" </tr>";
echo"</table>";
}
else{
echo"<table width=\"50\" border=\"0\">";
echo" <tr>";
echo" <td nowrap=\"nowrap\"><img src=\"./images/fold.gif\"><a href=\"left.php?val=info\" class=\"forumlink\">Information</a></td>";
echo" </tr><tr>";
echo" <td nowrap=\"nowrap\"><img src=\"./images/fold.gif\"><a href=\"left.php?val=shop\" class=\"forumlink\">Webshop</a></td>";
echo" </tr><tr>";
echo" <td nowrap=\"nowrap\"><img src=\"./images/fold.gif\"><a href=\"left.php?val=kont\" class=\"forumlink\">Kontakta</a></td>";
echo" </tr>";
echo"</table>";
}
}
?>
I don't know if i have installed PHP wrong couse it won't foldout any ideas on how to solve this? The code is really messy and i shall rewrite it but i need to know what the problem is before i start rewriting it... There must something wrong with my PHP configuration...
//Johan