kevin wood commented: very helpful +1
nav33n 472 Purple hazed! Team Colleague Featured Poster
Sulley's Boo commented: eyse hee -_- meri marzi mote .. +5
-796
Yep.. Thats what window.opener will do..
And
$result = mysql_query("SELECT * FROM images WHERE 'Broad1'='$thumb_name'");
Should be
$result = mysql_query("SELECT * FROM images WHERE Broad1='$thumb_name'");
No quotes around Broad1.
Ah! correct.. I couldn't spot that one!
Everything is correct.. But this is wrong.
$result = mysql_query("SELECT * FROM images WHERE 'Broad1'='$thumb_name'");
{
echo $row;
echo "<br />";
}
?>
This should be
$result = mysql_query("SELECT * FROM images WHERE 'Broad1'='$thumb_name'");
$row= mysql_fetch_array($result);
echo $row['Broad1'];
echo "<br />";
?>
Welcome to Daniweb!
Welcome to Daniweb!
Welcome to Daniweb!
Welcome !
Welcome to Daniweb Sam :)
Welcome to Daniweb!
Welcome to Daniweb!
Welcome to Daniweb!
Hello Mark! Welcome to Daniweb!
Welcome to Daniweb!
Welcome to Daniweb!
:) cool !
It displays thrice because its looping three times. You can do it this way.
<?php
mysql_connect("localhost", "root", "1234") or die(mysql_error());
mysql_select_db("userlist") or die(mysql_error());
$name=$_POST['name'];
$password=$_POST['password'];
$query = "SELECT * FROM user where username='$name' && password='$password'";
$result = mysql_query($query) or die(mysql_error());
if(mysql_num_rows($result) > 0){
echo "Success!";
}
else
{
echo "Sorry! Wrong name!!";
}
?>
When the user types username and password, why not check if that exists in the table, rather than get all records and then check ?
$name=$_POST['username'];
$password=$_POST['password'];
Ie., $query = "select * from user where username='$name' and password='$password'";
Then check if this returns more than 1 row. If it does, then the username and password is valid. Else, invalid username and pass.
echo '<form action="<?php $PHP_SELF; ?>" method="POST">';
This is wrong. Use this instead. echo '<form action='.$_SERVER['PHP_SELF'].' method="POST">';
See http://www.w3schools.com/htmldom/met_win_open.asp for popup..
see http://www.w3schools.com/htmldom/prop_win_opener.asp to update/refresh/relocate the parent window.
Instead of $row = mysql_fetch_array($result)
use, while($row = mysql_fetch_array($result)) {
AND
echo "Thanks for logging in.";
header("http://www.google.com");
will give you an error because you can't output anything before header function. Either echo a message or redirect the user. :)
-791
-786
Welcome to Daniweb!
Welcome to Daniweb!
Welcome!
Welcome!
Welcome to Daniweb Ajay :)
Welcome to Daniweb!
Welcome to Daniweb !
Welcome to Daniweb twojays :)
-784
-782
no problem with the upper, managed to solve myself. Thank you very much for your reply.
Can you tell us how you solved your problem ? Maybe it will help someone else having the same problem :)
Umm.. Maybe theres something wrong with your script ?
There is NO default config.php and database.class in php. :)