SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Aug 2003
    Location
    florida, us
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    same line gets error in one file, but not the other

    This is the error I get:

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/hockey07/HTML/forum/function.php on line 5

    Now, these are lines 1-10 of function.php

    PHP Code:
    <?
    function viewpost ($topicID) {

    $topic_query mysql_query("SELECT TopicName FROM topics WHERE (ID=$topicID)");
    $topic mysql_fetch_array($topic_query);
    ?>
    <TABLE BORDER=0 WIDTH=100% CELLSPACING=3 CELLPADDING=5>
            <TR>
                    <TD>
                    <FONT COLOR="#000000" FACE="Arial,Verdana,Helvetica" size=-1>
    and line 5 is

    PHP Code:
    $topic mysql_fetch_array($topic_query); 
    So doesnt anyone know the problem? Because i see no problem with that, especially when it works in other files i have..

  2. #2
    SitePoint Member Viper78's Avatar
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well try this

    PHP Code:
    $topic_query mysql_query("SELECT TopicName FROM topics WHERE ID='$topicID'" ); 
    take the () out of around the where clause and add single quotes.

    Hope this helps

    Viper

  3. #3
    SitePoint Zealot
    Join Date
    Aug 2003
    Location
    florida, us
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks I had ()'s at another part of my file, and it worked, so I didnt think that was the problem

    now i just dont get why when i use the same code in another forum, it works, but on my forum, it doesnt work >_< lol

  4. #4
    SitePoint Enthusiast Deo's Avatar
    Join Date
    Oct 2003
    Location
    Washington, USA
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A possibility of why its working on another forum and not yours could be how php is connecting to the database.

    Try comparing how both connect. Im sure thats where you will find your answer.

    ~Deo


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •