Jump to content

Problema while


Mark S.

Recommended Posts

Am aceasta eroare la php pe localhost imi da eroarea asta desi eu am configurat panelul cu baza de date de la host dar da eroarea asta

 


 

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in D:\XAMPP\htdocs\rpg\profile.php on line 7

Codul este acesta:

< ?php
include 'includes/config.php';
include 'includes/header.php';

$id = isset($_GET['id']) ? (int)$_GET['id'] : $udata['id'];
$q = mysql_query("SELECT * FROM players WHERE id=$id"); 
while($playerdata = mysql_fetch_array($q)): // linia 7
$name = $playerdata['username'];

Uitati o poza cum arata

i60fNzi.jpg

Link to comment
Share on other sites

Tot asa
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in D:\XAMPP\htdocs\rpg\profile.php on line 7

 

<?php
include 'includes/config.php';
include 'includes/header.php';

$id = isset($_GET['id']) ? (int)$_GET['id'] : $udata['id'];
$q = mysql_query("SELECT * FROM `players` WHERE `id` = '$id'");
while($playerdata = mysql_fetch_array($q))://linia 7
$name = $playerdata['username'];

 

Edited by Selby
Link to comment
Share on other sites

Dupa primul apel al functiei mysql_query adauga

if($result === FALSE) 
{ 
    die(mysql_error());
}

si pune aici ce eroare primesti.

E aceeasi eroare?

De ce zice ca nu ai coloana id in tabela... Foarte ciudat.

Pune putin script-ul asta la inceput si zi-ne ce zice. (pune-l inainte de orice mysql_query din fisierul tau)

$Query = mysql_query("SHOW COLUMNS FROM `players`") or die(mysql_error());

while($Column = mysql_fetch_object($Query))
{
    $Columns[] = $Column;
}
 
foreach($Columns as $Key => $Column)
{
    echo $Column->Field."</br>";
}

die();

 

Link to comment
Share on other sites

Dupa ce am  pus codul acela nu mai da  eroare dar nu se incarca nimic si m gasit asta in link

http://localhost/rpg/profile.php?id=<br /><b>Notice</b>: Undefined index: id in <b>D:\XAMPP\htdocs\rpg\includes\header.php</b> on line <b>45</b><br />

 

Iar din cate scrie acolo header linia 45

este asta

<li>
									<a href="profile.php?id=<?=$udata['id']?>">//45
										<i class="icon-user"></i>
										Profilul Meu
									</a>
								</li>							
									

 

Edited by Selby
Link to comment
Share on other sites

Pune ce ti-am zis

if($result === FALSE) 
{ 
    die(mysql_error());
}

sau pune

$q = mysql_query("SELECT * FROM `players` WHERE `id` = '$id'") or die(mysql_error());

in loc de

$q = mysql_query("SELECT * FROM `players` WHERE `id` = '$id'");

 

Si zi-mi ce eroare iti da.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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. For more details you can also review our Terms of Use and Privacy Policy.