Page 1 of 1

fetch array

Posted: Sat Aug 16, 2003 3:27 pm
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

Posted: Sat Aug 16, 2003 6:20 pm
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

Posted: Sat Aug 16, 2003 10:14 pm
by weasel
aww... thx so much man