Jump to content

Syntax error! Probably easy answer!!


BigX

Recommended Posts

Hi,

 

I'm still learning PHP so this question is probably easy for you PHP veterans  ;D

I have this piece of code:

 

<?php

 

  $id = $_GET['id'];

  $organisatie = mysql_query("SELECT * FROM organisaties WHERE id=" . $id);

 

  echo "<table width='400' border='0'>

  <tr>

  <td width='400' bgcolor='#FFFFFF'>'$organisatie[Organisatie]'</td>

  </tr>";

 

?>

 

I only see '' on the page while I would like to see $organisatie[Organisatie]!! There is probably something really wrong with the syntax there but I don't know what!!

 

Thanx in advance for any help!!

Link to comment
https://forums.phpfreaks.com/topic/97912-syntax-error-probably-easy-answer/
Share on other sites

you need to fetch a mysql result array like this

<?php
    
     $id = $_GET['id'];
     $result = mysql_query("SELECT * FROM organisaties WHERE id=" . $id);
     echo "<table width='400' border='0'>";
     while($row = mysql_fetch_array($result)){
          echo "<tr>
          <td width='400' bgcolor='#FFFFFF'>'$row[Organisatie]'</td>
          </tr>";
     }
    
?>

 

Scott.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.