Jump to content

Archived

This topic is now archived and is closed to further replies.

RainbowRising

It has always worked, now it doesn't anymore

Recommended Posts

On our site we have a product database that always worked correctly. Now when we activate a query it gives the wrong information, that is, it will display all the products instead of the only one were looking for.

 

Here\'s the code:

 

<?php

if (!($mylink = mysql_connect(\"localhost\",\"deleted\",\"deleted\")))

{

print \"<h3>could not connect to database</h3>n\";

exit;

}

mysql_select_db(\"vinifrance\");

 

$result = mysql_query(\"select * from Artikel where Artikel like

\'%$Artikel%\'

And Inhoud like \'%$Inhoud%\' And Groep like \'%$Groep%\' AND Info like \'%$Info%\' AND Land_Herkomst like \'%$Land_Herkomst%\' AND Regio_Herkomst like \'%$Regio_Herkomst%\'\");

if ($result)

$num = mysql_numrows($result);

if ($num == 0)

{

include_once(\"sorry.php\");

 

}

else

 

{

while ($row = mysql_fetch_array($result))

{

print \"<b><font color=#000000></b>\";

print \"<b>Vinifrance Artikelnummer: </b>\";

print $row[\"Code\"];

echo \"<img src=\'$row[foto]\'>\";

print \"<br>n\";

print \"<br>n\";

print \"<b>Artikel: </b>\";

print $row[\"Artikel\"];

print \"<br>n\";

print \"<br>n\";

print \"<b>Groep: </b>\";

print $row[\"Groep\"];

print \"<br>n\";

print \"<br>n\";

print \"<b>Inhoud: </b>\";

print $row[\"Inhoud\"];

print \"<br>n\";

print \"<br>n\";

print \"<b>Alcohol: </b>\";

print $row[\"Alcohol_percentage\"];

print \"<br>n\";

print \"<br>n\";

print \"<b>Land Herkomst: </b>\";

print $row[\"Land_Herkomst\"];

print \"<br>n\";

print \"<br>n\";

print \"<b>Regio Herkomst: </b>\";

print $row[\"Regio_Herkomst\"];

print \"<br>n\";

print \"<br>n\";

print \"<b>Informatie: </b>\";

print \"<font color=#FF0000>\";

print nl2br($row[\"Info\"]);

print \"<br>n\";

print \"<br>n\";

print \"<font color=#000000>\";

print \"<b>Prijs: </b>\";

print $row[\"Prijs\"];

print \"<br>n\";

print \"<br>n\";

print \"<font color=#0000FF>Alle prijzen onder voorbehoud. Prijzen in de winkels zijn de juiste prijzen.</font>\";

print \"<br>n\";

print \"<br>n\";

print \"<b><font color=#000000></b>\";

print \"<b>Website: </b>\";

echo \"<font color=#0000FF><A HREF=http://\";

echo $row[\"Url\"];

echo \"><b><font color=#0000FF>\";

echo stripslashes($row[\"Url\"]);

echo \"</b></a></font>\";

print \"</font><br>n\";

echo \"<img src=/assets/images/autogen/a_CHEERBAR.gif>\";

print \"<br>n\";

print \"<br>n\";

}

mysql_free_result($result);

}

?>

 

You can test it here:

http://www.vinifrance.nl/html/produkten.php

 

The site has been moved by the host to another server with a higher version of PHP (4.2.2). Should I change anything?

Share this post


Link to post
Share on other sites

You will probably find that your variables are empty, which would give ... LIKE \'%%\' ... which would give every record.

 

It likely that your new host has \'register_globals\' OFF so the variables from the POST are not created automatically anymore

 

use

 

[php:1:90d0624772]<?php

$Artikel = $_POST[\'Artikel\'] ;

?>[/php:1:90d0624772]

etc. before doing the query.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.