|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||||||||||
|
|||||||||||
|
Where did I go wrong? Simple stuff, but problems
I have just started PHP this week after preparing a MYSQL database on a hosting site, forgive me but its all new to me.
The basic premise is a simple database, 8 fields, membership no as a primary field and town/postcode fields are indexed. I have created a form called input1.PHP which allows a user to enter a word for searching in either the town or postcode fields. The code is detailed below and seems to work ok. php Code:
Thsi should pass a variable, $seek, to a further page search.php for a query and results listing.Originally the page was as below, it is missing some code to make it display the results I think and it was suggested I change to the second lot of code below. php Code:
now changed to php Code:
However I now get the error "Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/ppreen/public_html/search.php3 on line 12" and still no results Can someone tell me where I went wrong? Many thanks in advance |
|
#2
|
|||
|
|||
|
RE: Where did I go wrong? Simple stuff, but problems
Register globals is probably set to off in the php.ini file. This would require you to use the $_POST superglobal. Change $seek to $_POST['seek'] in the query and it should work fine.
|
|
#3
|
|||
|
|||
|
RE: Where did I go wrong? Simple stuff, but problems
no joy I'm afraid
|
|
#4
|
||||
|
||||
|
RE: Where did I go wrong? Simple stuff, but problems
Change: $result = mysql_query($sql,$conn); to $result = mysql_query($sql,$conn) or die(mysql_error()); and see what happens.
|
|
#5
|
|||
|
|||
|
RE: Where did I go wrong? Simple stuff, but problems
What version of PHP are you using. also, post the code that you are using after you made the mods I suggested.
|
|
#6
|
||||||||
|
||||||||
|
RE: Where did I go wrong? Simple stuff, but problems
I see a potential problem,
php Code:
should be php Code:
you were using mysql_query improperly in the the first one. |
|
#7
|
|||||
|
|||||
|
RE: Where did I go wrong? Simple stuff, but problems
I have changed the code to read as follows:
php Code:
I dont get any errors now, unfortunately I dont get any output at all. I am using php 4.3.2 and mysql 4.0.14 standard. the actual page is here at http://www.gsv.tsohost.co.uk/input1.php3 |
|
#8
|
|||
|
|||
|
RE: Where did I go wrong? Simple stuff, but problems
Grateful for any ideas or alternative sources of simple form and search code ,
thanks for your time, really appreciate it. |
|
#9
|
|||
|
|||
|
RE: Where did I go wrong? Simple stuff, but problems
you are not getting any output with the script because you are not echoing anything to the browser. What you need to do is take your variables and output them to the browser. start by doing something simple like this... |