Hi all!
I have fought with this query and php-script for days now. All that is
sent to the server from the input form is the number "1" or the symbol
"%". None of the actual "RECIPE_NAM ES" that I have searched for, has
generated any results.
Please help! This is my error message after echoing my query and some
helping testlines to the screen:
"1test SELECT * FROM DESCRIPTION WHERE RECIPE_NAME LIKE '%1%' gar in i
whileslinganWar ning: mysql_fetch_obj ect(): supplied argument is not a
valid MySQL result resource in
/afs/nada.kth.se/home/t/u1j80hrt/public_html/2D1517/XMLprojekt/search.php
on line 30"
And these are parts of my two files: start.php and search.php:
*************** *************** *************** *************** *****
<head><title>Sö k i kokboken</title>
</head>
<h1>Sök i kokboken</h1>
<form method="GET" action="search. php">
<table width="90%" align="center">
<tr><td>Sök efter:</td><td><input type="text" name="search" value=""
size='30' maxlength='255' ></td></tr>
<td></td><td><input type="submit" name="submit" value="Sök"></td></tr>
</table>
</form>
<?php
$dbH = mysql_connect(" pub.gt.kth.se", "lisaalf", "lisaalf") or die
('Could not connect to MySQL server');
mysql_select_db ("lisaalf") or die("Could not select database");
?>
</body>
*************** *************** *************** *****
-----------------------------------------------------
<?php
$searchstring = isset($_GET['search']); //Hämtar söksträngen
echo $searchstring;
if ($searchstring) //Om en söksträng har skrivits in..
{
echo "test";
$dbH = mysql_connect(" pub.gt.kth.se", "lisaalf", "lisaalf") or die
('Could not connect to MySQL server');
mysql_select_db ("lisaalf") or die("Could not select database");
$returnstring ="";
$query1 = "SELECT * FROM DESCRIPTION WHERE RECIPE_NAME LIKE
'%$searchstring %'";
echo "<pre>\n$query1 \n</pre>";
if ($query1)
{
echo "gar in i whileslingan";
while ($line = mysql_fetch_obj ect($query1)) {
--------------------------------------------------------------------
I have fought with this query and php-script for days now. All that is
sent to the server from the input form is the number "1" or the symbol
"%". None of the actual "RECIPE_NAM ES" that I have searched for, has
generated any results.
Please help! This is my error message after echoing my query and some
helping testlines to the screen:
"1test SELECT * FROM DESCRIPTION WHERE RECIPE_NAME LIKE '%1%' gar in i
whileslinganWar ning: mysql_fetch_obj ect(): supplied argument is not a
valid MySQL result resource in
/afs/nada.kth.se/home/t/u1j80hrt/public_html/2D1517/XMLprojekt/search.php
on line 30"
And these are parts of my two files: start.php and search.php:
*************** *************** *************** *************** *****
<head><title>Sö k i kokboken</title>
</head>
<h1>Sök i kokboken</h1>
<form method="GET" action="search. php">
<table width="90%" align="center">
<tr><td>Sök efter:</td><td><input type="text" name="search" value=""
size='30' maxlength='255' ></td></tr>
<td></td><td><input type="submit" name="submit" value="Sök"></td></tr>
</table>
</form>
<?php
$dbH = mysql_connect(" pub.gt.kth.se", "lisaalf", "lisaalf") or die
('Could not connect to MySQL server');
mysql_select_db ("lisaalf") or die("Could not select database");
?>
</body>
*************** *************** *************** *****
-----------------------------------------------------
<?php
$searchstring = isset($_GET['search']); //Hämtar söksträngen
echo $searchstring;
if ($searchstring) //Om en söksträng har skrivits in..
{
echo "test";
$dbH = mysql_connect(" pub.gt.kth.se", "lisaalf", "lisaalf") or die
('Could not connect to MySQL server');
mysql_select_db ("lisaalf") or die("Could not select database");
$returnstring ="";
$query1 = "SELECT * FROM DESCRIPTION WHERE RECIPE_NAME LIKE
'%$searchstring %'";
echo "<pre>\n$query1 \n</pre>";
if ($query1)
{
echo "gar in i whileslingan";
while ($line = mysql_fetch_obj ect($query1)) {
--------------------------------------------------------------------
Comment