Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble getting results from query in need of assistance

Status
Not open for further replies.
Feb 4, 2011
53
0
0
CA
I have an SQL statement. When I output the actual statement to the web browser I get this
Code:
SELECT s.san_volume, s.snapshot_num, s.bu_date, v.index_num, v.volume, v.last_bu FROM san_backup_log as s, san_volumes as v WHERE s.san_volume = v.volume AND v.volume = 'ACCT-FS01-VOL1' AND v.last_bu = s.bu_date

My actual SQL code looks like this:
Code:
$q = mysql_query("SELECT s.san_volume, s.snapshot_num, s.bu_date, v.index_num, v.volume, v.last_bu FROM san_backup_log as s, san_volumes as v WHERE s.san_volume = v.volume AND v.volume = '$complete' AND v.last_bu = s.bu_date";

I am not getting any results and I tried to use die(mysql_error()) but I am not receiving an error either, can any one help?
 
Unless there's a copy and paste error, you're missing the closing parentheses in your function call.

You'll probably do better by posting the question in a forum related to the language that you're using. In PHP, for example, $q will be a resource that you can use to get data; it won't contain any data itself.
 
Yes there was a copy paste error. That is just my select statement and query, to finish I use $r = mysql_fetch_array($q). The problem has to be with the sql statement as the other processes I have going on in the script I am writing work fine.
 
Have you tried running the query directly on the Database rather than through PHP? Does it return results there?

It could be your query just can't find any returnable results based on all the criteria.



----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Thanks all for the advice so far. I have not tried running it against the database directly. I only have a few entries in the database for testing purposes and I already made sure that the existing data would match the criteria. So no one sees anything wrong with the syntax?
 
Ok, I figured out there was a goof in my syntax. I have resolved it. However the results are not what I expected so I am going back to the drawing board. Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top