Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
there is no out put with this code
Old 09-20-2008, 06:16 AM there is no out put with this code
Novice Talker

Posts: 4
Name: dhakalall chhetri
Trades: 0
there is no out put with this code,there is no errors as well, can some one help me, here is the code



<html>
<body>
<form method='post' action='output.php'>
<input type='text' name='f_name' size='12'>
<input type='submit' value='show'>
</form>
</body>
</html>
<?php
$a=$_POST['f_name'];
$user="root";
$host="localhost";
$password="";
$database="diki";
$connection=mysql_connect($host,$user,$password);
$db=mysql_select_db($database,$connection) or die( "Unable to select database");
$query = "select contact from member where f_name='$a'";
$result=mysql_query($query) or die ("couldnot excute query");
if ($a=f_name)
while ($row=mysql_fetch_array($result));
{
echo "$row[f_name]";
echo "$row[address]";

}
mysql_close();
php?>
hotstar07 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-20-2008, 07:00 AM Re: there is no out put with this code
ndr
ndr's Avatar
Novice Talker

Posts: 9
Trades: 0
  1. With "</body></html>" you're telling the browser that the page is over before your script has had a chance to output something. Move them after the script.
  2. The line that says "if ($a=f_name)" is an assignment, not a comparison. Likely not what you want.
  3. You're using a nonstandard closing tag for PHP: use ?>
__________________

Please login or register to view this content. Registration is FREE
- help surfers find your pages after an address change!
Free and ad-free!

Last edited by ndr; 09-20-2008 at 07:12 AM.. Reason: P.S.: I just noticed another post of yours on the same issue. If you need to post a new version of the code, it's better to keep it in the same thread.
ndr is offline
Reply With Quote
View Public Profile
 
Old 09-20-2008, 08:15 AM Re: there is no out put with this code
Junior Talker

Posts: 3
Trades: 0
Hi,

<html>
<body>
<form method='post' action='output.php'>
<input type='text' name='f_name' size='12'>
<input type='submit' value='show'>
</form>
</body>
</html>

The following code must be in output.php

<?php

$a=$_POST['f_name'];
$user="root";
$host="localhost";
$password="";
$database="diki";
$connection=mysql_connect($host,$user,$password);
$db=mysql_select_db($database,$connection) or die( "Unable to select database");
$query = "select contact from member where f_name='$a'";
$result=mysql_query($query) or die ("couldnot excute query");


1. IF f_name IS A STRING COMPARISION THEN KEEP IN ''
2. if($a == 'f_name') or if($a == $f_name')

if ($a=f_name) //This doesn't make any sense!!

while ($row=mysql_fetch_array($result));
{
echo "$row[f_name]";
echo "$row[address]";
}
mysql_close();

?>

There i can see some logic problems !! you are compaing and then fetching the result !!

Thanks
priti is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to there is no out put with this code
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.18074 seconds with 12 queries