954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

select

$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

stalk
Light Poster
29 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

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

stalk
Light Poster
29 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 



CD
DVD


Recorable
Rewritable


1kus
10kusov
15kusov
50kusov
100kusov


S obalom
V rolke


   
Značka:

stalk
Light Poster
29 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

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?

LeBurt
Light Poster
38 posts since Mar 2008
Reputation Points: 10
Solved Threads: 1
 

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

stalk
Light Poster
29 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

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";

LeBurt
Light Poster
38 posts since Mar 2008
Reputation Points: 10
Solved Threads: 1
 

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.

stalk
Light Poster
29 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

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

LeBurt
Light Poster
38 posts since Mar 2008
Reputation Points: 10
Solved Threads: 1
 

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

stalk
Light Poster
29 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

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%

LeBurt
Light Poster
38 posts since Mar 2008
Reputation Points: 10
Solved Threads: 1
 

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

stalk
Light Poster
29 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

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

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

LeBurt
Light Poster
38 posts since Mar 2008
Reputation Points: 10
Solved Threads: 1
 

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);

LeBurt
Light Poster
38 posts since Mar 2008
Reputation Points: 10
Solved Threads: 1
 

oh thank you wery much. Its good just now.

stalk
Light Poster
29 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

You're welcome!

LeBurt
Light Poster
38 posts since Mar 2008
Reputation Points: 10
Solved Threads: 1
 

$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";

forzadraco
Junior Poster in Training
70 posts since Mar 2008
Reputation Points: 10
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You