select

Reply

Join Date: Mar 2008
Posts: 29
Reputation: stalk is an unknown quantity at this point 
Solved Threads: 0
stalk stalk is offline Offline
Light Poster

select

 
0
  #1
Mar 10th, 2008
$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 upplied argument is not a valid MySQL result resource in c:\apache\htdocs\cd_shop\hladanie_ciste_media.php on line 38 Thank tou
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 29
Reputation: stalk is an unknown quantity at this point 
Solved Threads: 0
stalk stalk is offline Offline
Light Poster

Re: select

 
0
  #2
Mar 10th, 2008
".$medium." is selection from rolover and znacka is row from table:ciste_media
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 29
Reputation: stalk is an unknown quantity at this point 
Solved Threads: 0
stalk stalk is offline Offline
Light Poster

this is form action please help me

 
0
  #3
Mar 10th, 2008
<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>
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 38
Reputation: LeBurt is an unknown quantity at this point 
Solved Threads: 1
LeBurt LeBurt is offline Offline
Light Poster

Re: select

 
0
  #4
Mar 10th, 2008
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?
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 29
Reputation: stalk is an unknown quantity at this point 
Solved Threads: 0
stalk stalk is offline Offline
Light Poster

Re: select

 
0
  #5
Mar 10th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 38
Reputation: LeBurt is an unknown quantity at this point 
Solved Threads: 1
LeBurt LeBurt is offline Offline
Light Poster

Re: select

 
0
  #6
Mar 10th, 2008
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";
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 29
Reputation: stalk is an unknown quantity at this point 
Solved Threads: 0
stalk stalk is offline Offline
Light Poster

Re: select

 
0
  #7
Mar 10th, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 38
Reputation: LeBurt is an unknown quantity at this point 
Solved Threads: 1
LeBurt LeBurt is offline Offline
Light Poster

Re: select

 
0
  #8
Mar 10th, 2008
Ah yes, also I never had any luck with select * from... Try selecting specific fields (for example select field1, field2 from ...).
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 29
Reputation: stalk is an unknown quantity at this point 
Solved Threads: 0
stalk stalk is offline Offline
Light Poster

Re: select

 
0
  #9
Mar 10th, 2008
if I selecting specific folder, it do the same. Its horrible. Is this syntax good?
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 38
Reputation: LeBurt is an unknown quantity at this point 
Solved Threads: 1
LeBurt LeBurt is offline Offline
Light Poster

Re: select

 
0
  #10
Mar 10th, 2008
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%
Last edited by LeBurt; Mar 10th, 2008 at 6:57 pm.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 1172 | Replies: 15
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC