SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 30
  1. #1
    SitePoint Zealot
    Join Date
    May 2001
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can anyone tell me what this means??

    Hi everyone,

    If anyone knows what this might mean, and ideally how I might fix it, it would be MUCH appreciated!! I believe that it's a PHP parsing error from the looks of it, but it may be something to do with Xitami:

    Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C:/PROGRAM
    FILES/XITAMI/webpages/REBDOTCA/cats.php on line 23

    Thanks in advance!

    -XGuy.

  2. #2
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It probably means that your quotes are messed up. If you still can't find the error post the code.

  3. #3
    You want what? By when?? Milamber's Avatar
    Join Date
    Jan 2001
    Location
    California
    Posts
    342
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it could be quotes, or brackets, or parenthesis, or perhaps even semi-colons.


    Post the code - you just need some one elses eyes to look it over.
    -Jeff Minard | jrm.cc - Battlefield 2 Stats

  4. #4
    SitePoint Zealot
    Join Date
    May 2001
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    The code on the page it happens on

    It happens right on an HTML page...when I try clicking the links to the three different php docs. If you need the code for the PHP files, just let me know.

    Cheers,

    XGuy.

    <!-- admin.html -->
    <HTML>
    <HEAD>
    <TITLE>Content Management System</TITLE>
    </HEAD>
    <BODY>
    <H1>
    <CENTER><U>R</U>esearch <U>E</U>thics data<U>B</U>ank</CENTER><P>
    </P><CENTER>Content Management System</CENTER></H1>
    <UL>
    <LI><H4><A HREF="articles.php">Manage Articles</A></H4>
    <LI><H4><A HREF="authors.php">Manage Authors</A></H4>
    <LI><H4><A HREF="cats.php">Manage Categories (Keywords)</A></H4>
    </UL>
    </BODY>
    </HTML>

  5. #5
    SitePoint Zealot
    Join Date
    May 2001
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Here is one of the page codes

    <!-- articles.php -->
    <HTML>
    <HEAD>
    <TITLE>Manage Articles</TITLE>
    </HEAD>
    <BODY>
    <H1>Manage Articles</H1>
    <P><A HREF="newart.php">Add New Article</A></P>
    <?php

    $dbcnx = @mysql_connect("localhost", "you", "pass");
    mysql_select_db("articles");

    $authors = mysql_query("SELECT ID, last_name, first_name FROM Authors");
    $cats = mysql_query("SELECT ID, Name FROM Categories");
    ?>

    <FORM ACTION="artlist.php" METHOD=POST>
    <P>View articles satisfying the following criteriaBR>
    By Author:
    <SELECT NAME="aid" SIZE=1>
    <OPTION SELECTED VALUE="">Any Author
    <?php
    while ($author = mysql_fetch_array($authors)) {
    $aid = $author["ID"];
    $aname = $author["last_name","first_name"];
    echo("OPTION VALUE='$aid'>$aname\n");
    }
    ?>
    </SELECT><BR>
    By Category:
    <SELECT NAME="cid" SIZE=1>
    <OPTION SELECTED VALUE="">Any Category (Keyword)
    <?php
    while ($cat = mysql_fetch_array($cats)) {
    $cid = $cat["ID"];
    $cname = $cat["Name"];
    echo("<OPTION VALUE='$cid'>$cname\n");
    }
    ?>
    </SELECT><BR>
    Containing Description Text: <INPUT NAME=TEXT NAME="searchtext"><BR>
    <INPUT TYPE=SUBMIT NAME="submit" VALUE="Search">
    </FORM>

    <P ALIGN=CENTER><A HREF="admin.html">Return to Front Page</A></P>
    </BODY>
    </HTML>

  6. #6
    SitePoint Evangelist CyberFuture's Avatar
    Join Date
    May 2001
    Location
    San Diego, CA
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    According to the Parse Error the problem is around line 23 in cat.php

    For help please post the code for cat.php

  7. #7
    SitePoint Zealot
    Join Date
    May 2001
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Something you should know

    When I try to open this files with the open file command in Netscape, they seem to work just fine...it is only when I open them as a /localhost/../file address that I get errors...but that is likely because PHP.exe is parsing them, right?

  8. #8
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $aname = $author["last_name","first_name"];
    should be:
    $aname = $author["last_name"] . ", " . $author["first_name"];

  9. #9
    You want what? By when?? Milamber's Avatar
    Join Date
    Jan 2001
    Location
    California
    Posts
    342
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also,

    is this legitimate code:

    PHP Code:
    $aname $author["last_name","first_name"]; 

    shouldn't it be:
    PHP Code:
    $aname $author[last_name] . $author[first_name]; 

    ??
    -Jeff Minard | jrm.cc - Battlefield 2 Stats

  10. #10
    You want what? By when?? Milamber's Avatar
    Join Date
    Jan 2001
    Location
    California
    Posts
    342
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Anarchos
    $aname = $author["last_name","first_name"];
    should be:
    $aname = $author["last_name"] . ", " . $author["first_name"];

    Doh, that ones right, no mine.
    -Jeff Minard | jrm.cc - Battlefield 2 Stats

  11. #11
    You want what? By when?? Milamber's Avatar
    Join Date
    Jan 2001
    Location
    California
    Posts
    342
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Something you should know

    Originally posted by XGuy
    When I try to open this files with the open file command in Netscape, they seem to work just fine...it is only when I open them as a /localhost/../file address that I get errors...but that is likely because PHP.exe is parsing them, right?
    Yes.
    -Jeff Minard | jrm.cc - Battlefield 2 Stats

  12. #12
    SitePoint Zealot
    Join Date
    May 2001
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How about I just post the parse error I get for articles.php?

    Parse error: parse error, expecting `']'' in C:/PROGRAM FILES/XITAMI/webpages/REBDOTCA/articles.php on line
    26

  13. #13
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Posting the error is not helpful at all if you don't post the code that goes with it.

  14. #14
    SitePoint Zealot
    Join Date
    May 2001
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    cats.php code, parse error is above

    Hi...thanks, the articles page opened up, but there were errors written in some of the form fields! I'll post them in a minute.

    <!-- cats.php -->
    <HTML>
    <HEAD>
    <TITLE>Manage Categories (Keywords)</TITLE>
    </HEAD>
    <BODY>
    <H1>Manage Categories (Keywords)</H1>
    <P ALIGN=CENTER><A HREF="newcat.php">Add New Category/Keyword</A></P>
    <UL>
    <?php

    $dbcnx = @mysql_connect("localhost", "you", "pass");
    mysql_select_db('articles');

    $cats = mysql_query("SELECT ID, Name FROM Categories");
    if(!$cats) {
    echo("<P>Error retrieving categories from database!<BR>".
    "Error: " . mysql_error());
    exit();
    }

    while ($cat = "mysql_fetch_array($cats)) {
    $id = $cat["ID"];
    $name = $cat["Name"];
    echo("<LI>$name ".
    "[A HREF='editcat.php?id=$id'>Edit This Category/Keyword</A>| ".
    "<A HREF='deletecat.php?id=$id'>Delete This Category/Keyword</A>]");
    }

    ?>
    </UL>
    <P ALIGN=CENTER><A HREF="admin.html">Return to Front Page</A></P>
    </BODY>
    </HTML>

  15. #15
    SitePoint Zealot
    Join Date
    May 2001
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Field errors in articles

    Any Author Warning: Supplied argument is not a valid MySQL resource in C:/.../articles.php on line 24
    Any Category (Keyword) Warning: Supplied argument is not a valid MySQL resource in C:/.../articles.php on line 35

  16. #16
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    while ($cat = "mysql_fetch_array($cats)) { has a quote in it...

  17. #17
    SitePoint Zealot
    Join Date
    May 2001
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Figured something out, but have another question

    Isn't this the command to load a database from a file that was MySQLDumped?
    LOAD DATA LOCAL INFILE "rebdotca.2001-11-07" INTO "rebdotca";

    ?
    I put the file in the bin directory, so if there is nothing wrong with the syntax or location, I dunno what's wrong with it...

  18. #18
    SitePoint Zealot
    Join Date
    May 2001
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    P.S.

    I am just trying to load the database structure from the file...

  19. #19
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you can just do mysql -u username -ppassword yourDatabase < yourfile.mysql from the command line.

  20. #20
    SitePoint Zealot
    Join Date
    May 2001
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Code for authors.php

    Please note that for all these, the database that I connect to now is called rebdotca, not articles anymore...all your help so far has been SUPER! Thanks so much, and keep up the good work. I have 7 more pages to my content management system, but I won't bother you with them all to look through unless you ask me to post the others. Thanks again, -XGuy.
    <!-- authors.php -->
    <HTML>
    <HEAD>
    <TITLE>Manage Authors</TITLE>
    </HEAD>
    <BODY>
    <H1>Manage Authors</H1>
    <P ALIGN=CENTER><A HREF="newauthor.php">Add New Author</A></P>
    <UL>
    <?php

    $dbcnx = @mysql_connect("localhost", "you", "pass");
    mysql_select_db('rebdotca');

    $authors = mysql_query("SELECT ID, last_name, first_name FROM Authors");
    if(!$authors) {
    echo("<P>Error retrieving authors from database!<BR>".
    "Error: " . mysql_error());
    exit();
    }

    while ($author = "mysql_fetch_array($authors)) {
    $id = $author["ID"];
    $name = $author["last_name","first_name"];
    echo("<LI>$name ".
    "[A HREF='editauthor.php?id=$id'>Edit This Author Entry</A>| ".
    "<A HREF='deleteauthor.php?id=$id'>Delete This Author Entry</A>]");
    }

    ?>
    </UL>
    <P ALIGN=CENTER><A HREF="admin.html">Return to Front Page</A></P>
    </BODY>
    </HTML>

  21. #21
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You still need to take out the quote on this line:
    while ($author = "mysql_fetch_array($authors)) {

  22. #22
    Node mutilating coot timnz's Avatar
    Join Date
    Feb 2001
    Location
    New Zealand
    Posts
    516
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    XGuy may I suggest you possibly get an editor that colour highlights your code, I find my one very useful, because if you miss out a quote or anything it is very easy to pick up and fix immediately!

  23. #23
    SitePoint Zealot
    Join Date
    May 2001
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Editor

    Good point Tim...I was more worried that it was my server and MySQL database that weren;t working properly, but now that I have established that it is just syntax errors, I'll do just that. Which editor is it that you use?

    Thanks everyone for all your help,

    -XGuy.

  24. #24
    Node mutilating coot timnz's Avatar
    Join Date
    Feb 2001
    Location
    New Zealand
    Posts
    516
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Editplus, there is a thread in this forum, just discussing what people use, so you might wanna check it out.

  25. #25
    SitePoint Zealot
    Join Date
    May 2001
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    An extra pair of eyes...

    Hi all,

    Thanks so much for your help so far! Tim, I used Edit+ and I like it alot...I have all of my pages loading now, but I get this error on the three where people submit a new article, author, or category:
    Warning: Undefined variable: submit in C:/PROGRAM FILES/XITAMI/webpages/REBDOTCA/newart.php on line 10

    I think that it may simply be because a file or text field has not been submitted yet, but I could be wrong. I get the same error for all three pages, so I would imagine that if someone knows a solution for this page, it will work with the others as well. Here's the code, and thanks again!

    <!-- newart.php -->
    <HTML>
    <HEAD>
    <TITLE>Add New Article</TITLE>
    </HEAD>
    <BODY>
    <H1>Add New Article</H1>
    <?php

    if ($submit): // A new article has been entered
    // using the form below.

    if ($aid == "") {
    echo("<P>You must choose an author " .
    "for this article. Click 'Back' " .
    "and try again. </P>");
    exit();
    }

    $dbcnx = @mysql_connect("localhost", "you", "pass");
    mysql_select_db("rebdotca");

    $sql = "INSERT INTO Articles SET " .
    "Description='$scrip', " .
    "Comments='$ments', " .
    "pub_date='$pdate', " .
    "AID='$aid'";
    if (mysql_query($sql)) {
    echo("<P>New Article Added</P>");
    } else {
    echo("<P>Error adding new article: " .
    mysql_error() . "</P>");
    }

    $rid = mysql_insert_id();

    $cats = mysql_query("SELECT ID, Name FROM Categories");

    while ($cat = mysql_fetch_array($cats)) {
    $cid = $cat["ID"];
    $cname = $cat["Name"];
    $var = "cat$cid"; // The name of the variable
    if ($$var) { // The checkbox is checked
    $sql = "INSERT IGNORE INTO ARTlookup " .
    "SET RID=$rid, CID=$cid";
    $ok = mysql_query($sql);
    if ($ok) {
    echo("<P>Article added to category: $cname</P>");
    } else {
    echo("<P>Error inserting article into category $cname:" .
    mysql_error() . "</P>");
    }
    if ( $userfile )
    {
    @$res=copy($userfile,"\\upload");

    if ( !$res )
    print "Upload failed! \n";
    else
    print "Upload of $userfile_name successful \n";
    }
    } // end of if ($$var)
    } // end of while loop
    ?>
    <P><A HREF="<?php echo($PHP_SELF); ?>">Add another Article</A></P>
    <P><A HREF="articles.php">Return to Article search</A></P>

    <?php
    else: // Allow the user to enter a new category

    $dbcnx = @mysql_connect("localhost", "you", "pass");
    mysql_select_db("rebdotca");

    $authors = mysql_query("SELECT ID, last_name, first_name FROM Authors");
    $cats = mysql_query("SELECT ID, Name FROM Categories");
    ?>

    <FORM ACTION="<?php echo($PHP_SELF); ?>" METHOD=POST ENCTYPE="multipart/form-data">
    <P>Enter the new articleBR>
    <TEXTAREA NAME="Description" ROWS=15 COLS=45 WRAP>
    </TEXTAREA>
    <P> Upload Article <BR>
    </P>
    <P>Author:
    <SELECT NAME="aid" SIZE=1>
    <OPTION SELECTED VALUE="">Select One
    <OPTION VALUE="">---------
    <?php
    while ($author = mysql_fetch_array($authors)) {
    $aid = $author["ID"];
    $alname = $author["last_name"];
    $afname = $author["first_name"];
    echo("<OPTION VALUE='$aid'>$alname $afname\n");
    }
    ?>
    </SELECT></P>
    <P>Place in categoriesBR>
    <?php
    while ($cat = mysql_fetch_array($cats)) {
    $cid = $cat["ID"];
    $cname = $cat["Name"];
    echo("<INPUT TYPE=CHECKBOX NAME='cat$cid'>$cname<BR>\n");
    }
    ?>
    </P>
    <P>File to Upload
    <INPUT TYPE="hidden" name="MAX_FILE_SIZE"
    value="2000000">
    <INPUT NAME="userfile" TYPE="file" size=35></P>
    <P><INPUT TYPE=SUBMIT NAME="submit" VALUE="SUBMIT"></P>
    </FORM>
    <?php endif; ?>
    </BODY>
    </HTML>

    Also, do you think that a file will upload properly on the same page as these other fields since it will just be passed as a variable like the other text fields will be?

    Cheers,

    XGuy.


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
  •