Jump to content

Pawige

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Pawige's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks a lot for the quick replies! Works like a charm now. Edit: Actually, I've got another quick question, how can I use this $_GET to grab the values from the URL and stick them into a local value? Something along the lines of: $querylocal = $_GET['urlquery'] Which doesn't seem to work, but I imagine there must be some way to do it. I only need to because I've got a couple variables that I get from the URL and use in numerous places and in a couple of equations. $querylocalblah = $querylocal - 1; Something like that.
  2. Now it says: Error in SELECT * FROM Gallery WHERE id= AND category=: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND category=' at line 1 Here's what I could find about the server version, not sure if it's the right information, but it seems likely: MySQL - 4.1.21-standard-log Protocol version: 10 Server: Localhost via UNIX socket I'm digging around to see if I can find the answer, but if somebody knows it or where to find it, that'd be nice, as I'm having some trouble finding anything helpful so far.
  3. Here's the snipped out part of the code I'm using: [code] $dbh = mysql_connect ("localhost", "user", "password") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("database"); $movequery = "SELECT * FROM Gallery WHERE category=$category"; $moveresult = mysql_query($movequery); $query = "SELECT * FROM Gallery WHERE id=$id AND category=$category"; $result = mysql_query($query); mysql_close(); $numrows = mysql_num_rows($moveresult); if ( $id == $numrows ) { $nextid=1; } else { $nextid=$id + 1; } if ( $id == 1 ) { $previd=$numrows; } else { $previd=$id - 1; } $row = mysql_fetch_row($result); [/code] Running it at: [u]http://[my url]/gallery.php?id=3&category=0[/u] It gives me: [b]Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /[my url]/gallery.php on line 18[/b] [b]Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /[mu url]/gallery.php on line 23[/b] Everything works fine if I change it to something like this: [code]$movequery = "SELECT * FROM Gallery WHERE category=1"; $moveresult = mysql_query($movequery); $query = "SELECT * FROM Gallery WHERE id=1 AND category=1"; $result = mysql_query($query); mysql_close();[/code] So I'm guessing it has something to do with how I'm referencing those variables, but I'm totally stumped, because it used to work, and then suddenly stopped, and I hadn't touched any of the code in the interim. I'm pretty new at this, primarily an artist, just trying to learn some programming skills on the side, so if I've made an idiotic error, you can just chalk it up to that... Thanks in advance for any help!
×
×
  • Create New...

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.