Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP/MYSQL - checking user identification from DB info
    primarykey
    data
    text
    <p>So, i am making kind of a blog system for my site, and i have 2 tables. One for storing users, their passwords and images (URLs), another for storing all the blog posts, with image_url, author, date and content. The relevant part of my HTML is:</p> <pre><code>&lt;form action="../scripts/send.php" method="post"&gt;&lt;input type="text" name="author" placeholder="Your name" style="width:30%;"/&gt;&lt;input type="password" name="pass" placeholder="Password" style="width:30%;"/&gt;&lt;br /&gt;&lt;input type="text" name="title" placeholder="Post Title" style="width:60%;" /&gt;&lt;br /&gt;&lt;textarea name="content" rows="20" style="width:60%;"&gt;&lt;/textarea&gt;&lt;br /&gt;&lt;button &gt;Post&lt;/button&gt;&lt;/form&gt; </code></pre> <p>And my PHP code (send.php) is:</p> <pre><code>&lt;?php mysql_connect("localhost","kroltan","eclipsepdt123") or die("Can't connect to DB"); mysql_select_db("kroltan_main") or die("Can't select to DB"); $result = mysql_query("SELECT * FROM `users`") or die("Can't fetch data"); if(mysql_num_rows($result) &gt; 0){ while($row = mysql_fetch_assoc($result)){ if ($row['name'] == strtolower($_POST['author'])){ if ($row['pass'] == strtolower($_POST['pass'])){ $name = $_POST['name']; $comm = $_POST['comment']; $result = mysql_query("INSERT INTO blog_posts (img_url, author, title, content) VALUES(".$row['img'].", ".$_POST['author'].", ".$_POST['title'].", ".$_POST['content'].")") or die("Can't send data"); header("Location: /?/=Talk"); } } } } ?&gt; </code></pre> <p>When i try to create a new post on the site, it does not work. I am not even redirected to the page</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