what does this php error mean? ( 5 Views )

no kitty!
  1. Code:

    Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /home/wjessup/public_html/php/submissionpage.php on line 22
    this is line 22,

    Code:

    $forum_link = (isset($HTTP_POST_VARS['forum_link'])) ? addslashes($HTTP_POST_VARS['forum_link']) : "";

    (cem, Chile)

  2. Dreamweaver MX 2004 is my coding tool of choice. For amateur web devs it's a little expensive so try looking around for a few other tools.

    There is one called DzSoft PHP Editor that is only around $40 USD to register and it supports syntax highlighting, etc. I've heard it is a pretty good piece of software but I have never used it myself.

    I believe there are also a couple free IDE's for PHP so do some searches in google or whatever and see what you come up with.

    Hope this helped. :)

    (nazlı, Bhutan)

  3. what program do you use to code PHP in? The color coding helps a bunch but right now i'm only using notepad *gasp* , so that's probably half the reason for so many stuipd mistakes.

    (esra zehra, Guam)

  4. You have a missing quote in your MySQL query...

    PHP Code:

    mysql_query("INSERT INTO un_News(name,email,title,front,main,front_link,discussion_link,articleid,date,  hide)
                 VALUES( '$name' , '$email' , '$title' , '$front' , '$main' , '$front_link' , '$discussion_link' , '$articleid' , '$date' , '1')"
    ) or die(mysql_error());


    (mehmet, Macao)

  5. now i get this:

    Quote:

    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 'href=\"http://www.nrgdrink.com/php/asdf.php\">Full Article\

    (ramazan, Mali)

  6. You actually only had one open quote, the first one. The other quotes didn't close it because they were "escaped". Actually all you need is something like this:

    PHP Code:

    $front_link = "<a href='http://www.nrgdrink.com/php/asdf.php'>$link_text</a>";


    (HAKAN, Madagascar)

  7. PHP Code:

    $front_link = "<a href=\"http://www.nrgdrink.com/php/asdf.php\">$link_text</a>\"";

    that worked! thanks!

    why are there 5 quotes tho? isn't it always open one, close one... i dont understand why an odd number works in this case.

    (aysima, Ireland)

  8. I don't even need the last escape:

    PHP Code:

    $front_link = "<a href=\"http://www.nrgdrink.com/php/asdf.php\">$link_text</a>";

    Matt

    (fg, Jordan)

  9. Quote:

    Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /home/wjessup/public_html/php/submissionpage.php on line 22
    This usually refers to unclosed strings. It is expecting a closing quote or a variable of some sort.

    Change this:
    PHP Code:

    $front_link = "<a href=\"http://www.nrgdrink.com/php/asdf.php\">$link_text</a>\";

    To this:
    PHP Code:

    $front_link = "<a href=\"http://www.nrgdrink.com/php/asdf.php\">$link_text</a>\"";


    (ekrem, Sri Lanka)

  10. PHP Code:

    <?php
    $PHP_SELF
    = $_SERVER['PHP_SELF'];
    include(
    'dbconnect.php');

    $submit = (isset($HTTP_POST_VARS['submit'])) ? $HTTP_POST_VARS['submit'] : "";
    if (
    $submit) {
            
            
    $date = date("Y-m-d H:i:s");
            
    $name = (isset($HTTP_POST_VARS['name'])) ? addslashes($HTTP_POST_VARS['name']) : "";
            if (
    $name == "") $tableid[0] =  "name";
            
    $email = (isset($HTTP_POST_VARS['email'])) ? addslashes($HTTP_POST_VARS['email']) : "";
            if (
    $email == "") $tableid[1] =  "email";
            
    $title = (isset($HTTP_POST_VARS['title'])) ? addslashes($HTTP_POST_VARS['title']) : "";
            if (
    $title == "") $tableid[2] =  "title";
            
    $front = (isset($HTTP_POST_VARS['front'])) ? addslashes($HTTP_POST_VARS['front']) : "";
            if (
    $front == "") $tableid[3] =  "front";
            
    $main = (isset($HTTP_POST_VARS['main'])) ? addslashes($HTTP_POST_VARS['main']) : "";
            if (
    $main == "") $tableid[4] =  "main";
            
    $link_text = (isset($HTTP_POST_VARS['link_text'])) ? addslashes($HTTP_POST_VARS['link_text']) : "";
            
    $front_link = "<a href=\"http://www.nrgdrink.com/php/asdf.php\">$link_text</a>\";
            $front_link = addslashes ($front_link);
            $forum_link = (isset($HTTP_POST_VARS['forum_link']) ? addslashes($HTTP_POST_VARS['forum_link']) : "");
            if ($forum_link == "") $tableid[5] =  "
    forum_link";    
            $forum_text = (isset($HTTP_POST_VARS['forum_text'])) ? addslashes($HTTP_POST_VARS['forum_text']) : "";
            if ($forum_text == "") $tableid[6] =  "
    forum_text";
            $discussion_link = "
    <a href=$forum_link>$forum_text</a>";
            $discussion_link = addslashes ($discussion_link);

            
            if ($name && $email && $title && $front && $main && $forum_link && $forum_text != "") {
            echo "
    <h1> Preview of  " . $title . " <BR> Check for errors</H1>";
            mysql_query("
    INSERT INTO un_News(name,email,title,front,main,front_link,discussion_link,articleid,date,hide) VALUES ('$name' , '$email' , '$title' , '$front' , '$main , '$front_link' , '$discussion_link' , '$articleid' , '$date' , '1')") or die(mysql_error());
            }
    }
    ?>




    <html>
    <head>
    <link rel="stylesheet" href="css/styles.css" type="text/css">
    <style type="text/css">

    <?php
    foreach (array_keys($tableid) as $key) {
        if ($tableid[$key] != "") echo "#" . $tableid[$key] . "{\nbackground-color:#FB9EB2;}\n";
    }?>

    </style>
    </head>
    <body>
    <form method="post" action="submissionpage.php">
    <input type="hidden" name="cmd" value="submit" size="20">

    <h1>Article Submission page</h1>
    Original Code: Chris stewart. Modified: Will Jessup
      
    <table cellspacing="10px">
        <tr>
          <td id="name">Name: <br /> <input type="text" name="name" value="<?php print $name; ?>" size="37"> <?php if ($tableid[0] == "name") echo "<br /><h6>Please enter data</h6>"; ?></td>
        </tr>
        <tr>
          <td id="email">Email: <br /><input type="text" name="email" value="<?php print $email; ?>" size="37"> <?php if ($tableid[1] == "email") echo "<br /><h6>Please enter data</h6>"; ?></td>
        </tr>
        <tr>
          <td id="title">Article Title: <br /><input type="text" name="title" value="<?php print $title; ?>" size="37"> <?php if ($tableid[2] == "title") echo "<br /><h6>Please enter data</h6>"; ?></td>
        </tr>
        <tr>
          <td id="front">Front Page Text: <br /><textarea rows="12" name="front"cols="47"><?php print $front; ?></textarea> <?php if ($tableid[3] == "front") echo "<br /><h6>Please enter data</h6>"; ?></td>
        </tr>
        <tr>
          <td id="main">Main Post:<br /><textarea rows="12" name="main" cols="47"><?php print $main; ?></textarea> <?php if ($tableid[4] == "main") echo "<br /><h6>Please enter data</h6>"; ?></td>
        </tr>
        <tr>
          <td id="link_text">Link from front page to articles text:<br /><input type="text" name="link_text" value="<?php  if($link_text != "") print $link_text; else print "Full Article"; ?>" size="37"></td>
        </tr>
        <tr>
          <td id="forum_link">Discussion Link URL:<br /><input type="text" name="forum_link" value="<?php print $forum_link; ?>" size="37"><?php if ($tableid[5] == "forum_link") echo "<br /><h6>Please enter data</h6>"; ?></td>
        </tr>
        <tr>
          <td id="forum_text"> Discussion Link Text: <br /><input type="text" name="forum_text" value="<?php print $forum_text; ?>" size="37"><?php if ($tableid[6] == "forum_text") echo "<br /><h6>Please enter data</h6>"; ?></td>
        </tr>
        <tr>
          <td>
              <input name="submit" type="submit" id="submit" value="Submit">
              &nbsp;
              <input type="reset" value="Cancel Post" name="cancel">
          </td>
        </tr>
      </table>
    </form>
    </body></html>


    (hakan, Mozambique)

  11. Yeah.. please post the code around it. The } or ; or an unclosed ' or " is likely the issue.

    (zeynep, Russian Federation)

  12. Is there a missing bracket '}' or ';' in the lines above?

    Matt

    (HALİL İBRAHİM , Saudi Arabia)

  13. no luck,
    funny thing is that this error 'spontaneously' appeared. the scripts worked fine until i added something somewhere else.

    (yağmur, Czech Republic)

  14. try
    PHP Code:

    $forum_link = (isset($HTTP_POST_VARS['forum_link']) ? addslashes($HTTP_POST_VARS['forum_link']) : "");


    (musty, Brazil)

  15. Try Source Edit. It's freeware. It's available at download.com.

    (salih, Spain)



Related Topics ... (or search in 1.720.883 topics !)

session error in php on iis 5 error, "undefined index xyz on c:/.../index.php" (9)
php error or permission problem or smarty error (8)
php error - session error - huh? (3)
error: php warning:php startup:c:phpext|php_mysql.dll"- need help (2)
php ant 2 access controll signup.class.php error (13)
php, apache, mysql & jokelist.php - fatal error (5)
php anthology vol ii - by harry f - session error running 6.php (5)
http 500 error, php installed on xppro, im a php-newbie, help? (4)
php include() error...possible php.ini edit needed? (6)
php error - does this mean the domain server does not handled php? (6)




copyright © 2007-2031 Pfodere.COM ( 3 Pfoyihuee Online )

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 
1.4384