PHP/MySQL script problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jack

    PHP/MySQL script problem

    I'm having a problem with a PHP script I'm putting together. I created
    it on my computer running PHP 4.3.3 and MySQL 3.23.49 and it works
    properly. But when I upload it to my server, it does not.

    The query executes because I'm pulling data from two categories with the
    SELECT statement and it correctly displays the data from one of them.
    It's the other one that doesn't display at all. I triple checked my
    database table to make sure the field name (text) matched the query and
    it does. The server is running PHP 4.3.2 and MySQL 3.23.56.

    I have loaded a visible copy of the PHP script at


    Can anyone see a reason on there why the text results don't display? As
    I said, it works fine on my local machine. It's got me stumped.

    Thanks for any help you can offer.

  • Jack

    #2
    Re: PHP/MySQL script problem - FOUND!

    Jack wrote:[color=blue]
    > I'm having a problem with a PHP script I'm putting together. I created
    > it on my computer running PHP 4.3.3 and MySQL 3.23.49 and it works
    > properly. But when I upload it to my server, it does not.
    >
    > The query executes because I'm pulling data from two categories with the
    > SELECT statement and it correctly displays the data from one of them.
    > It's the other one that doesn't display at all. I triple checked my
    > database table to make sure the field name (text) matched the query and
    > it does. The server is running PHP 4.3.2 and MySQL 3.23.56.
    >
    > I have loaded a visible copy of the PHP script at
    > http://members.fortunecity.com/ace68/script.htm
    >
    > Can anyone see a reason on there why the text results don't display? As
    > I said, it works fine on my local machine. It's got me stumped.
    >
    > Thanks for any help you can offer.[/color]


    Found the problem. MySQL 3.23.49 apparently does not like a field name
    of text. I changed the field name and it's working perfectly.

    Sorry to have bothered you.


    Comment

    • Garp

      #3
      Re: PHP/MySQL script problem - FOUND!


      "Jack" <noemail@please .com> wrote in message
      news:vmn4c.1791 8$zS4.81240@att bi_s51...[color=blue]
      > Jack wrote:
      > Found the problem. MySQL 3.23.49 apparently does not like a field name
      > of text. I changed the field name and it's working perfectly.[/color]

      You can still use 'reserved' names, so long as you backtick (select `text`
      from mytable) or include the table name (select table.text from table). But
      it's better not to have to.
      [color=blue]
      >
      > Sorry to have bothered you.[/color]

      Hey, no problem. 8) One other thing though - your switch statement is
      pig-ugly:
      switch($q)
      {
      case 'Character Autographs and Photo Tips':
      $query = "SELECT * FROM tips WHERE category = 'character' ORDER
      BY submitted DESC";
      break;
      case 'Child ID & Lost Child Tips':
      $query = "SELECT * FROM tips WHERE category = 'childid' ORDER BY
      submitted DESC";
      break;
      case 'Disney Cruise Line Tips':
      $query = "SELECT * FROM tips WHERE category = 'dcl' ORDER BY
      submitted DESC";
      break;
      .....etc

      Please consider using a database lookup table, so that you don't have to
      revisit the source if you add/delete/change a category.

      HAND

      Garp


      Comment

      Working...