Note that there are some explanatory texts on larger screens.

plurals
  1. POCodeigniter Noob problems
    primarykey
    data
    text
    <p>I am noob in CI and I can't insert a data in database, here is all I have done, it doesn't show me an error but i don't get a result,</p> <p>admin.php (controller)</p> <pre><code>public function postnews(){ $ip = $_SERVER['REMOTE_ADDR']; if ($ip == "my ip address"){ session_start(); if (!isset($_SESSION['admin'])){ $this-&gt;load-&gt;view('admin-login'); die(0); } if ($_SESSION['admin'] != 'loged'){ $this-&gt;load-&gt;view('admin-login'); die(0); } if ($_SESSION['admin'] == 'loged'){ if (isset($_POST['title'])and isset($_POST['main-poster']) and isset($_POST['type']) and isset($_POST['year']) and isset($_POST['language'])and isset($_POST['platform'])and isset($_POST['publisher'])and isset($_POST['size'])and isset($_POST['graphics'])and isset($_POST['little-info'])and isset($_POST['full-info'])and isset($_POST['posters'])and isset($_POST['screenshots'])and isset($_POST['trailers'])and isset($_POST['gameplays'])and isset($_POST['author'])){ $title = $_POST['title']; $main_poster = $_POST['main-poster']; $type = $_POST['type']; $year = $_POST['year']; $language = $_POST['language']; $platform = $_POST['platform']; $publisher = $_POST['publisher']; $size = $_POST['size']; $graphics = $_POST['graphics']; $little_info = $_POST['little-info']; $full_info = $_POST['full-info']; $posters = $_POST['posters']; $screenshots = $_POST['screenshots']; $trailers = $_POST['trailers']; $gameplays = $_POST['gameplays']; $autor = $_POST['author']; $date = date("d.m.Y"); $this-&gt;load-&gt;model('Gamesmodel'); echo $this-&gt;Gamesmodel-&gt;PostArticle($title, $main_poster, $type, $year, $language, $platform, $publisher, $size, $graphics, $little_info, $full_info, $posters, $screenshots, $trailers, $gameplays, $autor, $date); }else{ $this-&gt;load-&gt;view('postnews'); } } } else { $this-&gt;load-&gt;view('404.htm'); die(0); } } </code></pre> <p>gamemodel.php model</p> <pre><code>&lt;?php class Gamesmodel extends CI_Model { function __construct() { // Call the Model constructor parent::__construct(); } function PostArticle($title, $main_poster, $type, $year, $language, $platform, $publisher, $size, $graphics, $little_info, $full_info, $posters, $screenshots, $trailers, $gameplays, $autor, $date) { $sql = "INSERT INTO game-articles (id, title, type, year, language, platform, publisher, size, graphics, little-info, full-info, posters, screenshots, trailers, gameplays, date, author) VALUES ('' ,".$this-&gt;db-&gt;escape($title).",".$this-&gt;db-&gt;escape($main_poster).",".$this-&gt;db-&gt;escape($type).",".$this-&gt;db-&gt;escape($year).",".$this-&gt;db-&gt;escape($language).",".$this-&gt;db-&gt;escape($platform).",".$this-&gt;db-&gt;escape($publisher).",".$this-&gt;db-&gt;escape($size).",".$this-&gt;db-&gt;escape($graphics).",".$this-&gt;db-&gt;escape($little_info).",".$this-&gt;db-&gt;escape($full_info).",".$this-&gt;db-&gt;escape($posters).",".$this-&gt;db-&gt;escape($screenshots).",".$this-&gt;db-&gt;escape($trailers).",".$this-&gt;db-&gt;escape($gameplays).",".$this-&gt;db-&gt;escape($date).",".$this-&gt;db-&gt;escape($author).")"; $this-&gt;db-&gt;query($sql); return $this-&gt;db-&gt;affected_rows(); } } </code></pre> <p>postnews.php view</p> <pre><code>&lt;!DOCTYPE HTML&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt; &lt;title&gt;Post News&lt;/title&gt; &lt;/head&gt; &lt;body style="background-color:black;"&gt; &lt;div style="margin:auto auto auto auto; width:800px; background-color:white; padding-top:20px; padding-bottom:20px; text-align:center;"&gt; &lt;form action="http://www.gameslib.net/admin/postnews" method="post"&gt;&lt;br /&gt; &lt;input type="text" placeholder="title" name="title" style="width:300px;" /&gt;&lt;br /&gt; &lt;input type="text" placeholder="main poster" name="main-poster" style="width:300px;" /&gt;&lt;br /&gt; &lt;input type="text" placeholder="type" name="type" style="width:300px;" /&gt;&lt;br /&gt; &lt;input type="text" placeholder="year" name="year"/&gt;&lt;br /&gt; &lt;input type="text" placeholder="language" name="language" style="width:300px;" /&gt;&lt;br /&gt; &lt;input type="text" placeholder="platform" name="platform" style="width:300px;" /&gt;&lt;br /&gt; &lt;input type="text" placeholder="publisher" name="publisher" style="width:300px;" /&gt;&lt;br /&gt; &lt;input type="text" placeholder="size" name="size"/&gt;&lt;br /&gt; &lt;input type="text" placeholder="graphics" name="graphics" style="width:300px;" /&gt;&lt;br /&gt; &lt;textarea name="little-info" placeholder="little-info" style="width:600px; height:100px;" &gt;&lt;/textarea&gt;&lt;br /&gt; &lt;textarea name="full-info" placeholder="full-info" style="width:600px; height:200px;" &gt;&lt;/textarea&gt;&lt;br /&gt; &lt;textarea name="posters" placeholder="posters" style="width:600px; height:50px;" &gt;&lt;/textarea&gt;&lt;br /&gt; &lt;textarea name="screenshots" placeholder="screenshots" style="width:600px; height:50px;" &gt;&lt;/textarea&gt;&lt;br /&gt; &lt;textarea name="trailes" placeholder="trailes" style="width:600px; height:50px;" &gt;&lt;/textarea&gt;&lt;br /&gt; &lt;textarea name="gameplays" placeholder="gameplays" style="width:600px; height:50px;" &gt;&lt;/textarea&gt;&lt;br /&gt; &lt;input type="text" placeholder="author" name="author" /&gt;&lt;br /&gt; &lt;input type="submit" value="P O S T"/&gt;&lt;br /&gt; &lt;input type="reset" value="reset"/&gt;&lt;br /&gt; &lt;/form&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>please help me, I copied allmost everything to be shure I am not ignoring something,</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload