Einzelnen Beitrag anzeigen
  #1  
Alt 11.10.2011, 09:28:49
Maggi Maggi ist offline
Anfänger
 
Registriert seit: Oct 2011
Alter: 36
Beiträge: 11
MySQL Fehler: Check the ... at line 1

Guten Morgen,

um direkt eine Probleme am Anfang zu lösen:
- ich bin MySQL und PHP-Anfänger

Wir sollen eine Abfrage generieren in der man über ein Listen-Menü und eine Schaltfläche Räume auswählen und nachdem man dieses getan hat kommt die Liste mit den PC´s, IP-Adressen und den anderen Infos dazu ...
Die Liste funktioniert nur das Menü mit dem man das wählen kann erzeugt diesen Fehler:

Code:
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 '' at line 1
Sobald man die WHERE Begrenzung rausnimmt, ist alles ok, nur man kann eben nix auswählen!

Nun bitte ich einen Erfahren PHP-Guru sich mal meine vergurkte PHP-Butze anzusehen um mir dann meinen warscheinlich höchst lächerlichen Fehler ins Gesicht zu spucken ;)

Hier folgt das Drama:

PHP-Code:
<?php require_once('Connections/verwaltung.php'); ?>
<?php
$spec 
$_POST['raum_id'];

mysql_select_db($database_verwaltung$verwaltung);
$query_computer "SELECT * FROM computer INNER JOIN os ON computer.os_id = os.os_id INNER JOIN os_hersteller ON os.os_hersteller_id = os_hersteller.os_hersteller_id INNER JOIN raum ON computer.raum_id = raum.raum_id WHERE raum.raum_id = $spec";
$computer mysql_query($query_computer$verwaltung) or die(mysql_error());
$row_computer mysql_fetch_assoc($computer);
$totalRows_computer mysql_num_rows($computer);

mysql_select_db($database_verwaltung$verwaltung);
$query_device "SELECT * FROM device INNER JOIN devicetyp ON device.devicetyp_id = devicetyp.devicetyp_id INNER JOIN device_hersteller ON device.device_hersteller_id = device_hersteller.device_hersteller_id ORDER BY device.device_ip  WHERE raum.raum_id = $spec";
$device mysql_query($query_device$verwaltung) or die(mysql_error());
$row_device mysql_fetch_assoc($device);
$totalRows_device mysql_num_rows($device);

mysql_select_db($database_verwaltung$verwaltung);
$query_raum "SELECT * FROM raum ORDER BY raum.raum_name";
$raum mysql_query($query_raum$verwaltung) or die(mysql_error());
$row_raum mysql_fetch_assoc($raum);
$totalRows_raum mysql_num_rows($raum);
?>
<html>
<head>
<title>Info</title>
<link href="bin/format.css" rel="stylesheet" type="text/css">
</head>
<body>
<form name="form1" method="post" action="info.php" target="_self">
  <table width="100%" border="0">
    <tr>
      <td width="25%"><h3>Raum</h3></td>
      <td width="75%"><select name="select" id="select">
        <?php
do {  
?>
        <option value="<?php echo $row_raum['raum_id']?>"<?php if (!(strcmp($row_raum['raum_id'], $row_computer['']))) {echo "selected=\"selected\"";} ?>><?php echo $row_raum['raum_name']?></option>
        <?php
} while ($row_raum mysql_fetch_assoc($raum));
  
$rows mysql_num_rows($raum);
  if(
$rows 0) {
      
mysql_data_seek($raum0);
      
$row_raum mysql_fetch_assoc($raum);
  }
?>
      </select></td>
    </tr>
    <tr>
      <td><input type="submit" name="button" id="button" value="ausw&auml;hlen"></td>
      <td>&nbsp;</td>
    </tr>
  </table>
</form>
<table width="100%" border="0">
  <tr>
    <td><h3>Computername</h3></td>
    <td><h3>Betriebssystem</h3></td>
    <td><h3>IP</h3></td>
    <td><h3>Subnet</h3></td>
    <td><h3>Gateway</h3></td>
  </tr>
  <?php do { ?>
    <tr>
      <td><h5><a href="verwaltung/computer_view.php?wert=<?php echo $row_computer['computer_id'];?>"><?php echo $row_computer['computer_name']; ?></a></h5></td>
      <td><h5><a href="verwaltung/os_hersteller_view.php?wert=<?php echo $row_computer['os_hersteller_id'];?>"><?php echo $row_computer['os_hersteller_name']; ?></a> <?php echo $row_computer['os_name']; ?></h5></td>
      <td><h5><a href="http://<?php echo $row_computer['computer_ip']; ?>" target="_blank"><?php echo $row_computer['computer_ip']; ?></a></h5></td>
      <td><h5><?php echo $row_computer['computer_subnet']; ?></h5></td>
      <td><h5><?php echo $row_computer['computer_gateway']; ?></h5></td>
    </tr>
    <?php } while ($row_computer mysql_fetch_assoc($computer)); ?>
</table>
<br>
<table width="100%" border="0">
  <tr>
    <td><h3>Ger&auml;tname</h3></td>
    <td><h3>Typ</h3></td>
    <td><h3>Hersteller</h3></td>
    <td><h3>IP</h3></td>
    <td><h3>Subnet</h3></td>
  </tr>
  <?php do { ?>
  <tr>
    <td><h5><?php echo $row_device['device_name']; ?></h5></td>
    <td><h5><?php echo $row_device['devicetyp_name']; ?></h5></td>
    <td><h5><a href="verwaltung/device_hersteller_view.php?wert=<?php echo $row_device['device_hersteller_id'];?>"><?php echo $row_device['device_hersteller_name']; ?></a></h5></td>
    <td><h5><?php echo $row_device['device_ip']; ?></h5></td>
    <td><h5><?php echo $row_device['device_subnet']; ?></h5></td>
    </tr>
  <?php } while ($row_computer mysql_fetch_assoc($computer)); ?>
</table>
<br>
<br>
<?php echo $spec?>
</body>
</html>
<?php
mysql_free_result
($computer);

mysql_free_result($device);

mysql_free_result($raum);
?>
Ich danke für das Verständniss und jede entgegengebracht Hilfe!
Mit Zitat antworten