FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Fix this somebody please..





Aelita
heres the code:

Code:

10. $sql = sprintf('INSERT INTO Comments (topicid, author, post, date, ip)      VALUES (%s, %s, %s, %s, %s)', $topicid, $author, $post, $date, $ip);
11. $result = $db->sql_query($sql);
12. if ($result != false)
13. {
14.    echo "Thank you for your comments!";
15.    echo "please wait you are being redirected to the news page";
16.    echo "<meta http-equiv=\"refresh\"                                                     content=\"5;URL=../news.php\">";
17. }
18. else
19. {
20.    echo "There was an error please try again later!";
21.    die(mysql_error());
22. }


heres the error:

There was an error please try again later!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 ' shows.my.ip.address.edited)' at line 1

Anybody know the solution?
Lady Elensar
I don't know if i'm sure, but the error sais, that there's an error at line 1, but your code starts with line 10.. There's someting wrong with the syntax near 'shows.my.ip.address.edited)' at line 1. (That's what the error sais Confused) You should correct that line, I think. Smile
Aelita
No its talking about mysql when it says line 1. Line of of my code only say <?php

then after that there is an include. Thats for replying though

Okay update on issue I remove all variables in the sprinf and left only topicic and it works..WTF so that means the error is in the sprintf??????Im a freaking noob with this somebody help please!!!!!


OKAY I added another one, but the error appeared..different error though
heres the code:

Code:
$sql = sprintf('INSERT INTO Comments (topicid, author) VALUES (%s, %s)', $topicid, $author);


heres the error:

Quote:
There was an error please try again later!Unknown column 'aelita' in 'field list'

now explain to me how that happened, makes no sense..
Aelita
Okay sorry for reposting, but I got it you can close the topic after this post.

I dont know why this works, but it does so whatever.....

old code:

Code:
10. $sql = sprintf('INSERT INTO Comments (topicid, author, post, date, ip)      VALUES (%s, %s, %s, %s, %s)', $topicid, $author, $post, $date, $ip);
11. $result = $db->sql_query($sql);
12. if ($result != false)
13. {
14.    echo "Thank you for your comments!";
15.    echo "please wait you are being redirected to the news page";
16.    echo "<meta http-equiv=\"refresh\"                                                     content=\"5;URL=../news.php\">";
17. }
18. else
19. {
20.    echo "There was an error please try again later!";
21.    die(mysql_error());
22. }


new code:

Code:
$sql = sprintf("INSERT INTO Comments (topicid, author, date, post, ip) VALUES ('%s', '%s', '%s', '%s', '%s')", $topicid, $author, $date, $post, $ip);
$result = $db->sql_query($sql);
if ($result != false)
{
   echo "Thank you for your comments!";
   echo "please wait you are being redirected to the news page";
   echo "<meta http-equiv=\"refresh\" content=\"30;URL=../home.php?id=comments&topic=$topicid\">";
}
else
{
   echo "There was an error please try again later!";
   die(mysql_error());
}


what have we learned...?

CODING CAN BE SUCH A PAIN!

and for those wondering I'm 16...playing a game and helping people who were making a website thought I was older..I'm not and yes I'm a girl..
Reason i can put up with this..My brother is a web developer and I can't let him show me up...
n0obie4life
Closing according to author Wink.

-close-
Related topics
Parked Domain
Adress Domain FTP
What is all the hype about GMail?
"We don't give a ... about aliens!"Campaign!
Help Apache problems
Another Error eh?
bandwidth error correction
Can you help me.. please..
Somebody please install Joomla for me! I'll pay you!
Your Society - what makes it one of the Greats
Need help with file permissions for WordPress & plugins
URGENT: Please help - site down due to database error
.htaccess... Somebody help me!
Problem with CSS menu
This topic is locked: you cannot edit posts or make replies.    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.