Announcement

Collapse
No announcement yet.

MySQL driving me crazy - a server issue?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • MortimerJazz
    replied
    Yeah, the database is being selected fine.

    The only error message I'm getting is:
    Code:
    Query failed: Unknown column 'castle' in 'where clause'
    I get that when I'm using the following MySQL:

    PHP Code:
    $recent_sql mysql_query("SELECT id, 
                                title, 
                                type, 
                                price,
                                description, 
                                hire, 
                                age, 
                                adults, 
                                requirements, 
                                overnight, 
                                picture, 
                                dim, 
                                gallerypics
                                  FROM range 
                                WHERE type=
    $choice"); 
    The string 'castle' is what is passed in the header. It should be the value of the 'type' field rather than the name of the column

    Leave a comment:


  • DavidAllen
    replied
    that looks fine - you say you transfered scripts from another server - have you got the connection string right? - I presume the table and field names are the same - but what about the database name?

    Leave a comment:


  • MortimerJazz
    replied
    Mmmmm - still having problems.

    It might have something to do with the way I'm reading the variable I'm passing in the header.

    The URL is something like this www.mydomain.com/view.php?id=1

    and the PHP I'm using is:

    PHP Code:
    $choice $_GET['id']; 
    Is that the problem?

    P.S. MASSIVELY appreciate your help here by the way ...

    Leave a comment:


  • DavidAllen
    replied
    Doesn't look wrong - are you sure it's the SQL Server that's the problem? The error suggests that the SQL Server call didn't return a result set. I assume if you have something like
    Code:
    $result = mysql_query($recent_sql, $link_id) or die('Query failed: ' . mysql_error().'<br>'.$query);
    $row = mysql_fetch_row($result) or die(mysql_error());
    that would tell you more about the problem - I'm guessing it's either a field/table name issue or the $link_id.

    Leave a comment:


  • MortimerJazz
    started a topic MySQL driving me crazy - a server issue?

    MySQL driving me crazy - a server issue?

    I'm transferring some php scripts from one server to my new eukhost.

    However, for some reason the MySQL isn't working - and it's driving me mad!!

    Here's the PHP I'm using:

    PHP Code:
    $recent_sql mysql_query("SELECT id, 
                                title, 
                                type, 
                                price,
                                description, 
                                hire, 
                                age, 
                                adults, 
                                requirements, 
                                overnight, 
                                picture, 
                                dim, 
                                gallerypics
                                  FROM range 
                                WHERE type='
    $choice'
                                ORDER BY price ASC"
    ); 
    I keep being told though that that "supplied argument is not a valid MySQL result resource."

    Is there any reason behind the scenes why this wouldn't work? As I can't see anything wrong with it, and as I said it worked on my previous server.

    ANY help would be REALLY appreciated!!
Working...
X