Jump to content

Alfraganus

Members
  • Posts

    60
  • Joined

  • Last visited

Everything posted by Alfraganus

  1. yes and it is not working, do you have any suggestion?
  2. my datas are not being shown properly, but I have declared charset=utf-8, i dont know what is wrong with it, but charset is not wroking <?php header('Content-Type: text/html; charset=UTF-8'); ?> <!DOCTYPE html> <html> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <link rel="stylesheet" href="style.css" media="all" /> </head> <link rel="stylesheet" type="text/css" href="style.css"> <body> <div id="header">ajshcoljwq qwpdjpqwkdqokdwpqodk'pqw </div> <div id="sidebar"> </div> <center> <div id="content"> <?php $con=new mysqli("localhost","root","", "testdb"); $sql="SELECT * FROM cms"; $run=mysqli_query($con, $sql); while($row=mysqli_fetch_array($run)) { $title=$row['title']; $body=$row['body']; } echo " <h1> $title</h1 <p>$body</p> "; ?> <div id="footer"> </center> </body> </html>
  3. Dear programmers, I am trying to retrieve all ma data from database, but my php is bringing me just my last data only, how can I bring them all? and one more problem, when I am trying to uplaod data to database, sometimes it is uplaoding and sometimes it is just igroning, what can it be result of? here is my tiny source code:: upload.php <!DOCTYPE html> <html> <head> <title>uploading a file</title> </head> <body bgcolor="blue"> <form accept="upload.php" method="post" enctype="multipart/form-data"> <table align="center" width="700" border="2" bgcolor="green"> <tr align="center"> <td align="center"> <td colspan="8"><h2>upload whatever you want mr Alfraganus</h2></td> </td> <tr> <td colspan="8" align="center"><input type="text" name="title" size="60"><b>Title</b></td> </tr> <tr> <td colspan="8"><textarea name="article" cols="80" rows="20"></textarea></td> </tr> <tr> <td colspan="8"><center><input type="submit" name="upload" value="upload the text"> </center></td> </tr> </table> </body> </html> <?php /*$servername="localhost"; $username="root"; $password=""; $dbname="testdb";*/ $conn=new mysqli ("localhost", "root","","testdb"); //checking connection if ($conn) { echo "success"; } if (isset($_POST['upload'])) { $title=$_POST['title']; $body=$_POST['article']; $insert="INSERT INTO cms (title, body) VALUES ('$title', '$body')"; $checking=mysqli_query($conn, $insert); } if($checking) { echo "<script>alert('success')</script>"; } ?> display.php <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <link rel="stylesheet" href="style.css" media="all" /> </head> <link rel="stylesheet" type="text/css" href="style.css"> <body> <div id="header">ajshcoljwq qwpdjpqwkdqokdwpqodk'pqw </div> <div id="sidebar"> </div> <center> <div id="content"> <?php $con=new mysqli("localhost","root","", "testdb"); $sql="SELECT * FROM cms"; $run=mysqli_query($con, $sql); while($row=mysqli_fetch_array($run)) { $title=$row['title']; $body=$row['body']; } echo " <h1> $title</h1 <p>$body</p> "; ?> <div id="footer"> </center> </body> </html>
  4. Alfraganus

    OO PHP

    Dear all, I am begginner to OO PHP, it is being hard for me to understand it, for example: <? class arraytoobject extends arraytoobject { public function __get($key) { return $this [$key] (why $key should come in bracket here?) } public function __Set($key, $val) (what is val? and why do we need it? why set has 2 arguments and get has only 1 argument?) { $this[$key]=$val; } } ?> would be happy if you would explain me these
  5. my articles in wordpress is being shows with its full size, even though I put "read more" function, it is coming with full words anyway, how can I fix it? or is there any plugin that helps me to fix "read more"?
  6. Alfraganus

    hello

    I succesfully uploaded my wordpress site to web, but later, I changed my site's url from wordpress's live site and it is not working right now, I intered to phpmyadmin in my cpanel and changed site url to its original domain from localhost, however, yet it is not working properly, admin panel is working fine but when I click to next page it is saying following messege Internal Server ErrorThe server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator at admin@main-hosting.eu to inform them of the time this error occurred, and the actions you performed just before this error. More information about this error may be available in the server error log." what should I do next?
  7. I changed mysql in mysqli but the result is the same, what can help me?
  8. Dear all, I've been trying to upload my datas to directly server, but somethis is wrong with it, my localhost is not saying any error but only (mysql_errno) messaging me "post has not been published succesfully": I dont know what wrong with it, I tried different ways but not working(((, I would be very glad if someones can fix it here are the codes: <?php mysql_connect("localhost","root",""); mysql_select_db("yangiliklar"); if (isset($_POST['submit'])) { $post_title=$_POST ['title']; // $post_date= date ('y-m-d'); $post_author=$_POST ['author']; $post_keywords=$_POST ['keywords']; $post_content=$_POST ['content']; $post_image=$_FILES ['image']['name']; $image_tmp= $_FILES ['image']['tmp_name']; if($post_title=='' or $post_keywords=='' or $post_content=='' or $post_author=='') { echo "<script>alert ('any on the field is empty') </script>"; exit (); } else { move_uploaded_file($image_tmp, "images/$post_image"); $insert_query="insert into posts (posts_title, post_author, post_image, post_keywords, post_content) values ('$post_title, '$post_author', '$post_image', '$post_keywords', '$post_content')"; if (mysql_query($insert_query)) { echo "<center><h1>post published succesfully </h1></center>"; } else { echo "post has not been published succesfully"; } (this message is coming) } } ?>
  9. what does "mysqli_errno expects exactly 1 parameter" means? I don't understand the logic of the problem, where should I pay attention? Warning: mysqli_errno() expects exactly 1 parameter, 0 given in C:xampphtdocsyangiliklaradmininsert_post.php on line 103
  10. I tried many times, dude, and I achieved a new error instead of the old ones, here is the error: Warning: mysqli_errno() expects exactly 1 parameter, 0 given in C:xampphtdocsyangiliklaradmininsert_post.php on line 103 and here is the php sourse code, I beleive html form is quite normal, the problem should belong to PHP:::: <?php $con=mysqli_connect("localhost","root","","yangiliklar") or die (mysqli_errno()); if (mysqli_connect_errno()) { echo "ulanmadi" .mysqli_connect_errno(); } else { echo "ulandi"; } if (isset($_POST['submit'])) { $post_title=$_POST ['title']; // $post_date= date ('y-m-d'); $post_author=$_POST ['author']; $post_keywords=$_POST ['keywords']; $post_content=$_POST ['content']; $post_image=$_FILES ['image']['name']; $image_tmp= $_FILES ['image']['tmp_name']; // if($post_title=='' or $post_keywords=='' or $post_content=='' or // $post_author=='') { // echo "<script>alert ('any on the field is empty') </script>"; // exit (); // } else { move_uploaded_file($image_tmp, "images/$post_image"); $insert_query="insert into posts (posts_title, post_author, post_image, post_keywords, post_content) values ('$post_title, '$post_author', '$post_image', '$post_keywords', '$post_content')"; line 103: $insert=mysqli_query($con, $insert_query) or die (mysqli_errno()); if ($insert) { echo "<center><h1>post published succesfully </h1></center>"; } else { "<br>"; echo "post has not been published succesfully"; } // } } ?>
  11. my apologies sir, but I had some problems with internet, when I clicked "post" button, there was an error on page, and I did one more time, I did not know the error also posted my question
  12. I dont know whats wrong with my codes but when I am clicking submit button, my datas are not being uploaded to database, please can you kindly check if I have something wrong? my codes: --------PHP-------------------- I cant fint my mistake here, I created database, I created a folder, but my locahost saying that 2 undefined indexes in image which are Notice: Undefined index: image in C:xampphtdocsyangiliklaradmininsert_post.php on line 68Notice: Undefined index: image in C:xampphtdocsyangiliklaradmininsert_post.php on line 70 here is the soursecode <?php include("includes/connect.php"); if (isset($_POST['submit'])) { $post_title=$_POST ['title']; $post_date= date ('d-m-y'); $post_author=$_POST ['author']; $post_keywords=$_POST ['keywords']; $post_content=$_POST ['content']; $post_image=$_FILES ['image']['name']; $image_tmp= $_FILES ['image']['tmp_name']; if($post_title=='' or $post_keywords=='' or $post_content=='' or $post_author=='') { echo "<script>alert ('any on the field is empty') </script>"; exit (); } else { move_uploaded_file($image_tmp, "images/$post_image"); $insert_query="insert into posts (posts_title, post_date, post_author, post_image, post_keywords, post_content) values ('$post_title, '$post_date','$post_author', '$post_image', '$post_keywords', '$post_content')"; if (mysql_query($insert_query)) { echo "<center><h1>post published succesfully </h1></center>"; } } } ?> ----------------HTML------------------------- <body> <form method="post" action="insert_post.php" enctype="multipart/form-data"> <table width="600" align="center" border="10"> <tr> <td align="center" bgcolor="green" colspan="6"><h2 style="color:red"><b><i>Insert new posts here</i></b></h2></td> </tr> <tr> <td align="right">Post Title</td> <td><input type="text" size="30" name="title"></td> </tr> <tr> <td align="right">Post Author</td> <td><input type="text" size="30" name="author"></td> </tr> <tr> <td align="right">Post keywords</td> <td><input type="text" size="30" name="keywords"></td> </tr> <tr> <td align="right">Post image</td> <td><input type="file" name="image"></td> </tr> <tr> <td align="right"> Post Content</td> <td><textarea name="content" cols="20" rows="15"> </textarea></td> </tr> <tr> <td align="center" colspan="4"><input type="submit" name="submit" value="publish now"> </td> </tr> </table> </form>
  13. I checked many times to know what is wrong with my codes, but could not find my mistake, my datas are not going to database (mysql database) could you please check if anything wrong with it? here are codes: <?php include("includes/connect.php"); if (isset($_POST['submit'])) { $post_title=$_POST ['title']; $post_date= date ('d-m-y'); $post_author=$_POST ['author']; $post_keywords=$_POST ['keywords']; $post_content=$_POST ['content']; $post_image=$_FILES ['image']['name']; $image_tmp= $_FILES ['image']['tmp_name']; if($post_title=='' or $post_keywords=='' or $post_content=='' or $post_author=='') { echo "<script>alert ('any on the field is empty') </script>"; exit (); } else { move_uploaded_file($image_tmp, "images/$post_image"); $insert_query="insert into posts (posts_title, post_date, post_author, post_image, post_keywords, post_content) values ('$post_title, '$post_date','$post_author', '$post_image', '$post_keywords', '$post_content')"; if (mysql_query($insert_query)) { echo "<center><h1>post published succesfully </h1></center>"; } } } ?> HTML-------------------------------------------------------- <body> <form method="post" action="insert_post.php" enctype="multipart/form-data"> <table width="600" align="center" border="10"> <tr> <td align="center" bgcolor="green" colspan="6"><h2 style="color:red"><b><i>Insert new posts here</i></b></h2></td> </tr> <tr> <td align="right">Post Title</td> <td><input type="text" size="30" name="title"></td> </tr> <tr> <td align="right">Post Author</td> <td><input type="text" size="30" name="author"></td> </tr> <tr> <td align="right">Post keywords</td> <td><input type="text" size="30" name="keywords"></td> </tr> <tr> <td align="right">Post image</td> <td><input type="file" name="image"></td> </tr> <tr> <td align="right"> Post Content</td> <td><textarea name="content" cols="20" rows="15"> </textarea></td> </tr> <tr> <td align="center" colspan="4"><input type="submit" name="submit" value="publish now"> </td> </tr> </table> </form>
  14. yeaaah dude, it has been fixed, I am such a blind(( but there is one more challange, the data is not being uploaded to database, when I am clicking the button, nothing is happening. what it could be ?
  15. here is my form, but there is image there <body> <form method="post" action="insert_post.php" enctype="mutipart/form-data"> <table width="600" align="center" border="10"> <tr> <td align="center" bgcolor="green" colspan="6"><h2 style="color:red"><b><i>Insert new posts here</i></b></h2></td> </tr> <tr> <td align="right">Post Title</td> <td><input type="text" size="30" name="title"></td> </tr> <tr> <td align="right">Post Author</td> <td><input type="text" size="30" name="author"></td> </tr> <tr> <td align="right">Post keywords</td> <td><input type="text" size="30" name="keywords"></td> </tr> <tr> <td align="right">Post image</td> <td><input type="file" name="image"></td> </tr> <tr> <td align="right"> Post Content</td> <td><textarea name="content" cols="20" rows="15"> </textarea></td> </tr> <tr> <td align="center" colspan="4"><input type="submit" name="submit" value="publish now"> </td> </tr> </table> </form>
  16. Alfraganus

    undifened index

    I cant fint my mistake here, I created database, I created a folder, but my locahost saying that 2 undefined indexes in image which are Notice: Undefined index: image in C:xampphtdocsyangiliklaradmininsert_post.php on line 68Notice: Undefined index: image in C:xampphtdocsyangiliklaradmininsert_post.php on line 70 here is the soursecode <?php include("includes/connect.php"); if (isset($_POST['submit'])) { $post_title=$_POST ['title']; $post_date= date ('d-m-y'); $post_author=$_POST ['author']; $post_keywords=$_POST ['keywords']; $post_content=$_POST ['content']; LINE 68: $post_image=$_FILES ['image']['name']; LINE 70: $image_tmp= $_FILES ['image']['tmp_name']; if($post_title=='' or $post_keywords=='' or $post_content=='' or $post_author=='') { echo "<script>alert ('any on the field is empty') </script>"; exit (); } else { move_uploaded_file($image_tmp, "images/$post_image"); $insert_query="insert into posts (posts_title, post_date, post_author, post_image, post_keywords, post_content) values ('$post_title, '$post_date','$post_author', '$post_image', '$post_keywords', '$post_content')"; if (mysql_query($insert_query)) { echo "<center><h1>post published succesfully </h1></center>"; } } } ?>
  17. that worked well, thanks a loot mr Ingolme
  18. I cant locate my text between 2 images. it must be <img> <h1>dildora<h1> <img> as location. but first photo is locating next to text, but next photo is locating right below the text. any solution? css style #sidebar { width: 300px; height: 50px; float: left; } ----html---- <div id="sidebar"> <img align="left" src="images/02.gif" width="90" height="60"> <h1 align="left">Dildora</h1> <img align="left" src="images/03.gif" width="90" height="60">
  19. do you mean creating a border around an object?
  20. i dont know why but, ajax is not sending request to database, I supposed to register email with the help of database, let me show codes, when I am clicking submit button, nothing is happening. HTML---- <html> <head> <script src="http://code.jquery.com/jquery-2.1.4.js"></script> <script> $(document).ready(function(){ $("#sub").click(function(){ var name = $("#name").val(); var email = $("#email").val(); var pass = $("#pass").val(); $.POST('test.php',{ name:name,email:email,pass:pass },function(data){ $("#result").html(data); }); }); }); </script> </head> <body> <div id="box"> <h2>new user register</h2> <input type="text" name="name" id="name" placeholder="enter your name"/><br> <input type="text" name="email" id="email" placeholder="enter your email"/><br> <input type="password" name="pass" id="pass"/><br> <input type="submit" name="sub" value="submit" id="sub" > <div id="result"> </div> </div> </body> </html> ----test.php............ <?php $con=mysqli_connect("localhost","root","","test"); $name=$_POST ['name']; $email=$_POST ['email']; $pass=$_POST ['pass']; $sel="select * from users where email='$email'"; $run=mysqli_query ($con, $sel); $check_email=mysqli_num_rows ($run); if ($check_email==1) { echo "<h2>This is email is already registered, try another</h2>"; exit(); } else { $insert="insert into users (name,pass,email) values ('$name','$pass',$email')"; $run_insert=mysqli_query($con,$insert); if($run_insert) { echo "<h2>registration has been succesfull G'ulomjon aka </h2>"; } } ?>
  21. it worked, thanks you for your help, but what was the mistake? how could you manage it?
  22. I was creating a small html and ajax combination funchtion, but ajax one is not working, when I am clicking the button, it should show me "hello world" string, however, function is not working, let me show my codes if I've done something wrong: <!DOCTYPE html> <html> <head> <title>ajax tuturial</title> <script scr="jquery.js"></script> <script> $(document).ready(function() { $("#sub").click (function() { $.post("test.php", function(data) { $("#result").html(data); }); }); }); </script> </head> <body> <div id="box"> <h2>new user register</h2> <input type="text" name="name" id="name" placeholder="enter your name"><br> <input type="submit" name="sub" value="submit" id="sub" /> <div id="result"> </div> </div> </body> </html>
  23. when I am clicking update cart button, it should suppose to jump to new cart.php file, but instead it is doing something odd, what can cause it? it is jumping to http://localhost/ecom/ecom/cart.php (I just have 1 ecom folder, not 2) <?php $ip=getIp(); if (isset($_POST['update_cart'])) { foreach($_POST['remove']as $remove_id) { $delete_product="delete from cart where p_id='$remove_id' AND ip_add='$ip'"; $run_delete=mysqli_query($con, $delete_product); if($run_delete) { echo "<script>window.open('cart.php','_self') </script>"; } } } if (isset ($_POST['continue'])){ echo "<script>window.open('index.php','_self') </script>"; }
×
×
  • Create New...