Cannot Display Data from Database
Posted by: oliver12 (---.sotn.cable.ntl.com)
Date: March 28, 2010 10:32PM

I have recently switched from using mysqladmin to phpmyadmin. The reason being that one of university servers went down and i am now using wamp to create my own server on my laptop. The code above should show data from the team table. I can add data to the database but for some reason can't display it on my website. The code worked fine when using mysqladmin however it doesn't seem to work now. If anyone has any ideas what the problem could be and a solution that would be great.

Code:
<?php
//creates a session for the user
session_start();
//Checks if the user has a user_id
if(!isset($_SESSION["player_id"])) {
//If user does not have user_id they are returned to the loginform page
header("Location: login.php"winking smiley;
exit(); }
require "dbconn.php";
$sql = "SELECT * FROM team"; $result = mysql_query($sql, $connection)
or die ("Couldn’t perform query $sql <br />".mysql_error()); ?>

Code:
<tr> <
align="left">Teams</th>
</tr> <?php while($row = mysql_fetch_array($result)) { ?> <tr>
<td><?=$row["team_name"]?></td>
</tr> <?php } ?>

Also when trying to look at an image that I have linked from the database to the www folder it doesn't show. When i click on or go directly to the image (http://localhost/files/<?=$row["file"]?>winking smiley it gives me 403 access forbidden error.

I am able to sucessfully add data to the database but can't get read data from it.



Edited 1 time(s). Last edit at 03/28/2010 10:38PM by oliver12.

Options: ReplyQuote
Re: Cannot Display Data from Database
Posted by: stevenmartin99 (---.b-ras2.blp.dublin.eircom.net)
Date: March 28, 2010 10:43PM

ur mixing tags

some <?php ?> and some <? ?>

u shud use the first one always


if u want both to work left click wamp>php>php settings> short_open_tag

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: Cannot Display Data from Database
Posted by: oliver12 (---.sotn.cable.ntl.com)
Date: March 28, 2010 10:53PM

Ah sweet. Thanks alot man, spent about 2 days trying to figure this out.

Options: ReplyQuote


Sorry, only registered users may post in this forum.