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


SQL Insert





DanielXP
This is my code

Code:
$sql = "mysql_query(INSERT INTO banners (by, linkurl, bannerurl) VALUES ('$by', '$linkurl', '$bannerurl'))";


Some reson it wont insert into my database.

this is the stru

Code:
CREATE TABLE `banners` (
`id` INT(11) NOT NULL ,
`by` VARCHAR(30) NOT NULL ,
`linkurl` VARCHAR(150) NOT NULL ,
`bannerurl` VARCHAR(150) NOT NULL,
PRIMARY KEY (`id`)
) TYPE = MYISAM ;



Its not putting any thing into the database
hexkid
DanielXP wrote:
This is my code

Code:
$sql = "mysql_query(INSERT INTO banners (by, linkurl, bannerurl) VALUES ('$by', '$linkurl', '$bannerurl'))";


Some reson it wont insert into my database.

What reason?
You are not showing the mysql_query() call. Are you calling mysql_query()?

Find the reason it wont insert by checking MySQL error
Code:

$sql = "INSERT INTO banners (by, linkurl, bannerurl) VALUES ('$by', '$linkurl', '$bannerurl')";
$res = mysql_query($sql);
if (!$res) {
  $reason = mysql_error();
  echo '<p class="error">There was an error.<br>';
  echo 'The error was: <b>', $reason, '</b><br>';
  echo 'Please <a href="mailto:you@example.com">report</a> a bug. Thank you</p>';
  exit(0);
}
devroom
DanielXP wrote:
This is my code

Code:
$sql = "mysql_query(INSERT INTO banners (by, linkurl, bannerurl) VALUES ('$by', '$linkurl', '$bannerurl'))";


Some reson it wont insert into my database.

this is the stru

Code:
CREATE TABLE `banners` (
`id` INT(11) NOT NULL ,
`by` VARCHAR(30) NOT NULL ,
`linkurl` VARCHAR(150) NOT NULL ,
`bannerurl` VARCHAR(150) NOT NULL,
PRIMARY KEY (`id`)
) TYPE = MYISAM ;



Its not putting any thing into the database


the code should be this:
Code:
$sql = mysql_query("INSERT INTO banners (by, linkurl, bannerurl) VALUES ('$by', '$linkurl', '$bannerurl')");
DanielXP
LOCK PLEASE
mathiaus
-close-
Related topics
Visitor notebook for php
An idea to stop people NOT reading TOS.
MySQL DB Backup script - minor problem
Help with mysql query
image upload, and return url to image
how to simplify these codes?
Login System Tutorial Part 1 Creating Registration
execute php string
forum fireboard sur joomla 1.5
You don't have permission to access / on this server.
404 Not Found error was encountered (PLEASE HELP!!!)
is SERVER IS down?
Weird php script behavior
How to make this code simple?
This topic is locked: you cannot edit posts or make replies.    Frihost Forum Index -> Scripting -> Php and MySQL

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