473,569 Members | 3,009 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

i dont understand the undefind index error in my code.can check for me?

34 New Member
This is the code the code that i try to run it as my search engine for my database. But i dont understand why i run a notice that undefind index. Can u help me ?

<form method="post" action="search. php">
<input type="text" name="search" size=25 maxlength=25>
<input type="Submit" name="Submit" value="Submit">
</form>
<?

//connect to server
mysql_pconnect( "localhost","ro ot","password") ;
//select the db
mysql_select_db ("school");
//get the results and store them in $result
$search=$_POST["search"];

$result = mysql_query ("SELECT * FROM class WHERE Name LIKE '%$search%'");
//run the while loop
while($r=mysql_ fetch_array($re sult))
{
//grab the result
$Name=$r["Name"];
//print it out
echo $Name;
echo "<br>";
}

?>
Oct 5 '06 #1
3 1913
bevort
53 New Member
You get these warning in you error_log file, right?

PHP does not like undefined vars and indexes. You should get only something like [05-Oct-2006 12:56:33] PHP Notice: Undefined variable: uid in D:\htdocs
but the code works.

If you realy want to get rid of them you have to declare all the vars before using them even if they come from a $_POST or $_GET.
Oct 5 '06 #2
Sheau Wei
34 New Member
You get these warning in you error_log file, right?

PHP does not like undefined vars and indexes. You should get only something like [05-Oct-2006 12:56:33] PHP Notice: Undefined variable: uid in D:\htdocs
but the code works.

If you realy want to get rid of them you have to declare all the vars before using them even if they come from a $_POST or $_GET.
In the code that i had submit, i dont understand how to declare it , can u help me or give me an example? Thanks you
Oct 5 '06 #3
ronverdonk
4,258 Recognized Expert Specialist
On what statement did you get the 'undefined' error message?

Ronald :cool:
Oct 6 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
6530
by: Neil Strong | last post by:
I'm getting an error message "Unidentified Index" when reading posted variables from a form $x = $_POST I know I can use 'isset()' to check them first, but I'm curious as to why this works on some servers and not others......... Most of the servers I run it on just ignore the problem and result in the variable being assigned empty.
1
1749
by: Dave Bailey | last post by:
When I run the following code public DataView CreateEquipmentDataSource( string equipConnect = "Provider=\"MSDAORA.1\";" + GetConnectionString() + "" string equipSelect = "Select Description from Equipment where" " Eqnum = " + "'" + equipLabel.Text + "'" oda1 = new OleDbDataAdapter(equipSelect, equipConnect) DataSet ds1 = new DataSet()
2
2114
by: david | last post by:
Problem: There is a search button, Search, in form, for searching patient info list. The error occurs after the following steps: 1. search first time is OK, and all found the records are displayed in the datagrid by using databind(). 2. After the first-time search, I navigate the pages by clicking the page changing arrow < or > which...
9
9024
by: aamircheema | last post by:
Hi, I have written a program (my first big program in c++). When I run the program it gives segmentation fault but when i use a printf statement to debug the program, it runs normally. I am very confused that what may be the reason? Of course I dont want to use printf because it is in loop and prints so many things which I don't want. ...
1
1593
by: ricky.fung | last post by:
I have several VBA functions in my Access Database that do not work. I have a combobox that filters my subform data however I cannot select anything when logged in with Read Only permission. The statusbar comes up with a message saying: "Recordset is not updatable" This combobox works with Admin permissions but not Read Only.
13
7695
by: Eugene Rice | last post by:
I'm writing C code for an Atmel AVR micro controller. Because RAM space is extremely limited (about 500 bytes) I use char variables wherever I can. For example I use chars as array indices in dozens of places: char arr; char x,y,z; for (x=0; x<3; x++) { arr = ...; // gcc gives warning here // more code }
19
2230
by: so many sites so little time | last post by:
the table is head the colunm is called body <?php //show_site.php // This script retrieves blog entries from the database. // Address error handing. ini_set ('display_errors', 1); error_reporting (E_ALL & ~E_NOTICE); // Connect and select.
1
4896
by: ApoorvaDesai | last post by:
How do I check if a certain column exists in the CSV file, from the following code I try to check if s exists. It gives me an error INDEX ERROR: List index out of range. If its Null I expect it to print NO rather than give me an error f = open('C:\\Documents and Settings\\adesai\\Desktop\\save_lines.csv','r') while f: ...
6
1475
by: Bishop | last post by:
a += (UInt32)(url + (url << 8) + (url << 16) + (url << 24)); I'm trying to understand what the above line of code does. I understand that the url part of (url << 8) returns part of the string but I don't understand what the << 8 does.
0
7703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7930
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6290
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5228
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3662
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2118
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
950
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.