473,385 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

help me find the error..

alisyah
[HTML]
<form action="result.php" method="post">
<table width="61%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="22%">Time</td>
<td width="78%">
<select name="masa" id="masa" >
<option selected>Time</option>
<option>8:30</option>
<option>9:30</option>
<option>10:30</option>
<option>11:30</option>
<option>12:30</option>
<option>1:30</option>
<option>2:30</option>
<option>3:30</option>
<option>4:30</option>

</select> </td>
</tr>
<tr>
<td>Day</td>
<td><input name="hari" type="text" id="hari" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="search" id="search" value="search" /></td>
</tr>
</table>
</form>[/HTML]


[PHP]<?php

if(isset($_POST["submit"]))
{

mysql_connect("localhost","root","");
mysql_select_db("projek");

$hari = $_POST["hari"];
$masa =$_POST["masa"];
$search =$_POST["search"];

$query = "SELECT * FROM bt1 where $masa LIKE '$search'";
$result = mysql_query($query);

echo "<br><br>";
echo "<table border=1 width=100%>";
echo "<tr bgcolor='pink'>";
echo "<td>Day </td>";
echo "<td>Time </td>";
echo "<td>Availability </td>";
echo "</tr>";

$no=0;
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$no++;
echo "<tr>";
echo "<td>{$row['hari']} </td>";
echo "<td>{$row['masa']}</td>";
echo "<td>{$row['availability']} </td>";
echo "</tr>";
}
echo "</table>";

}

?>[/PHP]
May 25 '08 #1
10 1163
Markus
6,050 Expert 4TB
No.

Firstly you're question suggests no politeness.

Secondly, how are we supposed to know what the error is?
May 25 '08 #2
to marcus: i'm sorry if i'm being rude..i didn't mean it..i understand if u don't want help me..i have no idea to find the error..that's why i'm posting here..i understand if u were upset..you can ignore my post.
May 25 '08 #3
ronverdonk
4,258 Expert 4TB
First posting this bunch of code and not telling us what the error is? If you want us to help you, you have to tell us what the error, or supposed error is! This is not a guessing game. And withdrawing your post is not the answer to your problem.

So state your problem and describe the error or whatever it is that is the problem.

moderator
May 25 '08 #4
Atli
5,058 Expert 4TB
Hi.

For us to be able to help we need to know a few things...
Like:

What exactly is the problem?
What is your code not doing that it should be doing?
Are you getting any error messages?

Have you tried to solve this yourself?
What did you try? How/why did it fail?

And please try to follow the Posting Guidelines at all times.
May 25 '08 #5
i'm sorry for my mistake.
actually,i'm trying to create a search engine for my user to search data through my database but i keep getting error


Expand|Select|Wrap|Line Numbers
  1. Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\Program Files\xampp\htdocs\project\result.php on line 30
May 25 '08 #6
TheServant
1,168 Expert 1GB
[PHP]while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{...[/PHP]
I am confused here? You are defining your $row array inside a while loop?
It needs to be defined outside and a real condition put into the while parameter. My apologies if it is just me, but I don't see the logic.
May 26 '08 #7
rpnew
188 100+
Hi,

@alisyah
This error is because there is some problem in your query.. syntax error... and i can see problem in your query at only one place.... your query is as below

Expand|Select|Wrap|Line Numbers
  1. $query  = "SELECT * FROM bt1 where $masa LIKE '$search'";
  2.  
here in WHERE clause you need to provide column name from your table (bt1) and you are providing variable, so make sure that you are getting the correct column name.

So echo your query on page and paste it in MySql environment.. and get the error if any...

@TheServant
You can do that... by this way you will get all the fetched result.... from the database...
May 26 '08 #8
dlite922
1,584 Expert 1GB
I am confused here? You are defining your $row array inside a while loop?
It needs to be defined outside and a real condition put into the while parameter. My apologies if it is just me, but I don't see the logic.

its not "inside" the while loop, but in the condition, hence it works.

Each time it is called, mysql_fetch_assoc() will return the next row....by Magic! :)

Dan
May 26 '08 #9
thanks everybody..
i think i can fix it..
thanks so much..
i've learned a lot here..^^
May 26 '08 #10
TheServant
1,168 Expert 1GB
thanks everybody..
i think i can fix it..
thanks so much..
i've learned a lot here..^^
Good. Post your final solution so others can learn from it. I learned something too! Magic!
May 26 '08 #11

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

Similar topics

5
by: jhon02148 | last post by:
hi this hw have four files: 1. for the main program 2. listp.cpp (the source file) 3. listp.h (the header file) 4. exception.h if there is anybody who could help me with this hw i really...
2
by: John | last post by:
This message is popping up at startup and its saying "fatal execution engine error (0x7927e03e)" Ive tried deleting, reinstalling frameworks, restoring computer, but I can't use the os cd because i...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
1
by: Rahul | last post by:
Hi Everybody I have some problem in my script. please help me. This is script file. I have one *.inq file. I want run this script in XML files. But this script errors shows . If u want i am...
32
by: robert d via AccessMonster.com | last post by:
I'm looking at converting DAO to ADO in my app. All of my DAO connections are of the following structure: Dim wsName As DAO.Workspace Dim dbName As DAO.Database Dim rsName As DAO.Recordset ...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
11
by: hamiltongreg | last post by:
I am new to Java and am having problems getting my program to compile correctly. My assignment is as follows; Choose a product that lends itself to an inventory (for example, products at your...
1
by: oneski | last post by:
help --- 403 You don't have permission Im trying to get a basic search to work on my website, but i keep getting a forbidden error come up. Im using WAMP5 server on a vista machine. The error file...
16
by: Harry Simpson | last post by:
I've been away from ASPNET - I open up a new Web app in VS2008 and go into properties and select to use IIS instead of the personal web server. Then I run in debug mode and it says I have to set...
12
by: =?Utf-8?B?ZGdvdw==?= | last post by:
I designed a "contact_us" page in visual web developer 2005 express along with EW2 after viewing tutorials on asp.net's help page. Features work like they should, but I cannot figure out how to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.