Search the Community
Showing results for tags 'warning'.
-
Can someone please give me some guidance on how to deal with the following warning All directories and files in the path have full owner permissions and I've made myself the owner of them all (I'm on a linux system). I've also done the same with the /tmp folder. I can't even think of anything else to change and haven't found anything online that solves the issue. in case it's needed, the php is as follows: <?php require("assets/initializations.php"); if(isset($_POST['add_post']) && !empty($_FILES['post_image'])) { $filename = $_FILES['post_image']['name']; $file_tmp_name = $_FILES['post_image']['tmp_name']; $filesize = $_FILES['post_image']['size']; $file_ext = explode('.', $filename); $file_act_ext = strtolower(end($file_ext)); $allowed = array('jpeg', 'jpg', 'png', 'gif'); if(!in_array($file_act_ext, $allowed)) { header("Location: add_post.php?message=file_type_not_allowed"); } else { if($filesize > 10000000) { header("Location: add_post.php?message=file_too_large"); } else { $file_new_name = uniqid('', true) . "." . $file_act_ext; $dir = "../usernet/img/"; $target_file = $dir . basename($file_new_name); move_uploaded_file($file_tmp_name, $target_file); echo "<script>alert('Image uploaded successfully');</script>"; } } } I do get the javascript alert that's it's been successfully uploaded, but the image doesn't make it into the specified directory and I get the warnings at the top. I'm also, probably obviously from the path, using XAMPP server for development. TIA
-
I'm not hoping to much that I can solve this thing, but maybe someone here who knows php well can help me. Screenshot: http://extrazoom.com/image-70122.html?heuln50x50 File: https://mega.nz/#!uYgWmRTL!5ZyabPKnYWjeG2sL_PXyfFaAKaJiv4zceQGrky7fmPk And yes, I replaced "preg_replace" with "preg_replace_callback" and I ended up here: Screenshot:: http://extrazoom.com/image-70124.html?heuln50x50 Thank you and sorry for my bad english, if it's bad .
-
I am building a website about Doctor who, and I want to post various quotes from a database, when I wrote the select-query, I got the following error: Quotes Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /customers/e/a/c/doctorwhofans.be/httpd.www/test/Content/Quotes.php on line 106 (which is the one with the while expression). <?php //verbinding met de database require("./connect.php"); //select-query schrijven en uitvoeren $sql = " select * from QuotesTabel"; $result = mysql_query($sql); //alle records weergeven (terwijl er rijen gevonden worden. while ($row = mysql_fetch_assoc($result)) { //toon foto met info require("./ToonFoto.php"); } ?> Can someone help me please?
-
I'm working on a file uploading script. It checks the file size, and won't let an upload complete if over a size specified in config. This all works, but if a file is uploaded that goes over PHP's limit, then I get the familiar warning: Warning: POST Content-Length of 14622352 bytes exceeds the limit of 8388608 bytes in Unknown on line 0 I am not looking to allow this file to go through. I don't want to increase memory or the max post size. That's not the issue. The upload script already has a way for the user to see if their file had problems uploading (showing errors), but how can I catch the error shown above? I know the error won't display if the error reporting and display of errors is turned off, but I don't want to leave the user in the dark. They should get some feedback. What can I do here?
-
hey i was typing a smale login code but i keep geting this waring Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/u400486/domains/u400486.gluweb.nl/public_html/lekkerpittig/register.php on line 17 and it won't save on my table but i tink thats becouse of the waring can someone help out <?php include('config.php'); if($_SERVER['REQUEST_METHOD'] == 'POST'){ $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string(md5($_POST['password'])); if(empty($username)){ echo("you have to fill in an username!"); } else{ if(empty($password)){ echo("you have to fill in a password!"); } else{ $query = mysql_query("SELECT * FROM users WHERE username ='$username'"); $rows = mysql_num_rows($query); if($rows > 0){ die ("Username taken!"); }else{ $user_input = mysql_query("INSERT INTO users(username , password) VALUES('$username' , '$password')"); echo("succesfully registered!"); } } } } ?> <html> <head> <title>register</title> </head> <body> <form action="register.php" method="post"/> username: <input type="text" name="username"/> <br /> password: <input type="password" name="password"/> <br /> <input type="submit" value="resister!" /> </form> </body> </html>
-
i have found warning message = Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given inC:\xampp\htdocs\articles\artikel.php on line 7 <?php include 'koneksi.php'; $articleid = $_GET['articleid']; $sql_query = 'SELECT ta.*, tca.category_article FROM article_news AS ta INNER JOIN tcategory_article AS tca ON ta.category_article_id = tca.category_article_id WHERE article_id = '.$articleid; $query = mysql_query($sql_query); $row = mysql_fetch_array($query); //--> this is line #7 $msg = $_GET['msg']; if(!empty($msg)){ if($msg = 100){ echo '<h5 style="text-align:center; color:#f00; font-weight: normal">.</h5>'; } } ?> <!--articles--> <a name="TemplateInfo"></a> <input type="hidden" name="prodid" value="<?php echo $row['article_id'];?>" size="1"/> <h1><?php echo $row['judul'];?></h1> <p><a href=""><img src="images/upload/<?php echo $row['photo'];?>" width="100" height="120" class="float-left"></a> <p><?php echo $row['artikel'];?></a>. </p> <!--end of articles--> <p><?php echo $row['category_article'];?></p> <p class="post-footer"> <a href="index.html" class="readmore">Read more</a> <a href="index.html" class="comments">Comments (7)</a> <span class="date"><?php echo $row['tanggal'];?></span> </p> please help me i'm sorry newbie here..
-
Warning: mysql_num_rows() expects parameter 1 to be resource
grifb posted a topic in PHP Coding Help
help!!! i have been trying things all day with this and it wont work! <html> <div align="center"> <?php $key = $_POST['key']; $answer = $_POST['answer']; $username = $_POST['username2']; $item = explode(" ", $key); $final = $item[0]; $removals = array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"); $lower = str_replace($removals, "", $final); $newkey = strtolower($lower); $areplace = str_replace("," , "', '", $answer); $buff = "['$areplace']"; $finalanswer = strtolower($buff); if ($key&&$username&&$answer) { $connect = mysql_connect("fakedatabase","fakeuser", "fakepassword") or die("Couldn't Connect"); mysql_select_db("wordlist") or die("No Table"); $query = mysql_query("SELECT * FROM keylist WHERE keys='$newkey'"); $numrows = mysql_num_rows($query); echo $numrows; if ($numrows!=0) { $queryadduser1 = mysql_query("INSERT INTO userkeys Values('$username', 'Tried : $newkey')") or die("Unable to connect"); die("The key '$newkey' has already been added!"); } else $queryadd = mysql_query("INSERT INTO keylist Values('$newkey')") or die("Unable to connect"); $queryadd2 = mysql_query("INSERT INTO KeysAndAnswers Values('$newkey', '$finalanswer')") or die("Unable to connect"); $queryadduser1 = mysql_query("INSERT INTO userkeys Values('$username', 'Added : $newkey ')") or die("Unable to connect"); echo("The key '$newkey' and the answer '$finalanswer' Has just been submitted! Thank you!"); } else die("Key or answer or username was blank"); ?> </div> </html> You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'keys='123-123'' at line 1 -
<html> <head> <link rel="stylesheet" href="_admin-style.css" /> </head> <body> <?php include 'host_connect.php'; $server = 'temp'; $temporal = $_FILES['imagen']['tmp_name']; $image_name = $_FILES['imagen']['name']; $folder = $server.'/'.$image_name; move_uploaded_file($temporal,$folder); $desc = $_POST['descripcion']; $link = $_POST['link']; $sql = "INSERT INTO datos (ruta,descripcion,link) values('".folder."','".$desc."','".$link."')"; $res = mysql_query($sql); if ($res) { ?> <div class="user"> <input type='button' value='Volver al panel' onclick='window.location="user_panel.php"' style="margin-left:400px;" /> <p style="margin-left:400px;">Imagen guardada y recibida correctamente.</p> </div> <?php } else { ?> <div class="user"> <input type='button' value='Volver al panel' onclick='window.location="user_panel.php"' style="margin-left:400px;" /> <p style="margin-left:400px;">No se puede guardar la imagen.</p> </div> <?php } ?> </body> </html>
- 5 replies
-
- error move_uploaded_file()
- php
-
(and 2 more)
Tagged with: