pgSQL Błąd w formularzu sprawdzającym logowanie

0

Mam poniższy skrypt sprawdzający logowanie i wyskakuje mi taki błąd:
[:error] [pid 3065] [client ::1:47369] PHP Notice: Undefined variable: row in /home/web/qgwc/site/2checklogin.php on line 21, referer: http://localhost/qgwc/site/2main_login.php

<?php
$host="127.0.0.1"; // Host name
$username="ccc"; // Mysql username
$password="ccc"; // Mysql password
$db_name="postgres"; // Database name
$tbl_name="users"; // Table name

// Connect to server and select databse.
$conn_string = "host=127.0.0.1 dbname=postgres port=5432 user=vvvv password=vvv";
$dbconn4 = pg_connect($conn_string) or die ('connection failed');

// username and password sent from form
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];

// To protect MySQL injection (more detail about MySQL injection)
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = $row['login'];
$mypassword = $row['haslo'];
$sql="SELECT * FROM $tbl_name WHERE login='$myusername' and haslo='$mypassword'";
$result=pg_query($sql);

// Mysql_num_row is counting table row
$count=pg_num_rows($result);

// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){

// Register $myusername, $mypassword and redirect to file "login_success.php"
session_register("myusername");
session_register("mypassword");
header("location:1login_success.php");
}
else {
echo "Wrong Username or Password";
}
?>

0

ale jak to zastosować?:) pg_fetch_assoc ( resource $result [, int $row ]): array

1 użytkowników online, w tym zalogowanych: 0, gości: 1, botów: 0