0

I had a file info.php with class named xyz and functions within it, I am trying to fetch data from data base from another file show.php..but it is not working and shows "Notice: Undefined variable $info"....is there any help wht am i doing wrong...
my code is..

in dblink() // i make mysql conn and chose my database
in realescapestring() // perform stripslash and mysql_real_escape_string
class name is xyz

function showingdta($cuid)                                  /*user info*/
    { 
	$table2="member_info";
      if($this->dblink()==TRUE)
         { 
 $query='SELECT * FROM '. $table2 .' WHERE EMAIL= "'.$this->realescapestring($cuid).'"';
 $result=mysql_query($query,$this->conn_link) or die("prob");
 $info=mysql_fetch_array($result);
 
   	if (mysql_error())
	    { print "Database ERROR: " . mysql_error(); }

			header("Content-type: $info");
            echo $info;

		 }
	  else 
	     {return FALSE;} 
	}



in show.php file

<?php
session_start();
include_once("info.php");

$biglife= new xyz;
$cuid=100011;  

$biglife->showingdta($cuid);
echo "<table>";
echo "<tr>";
echo "<td>Name:</td>";
echo "<td> " . $info['FIRST_NAME']. " </td>";
echo "</tr>";
echo "</table>";


?>

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

4
Contributors
15
Replies
16
Views
6 Years
Discussion Span
Last Post by Narue
0

Use [ CODE ] tags.

Variables within functions stay within functions. You have to return them to access them.

Edited by diafol: n/a

0

> give me some code gere

What's that mean?

0

I won't 'give' you code. That's not what this forum is about. I'll explain further:

Variables inside functions (other than global and superglobal variables) only have scope within the function. That is the outside world (outside the function) will not be aware that they exist. So $info will not exist outside the function.

Also, your function code won't work. In short, it's a bit of a mess. Look up the php.net manual for how to run a query and access the data from the resultset.

0

@ardav: i also know a variable is limited within a function unless you declare it as global or superglobal....dont bother me again..

0

No problem. I was trying to help you, believe it or not. You're obviously a noob at php as can be seen from your code. It just doesn't make any sense.
I have now put you on my ignore list, I suggest you do the same for me.
Good luck.

0

Very mature. It seems my first impressions were correct. Your post is here for everybody to see. Well done, you've made yourself look like a complete idiot without any help from me.

Come back when you've matured and can conduct yourself in a suitable, acceptable manner.

0

i dont care who is seeing my post...<snipped personal attacks>

Edited by Narue: n/a

0

Ha ha. Brilliant. Colloquial Londoner-speak too. I'm impressed. This is a public forum dear vivek, I may post wherever I wish as long as I am polite.

While you're at it, read the forum guidelines, I quote:

Keep It Pleasant
Do not post insults or personal attacks aimed at another member
Do not use offensive or obscene language

Keep it Clear
Do post in full-sentence English
Do not write in all uppercase or use "leet", "txt" or "chatroom" speak

Perhaps, you should go away and stop bothering the good people of Daniweb with your potty mouth.

Edited by diafol: n/a

0

Ha ha. Brilliant. Colloquial Londoner-speak too. I'm impressed. This is a public forum dear vivek, I may post wherever I wish as long as I am polite.

While you're at it, read the forum guidelines, I quote:

Keep It Pleasant
Do not post insults or personal attacks aimed at another member
Do not use offensive or obscene language

Keep it Clear
Do post in full-sentence English
Do not write in all uppercase or use "leet", "txt" or "chatroom" speak

Perhaps, you should go away and stop bothering the good people of Daniweb with your potty mouth.

****..its in pure english....if you understand this stay away from me and my post you, "***"....go away....i know what i have to do..mind your own business....

Edited by Ezzaral: Edited profanity. Keep it pleasant.

0

Here's another one for you:

Keep It Pleasant
Do not try to bypass the DaniWeb inappropriate language filter

:)

Keep going buddy. Let's see if you can get some more under your belt.

Post removed, post snipped. Don't think you'll be here long. Shame. You're really entertaining. Made my day.

Edited by diafol: n/a

0

Ok, enough of this. If the thread can't get back on topic it will be closed.

yeah close it....that *bleep* never gonna stop and u also...and also tell how to delete you a/c because if there are people like *bleep*, i dont wna waste my time here anymore...

Edited by Ezzaral: Edited childish profanity.

0

yeah close it....

I think I'll go ahead and do that. This thread isn't likely to go anywhere except a downward spiral.

tell how to delete you a/c

Accounts aren't deleted so that Daniweb can conform to anti-spam laws. You can simulate the effect by removing all personal information and disabling contact options from your control panel. From there it's a simple matter of logging out and never returning. An admin can also reset your password if the temptation to log in in the future is too great.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.