
maviyazilim
Members-
Posts
77 -
Joined
-
Last visited
Everything posted by maviyazilim
-
I have a file with a form. When I say add information here, it goes to the php file to be added. The problem was that while adding content to the database, it suddenly stopped adding content. Sometimes it adds, sometimes it doesn't. Why would it give such an error? <?php session_start(); include '../ayar/baglan.php'; if(isset($_POST['ekle'])) { $baslik = $_POST['baslik']; $icerik = $_POST['icerikici']; $yazar = $_POST['yazar']; $ekle = "insert into icerik (baslik,icerik,yazar) values ('$baslik','$icerik','$yazar')"; $sonuc = mysqli_query($veri,$ekle); } if($sonuc) { header("location:yonetim.php"); } ?>
-
Problem solved. Thanks for your help.
-
I changed the code as follows. if($_SERVER[REQUEST_METHOD] === 'POST') { This error code appears on the screen. Fatal error: Uncaught Error: Undefined constant "REQUEST_METHOD" in C:\xampp\htdocs\xxxx\login_check.php:14 Stack trace: #0 {main} thrown in C:\xampp\htdocs\xxxx\login_check.php on line 14
-
The result has not changed. It keeps giving the same error.
-
Fatal error: Uncaught Error: Undefined constant "REQUEST_METHOD" in C:\xampp\htdocs\xxxx\login_check.php:14 Stack trace: #0 {main} thrown in C:\xampp\htdocs\xxxx\login_check.php on line 14 on line 14 -> if($_SERVER[REQUEST_METHOD]==POST) { Why am I getting this error? what is the problem?
-
I am getting an error while creating the link.
maviyazilim replied to maviyazilim's topic in PHP Coding Help
The code structure given by Barand worked. It was a structure that I did not understand. I thanked you for your help. ginerjm the code you gave didn't work. but it was very close to what I knew and did. I worked on it and made it work. ginerjm, I have 2 solutions. So I chose yours, the way I know. is this an error? Thank you to all those who helped. link problem solved. but my problem is that when I click on the link, I cannot capture the content_id number that I sent with the post method on the page I go to and print the relevant content on the screen. The problem has become a different matter. So instead of starting a new thread, I continued here. thank you to everyone. -
I am getting an error while creating the link.
maviyazilim replied to maviyazilim's topic in PHP Coding Help
I want to learn by solving the problems in the code structure that I know a little bit. I don't understand the code structure that I don't know at all anyway. How can I do what I don't know at all, while I get an error in the structure when I know a little. As I learn, I look at structures that I do not know in the future. I want to solve them for now. -
I am getting an error while creating the link.
maviyazilim replied to maviyazilim's topic in PHP Coding Help
Barand. thank you so much. good bye take care -
I am getting an error while creating the link.
maviyazilim replied to maviyazilim's topic in PHP Coding Help
Barand. thank you so much. I tried the code you gave and it worked. but I've never seen it written that way before. so i can't use it. -
I am getting an error while creating the link.
maviyazilim replied to maviyazilim's topic in PHP Coding Help
ginerjm good quotes: echo "<a href='icerik.php?icerik" . $goster['icerik_id'] . '''>" . $goster['baslik'] . '</a>'; I implemented this code. gave an error. I changed it as below. echo '<a href="icerik.php?icerik' . $goster['icerik_id'] . '">' . $goster['baslik'] . '</a>'; It works as a link. I reach the file named contentik.php. In the link it says: https://localhost/blog/icerik.php?icerik22 It works but gives an error message. Warning: Undefined variable $goster in C:\xampp\htdocs\blog\orta.php on line 35 Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\blog\orta.php on line 35 Warning: Undefined array key "" in C:\xampp\htdocs\blog\orta.php on line 35 35 line - $giden = $_POST[$goster['icerik_id']]; When I access the file named contentik.php I get errors. icerik.php -> <?php $gelenid = $_POST['icerik_id']; $sorgula = mysqli_fetch_array(mysqli_query($conn,"select * from icerik where icerik_id='$gelenid'")); echo '<div id="icerik">'; echo '<div id="baslik">' . $row['baslik'] . '</div>'; echo '<div id="yazi">' . $row['yazi'] . '</div>'; echo '<div id="yazar">' . $row['yazar'] . '</div>'; echo '</div>'; Here are the errors received. Warning: Undefined array key "icerik_id" in C:\xampp\htdocs\blog\icerik.php on line 19 Warning: Undefined variable $row in C:\xampp\htdocs\blog\icerik.php on line 25 Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\blog\icerik.php on line 25 Warning: Undefined variable $row in C:\xampp\htdocs\blog\icerik.php on line 26 Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\blog\icerik.php on line 26 Warning: Undefined variable $row in C:\xampp\htdocs\blog\icerik.php on line 27 Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\blog\icerik.php on line 27 line 19 - $gelenid = $_POST['icerik_id']; line 25 - echo '<div id="baslik">' . $row['baslik'] . '</div>' line 26 - echo '<div id="yazi">' . $row['yazi'] . '</div>'; line 27 - echo '<div id="yazar">' . $row['yazar'] . '</div>'; -
I am getting an error while creating the link.
maviyazilim replied to maviyazilim's topic in PHP Coding Help
What is missing or wrong? -
I want to create a link to the content listed on the homepage and show the content on another page. I am getting an error like this. I am trying to post to file named icerik.php with post method. Parse error: syntax error, unexpected string content "", expecting "-" or identifier or variable or number in on line 39 39 - echo '<a href='icerik.php?=icerik' . $goster['icerik_id'] . ''>' . $goster['baslik'] . '</a>'; $giden = $_POST['icerik_id']; while($goster=mysqli_fetch_assoc($result)) { echo '<div id="konu">'; echo '<div id="baslik">'; echo '<a href='icerik.php?=icerik' . $goster['icerik_id'] . ''>' . $goster['baslik'] . '</a>'; echo '</div>'; echo '<div id="yazi">'; echo substr($goster['yazi'],0,300); echo '</div>'; echo '<div id="yazar">'; echo $goster['yazar']; echo '</div>'; echo '</div>'; }
-
ginerjm thank you.
-
ginerjm google translate did not translate. google translate did not translate. What is IMHO What is IMO
-
ginerjm If I manage to learn mysqli, I will learn pdo. thanks for advice. I've read over 20 video lessons for the simplest pagination at the moment. I've been dealing with it for a week or more. I just now solved it. I'm just trying to learn because I have interest and curiosity. I did not receive any school or training related to software. The fact that it was so difficult and challenging for a pagination made me very hard. If I manage to learn php, I try to learn pdo.
-
ginerjm. thanks. problem solved. Barand and ginerjm. thank you both so much
-
Barand. echo substr($goster['yazi'],0,300); shortens the old 16 content. it does not make abbreviations for the 5 contents I added later. it needs to publish the first 300 characters of the post.
-
when I add it later, the substr doesn't work.
-
-
Barand. problem solved. but I added content for trial purposes. to see if there will be 3 in storage. Substr does not work in the content I added recently. does not shorten. what could cause this?
-
ginerjm I got all the codes. this error pops up. Parse error: syntax error, unexpected token "{" in C:\xampp\htdocs\blog\orta.php on line 42 line 42 : { line41: elseif(isset($_POST['sayfa']) This is the first time I see the use of input tag in pagination construction. Is this how it should be used?
-
Strider64 thank you. i don't know pdo
-
barand. I got the above below. I deleted the query. this is the result. Fatal error: Uncaught TypeError: mysqli_fetch_assoc(): Argument #1 ($result) must be of type mysqli_result, string given in C:\xampp\htdocs\blog\orta.php:40 Stack trace: #0 C:\xampp\htdocs\blog\orta.php(40): mysqli_fetch_assoc('SELECT * FROM i...') #1 C:\xampp\htdocs\blog\index.php(4): include('C:\\xampp\\htdocs...') #2 {main} thrown in C:\xampp\htdocs\blog\orta.php on line 40 line 40 : while($goster=mysqli_fetch_assoc($sorgu)) {
-
<?php error_reporting(E_ALL | E_NOTICE); ini_set('display_errors', '1'); ?> <div id="orta"> <?php $sorgu = mysqli_query($conn,"select * from icerik order by icerik_id desc limit 10"); while($goster=mysqli_fetch_assoc($sorgu)) { echo '<div id="konu">'; echo '<div id="baslik">'; echo $goster['baslik']; echo '</div>'; echo '<div id="yazi">'; echo substr($goster['yazi'],0,300); echo '</div>'; echo '<div id="yazar">'; echo $goster['yazar']; echo '</div>'; echo '</div>'; } ?> <div id="sayfalama"> <?php $results_per_page = 10; $sql='SELECT * FROM icerik'; $result = mysqli_query($conn, $sql); $number_of_results = mysqli_num_rows($result); $number_of_pages = ceil($number_of_results/$results_per_page); if (!isset($_GET['sayfa'])) { $page = 1; } else { $page = $_GET['sayfa']; } $this_page_first_result = ($page-1)*$results_per_page; $sql="SELECT * FROM icerik order by icerik_id desc limit $this_page_first_result, $results_per_page"; $result = mysqli_query($conn, $sql); for ($page=1;$page<=$number_of_pages;$page++) { echo '<a href="index.php?sayfa=' . $page . '">' . $page . '</a> '; } ?> </div> </div>
-
i think you are right it was a mistake to ask help from this site. bye everyone. Thanks for your help