Jump to content
php.lv forumi

Id


goma smile

Recommended Posts

Man ir jautajums man majaslapa ka Id ir noradits ka vards a tie vardi ir ar atstarpem un keburiem vai ir iespejams vin datus izvilkt ar

 

if(isset($_GET['id']) == 'id' AND $_GET['id'])

{

}

 

jo kad censos sita man rada mysql eroru

a kad id vienta beigas lieku skaitli piemeram

1.,2.,3., ....... tad nerada neko bet kad beigas ielieku piemeram

goma smile tad rada to eroru.

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\apskats.php on line 19
Link to comment
Share on other sites

$con = mysql_connect("localhost","root","");

if (!$con)

{

die('Could not connect: ' . mysql_error());

}

 

mysql_select_db("gopa", $con);

 

 

 

 

 

 

if(isset($_GET['id']) == 'id' AND $_GET['id']) 
{
$ss = mysql_query("SELECT * FROM lietotaji   WHERE id = {$_GET['id']}" );

$row = mysql_fetch_array($ss);
{
echo "".$row['id']."";
}
}

Link to comment
Share on other sites

if ($_REQUEST['id']) {
$id = trim($_REQUEST['id']);
} else {
$id = '';
}
// šeit vajadzētu ielikt arī pārbaudi vai tas $id ir legāls - vai nav kāda injekcija
$query = "SELECT * FROM `lietotaji` WHERE `id`='".mysql_real_escape_string($id)."';";
$res = mysql_query($query);

Edited by Java
Link to comment
Share on other sites

×
×
  • Create New...