fetch array

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
weasel
Forum Commoner
Posts: 27
Joined: Sat Aug 16, 2003 3:27 pm

fetch array

Post by weasel »

im having a problem with displaying things out of mysql tables... please tell me what im doing wrong here...

<?php
include('config.php');

$result = mysql_query("SELECT name, mname, discription FROM maps where id = 1");

$name = $row["name"];
$mname = $row["mname"];
$dis = $row["discription"];

echo $row[client_id];
echo $row[fullname];

?>

<center>
<table>
<tr>
<td>
map name:
</td>
<td>
<?php echo $row["mname"]; ?>
</td>
</tr>
<tr>
<td>
Map creator:
</td>
<td>
<?php echo $row["name"]; ?>
</td>
</tr>
</table>

thx for any help
Coco
Forum Contributor
Posts: 339
Joined: Sat Sep 07, 2002 5:28 am
Location: Leeds, UK
Contact:

Post by Coco »

the answer is in the thread subject...
mysql_fetch_array

Code: Select all

<?php

include('config.php'); 

$result = mysql_query("SELECT name, mname, discription FROM maps where id = 1"); 
$row = mysql_fetch_array($result);
$name = $row["name"]; 
$mname = $row["mname"]; 
$dis = $row["discription"]; 

echo $row[client_id]; 
echo $row[fullname]; 

?> 

<center> 
<table> 
<tr> 
<td> 
map name: 
</td> 
<td> 
<?php echo $row["mname"]; ?> 
</td> 
</tr> 
<tr> 
<td> 
Map creator: 
</td> 
<td> 
<?php echo $row["name"]; ?> 
</td> 
</tr> 
</table> 
?>
btw you misspelt description
weasel
Forum Commoner
Posts: 27
Joined: Sat Aug 16, 2003 3:27 pm

Post by weasel »

aww... thx so much man
Post Reply