[SQL]insert into table error
PHP Code:
<?php include("includes/header.php");?>
<?php
if(isset($_REQUEST['submit'])){
$query=mysql_query("INSERT INTO `a4794514_guru`.`news` ('user', 'title',' page_body') VALUES ('$user', '$title', '$page_body')") or die("error");
$title=$_REQUEST['title'];
$user=$_REQUEST['user'];
$page_body=$_REQUEST['page_body'];
}
?>
<br />
<form name="submit" action="">
<input type="text" name="title" value="" />
<br /><input type="text" name="user" value="" />
<br /><input type="text" name="page_body" value="" />
<br />
<input type="submit" name="submit" value="Submit Query" /> <input type="reset" value="Reset" />
</form>
<?php include("includes/footer.php");?>
No matter what i do i always get a error =/
Re: [SQL]insert into table error
ur asking for a sql injection..
anyway don't use `
Re: [SQL]insert into table error
Quote:
Originally Posted by
john_d
ur asking for a sql injection..
anyway don't use `
Thanks that solved the problem :D
Re: [SQL]insert into table error
Quote:
Originally Posted by
FragFrog
...backticks are good. Keep the backticks. :icon6:...
The backticks should be able to stay w/o errors.
Maybe put the variables above the $query?
Re: [SQL]insert into table error
PHP Code:
$query=mysql_query("INSERT INTO `a4794514_guru`,`news` ('user', 'title',' page_body') VALUES ('$user', '$title', '$page_body')") or die("error");
$title=$_REQUEST['title'];
After `a4794514_guru` you had a period (.) instead of a comma.
Re: [SQL]insert into table error
I think the period was correctly placed, I believe it's like: `database`.`table` or something.