$query = "select * from 'ciste_media' where ".$medium."= ".$medium." and ".$typ."= ".$typ."

and ".$kusy."= ".$kusy." and ".$obal."= ".$obal." and znacka like '%".$vyraz."%' order by kusy

ASC";
$result = mysql_query($query); this is line 38


Please, is this correct form and syntax for this selection? Wrote me :Supplied argument is not a valid MySQL result resource in c:\apache\htdocs\cd_shop\hladanie_ciste_media.php on line 38 Thank tou

".$medium." is selection from rolover and znacka is row from table:ciste_media

<form action="hladanie_ciste_media.php" method="post">
<table border="0" cellspacing="0" cellpadding="0" align="left">

<tr>

<td>
<select name="medium">
<option value="CD">CD
<option value="DVD">DVD

</select>
</td>

<td>
<select name="typ">
<option value="R">Recorable
<option value="RW">Rewritable

</select>
</td>

<td>
<select name="kusy">
<option value="1">1kus
<option value="10">10kusov
<option value="15">15kusov
<option value="50">50kusov
<option value="100">100kusov
</select>
</td>
<td>
<select name="obal">
<option value="obal">S obalom
<option value="rolka">V rolke


</select>
</td>


<td> &nbsp &nbsp </td>
<td> Značka: </td>
<td><input name="vyraz" type="text" size="20" maxlength="40"></td>

A good way to debug this is to run this command before you run the mysql_query:

die ($query);

It will list the content of the $query variable and stop the script. Could you post the result?

this is result select * from ciste_media where medium=CD and typ=R and kusy=15 and obal=rolka and znacka like '%verbatim%' order by kusy ASC

It appears you would need single quotes around your text litterals, like this:

select * from ciste_media where medium='CD' and typ='R' and kusy=15 and obal='rolka' and znacka like '%verbatim%' order by kusy ASC

Try this:
$query = "select * from 'ciste_media' where ".$medium."= '".$medium."' and ".$typ."= '".$typ."' and ".$kusy."= ".$kusy." and ".$obal."= '".$obal."' and znacka like '%".$vyraz."%' order by kusy ASC";

this is result select * from 'ciste_media' where CD= 'CD' and R= 'R' and 15= 15 and rolka= 'rolka' and znacka like '%verbatim%' order by kusy ASC

But this is no solution. It get the same problem.

Ah yes, also I never had any luck with select * from... Try selecting specific fields (for example select field1, field2 from ...).

if I selecting specific folder, it do the same. Its horrible. Is this syntax good?

I'm looking at your previous reply (#7) in more detail now and I just noticed that a few things have changed since your reply #5.

Try this:

$query = "SELECT kuzy FROM ciste_media WHERE medium='$medium' AND typ='$typ' AND kusy=$kuzy AND obal='$obal' AND znacka like '%$vyraz%' ORDER BY kusy ASC";
die ($query);

Please post the result.

Amended: changed %vyraz% to %$vyraz%

SELECT kuzy FROM ciste_media WHERE medium='CD' AND typ='R' AND kusy= AND obal='rolka' AND znacka like '%vyraz%' ORDER BY kusy ASC

Oops, $kuzy should be $kusy, my mistake.

Also, %vyraz% should be %$vyraz%, my mistake again... I apologize, I don't know these words... ;)

So...

$query = "SELECT kusy FROM ciste_media WHERE medium='$medium' AND typ='$typ' AND kusy=$kusy AND obal='$obal' AND znacka like '%$vyraz%' ORDER BY kusy ASC";
die ($query);

oh thank you wery much. Its good just now.

You're welcome!

$query = "SELECT kuzy FROM ciste_media WHERE medium='$medium' AND typ='$typ' AND kusy='$kuzy' AND obal='$obal' AND znacka like '%$vyraz%' ORDER BY kusy ASC";

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.