Jump to content

not retrieving data from database


bugmero

Recommended Posts

Hi all,

 

I have this code ,a resolved the issues that i had with fetch_array , but the data is not showing in the filed boxes .This is the code , i get no errors in page but textboxes are empty , no data . it should retrieve some data .

 

<?php

 

session_start();

require_once('include/connect.php');

include('include/header.php');

include('include/rollover.php');

require_once('include/functions.php');

include('include/toptemplate.php');

 

 

connecttodb($hostname_connSquash,$database_connSquash,$username_connSquash,$password_connSquash);

function connecttodb($hostname_connSquash,$database_connSquash,$username_connSquash,$password_connSquash)

{

global $link;

$link=mysql_connect ("$hostname_connSquash","$username_connSquash","$password_connSquash");

if(!$link){die("Could not connect to MySQL");}

mysql_select_db("$database_connSquash",$link) or die ("could not open db".mysql_error());

}

$id=$_GET['id'];

$qres="SELECT * FROM `$clubprefix"."_player` WHERE id='$id'";

$result=mysql_query($qres);

 

$row = mysql_fetch_array ($result);

?>

 

<table width="400" border="0" cellspacing="1" cellpadding="0">

<tr>

<form name="form1" method="post" action="update_skill.php?">

<td>

<table width="100%" border="0" cellspacing="1" cellpadding="0">

<tr>

<td> </td>

<td colspan="3"><strong>Update skill level</strong> </td>

</tr>

<tr>

<td align="center"> </td>

<td align="center"> </td>

<td align="center"> </td>

<td align="center"> </td>

</tr>

<tr>

<td align="center"> </td>

<td align="center"><strong>Forehand/Backhand</strong></td>

<td align="center"><strong>Fitness/Movement</strong></td>

<td align="center"><strong>Serve/Return</strong></td>

<td align="center"><strong>Volley</strong></td>

<td align="center"><strong>Special Shots</strong></td>

<td align="center"><strong>Playing Style</strong></td>

<td align="center"><strong>Tournament Experience</strong></td>

</tr>

<tr>

<td> </td>

<td align="center"><input name="FB" type="text" id="FB" value="<? echo $rows['FB']; ?>"></td>

<td align="center"><input name="FM" type="text" id="FM" value="<? echo $rows['FM']; ?>" size="15"></td>

<td><input name="SR" type="text" id="SR" value="<? echo $rows['SR']; ?>" size="15"></td>

<td align="center"><input name="Vol" type="text" id="Vol" value="<? echo $rows['Vol']; ?>"></td>

<td align="center"><input name="SS" type="text" id="SS" value="<? echo $rows['SS']; ?>"></td>

<td align="center"><input name="PS" type="text" id="PS" value="<? echo $rows['PS']; ?>"></td>

<td align="center"><input name="TE" type="text" id="TE" value="<? echo $rows['TE']; ?>"></td>

</tr>

<tr>

<td> </td>

<td><input name="id" type="hidden" id="id" value="<? echo $rows['id']; ?>"></td>

<td align="center"><input type="submit" name="Submit" value="Submit"></td>

<td> </td>

</tr>

</table>

</td>

</form>

</tr>

</table>

 

 

 

<?

// close connection

mysql_close();

 

?>

 

Am i doing something wrong ?

 

Thanks

 

 

Link to comment
https://forums.phpfreaks.com/topic/201127-not-retrieving-data-from-database/
Share on other sites

Change

<?php
$result=mysql_query($qres);
?>

to

<?php
$result=mysql_query($qres) or die("Problem with the query: $qres<br>" . mysql_error());
?>

 

and see if you get an error printed. If one prints, it should give you a starting point to solve your problem.

 

Ken

Please enclose code in

bbcode tags to make it easier for others to read.

 

You define the array as $row[], but try to access it with $rows[], which doesn't exist.

Also, you should really use the long php open ( <?php ) tags everywhere. The short tags ( <? ) will end up causing you headaches eventually.

Thanks for all the help Pikachu2000 this was the problem  :-*, so stupid, programing is hard a lot of little things that can make problems , an most of them are stupid mistakes . Great eye Pikachu2000 , i will take your advice and use <?php .

 

kenrbnsn, I will use also  the " or die " statement so i see errors in the future .

 

Thanks a a lot guys, great forum . great people . 

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.