00stuff
Members-
Posts
65 -
Joined
-
Last visited
Everything posted by 00stuff
-
The image is already being uploaded to the folder "userpictures" but I need the file to uploaded there with the modified name already. that way the location will show the actual image name. Do you understand?
-
Thanks but it still doesn't solve my whole problem. The answer you gave me adds the username to the location of the file, but the file is still being uploaded to the directory with the original name. I need the code to upload the file and change the file name while uploading it and send that modified file name to the location field on my database. Any ideas???
-
Hi guys, I have this code that I created. It is suppost to get a file from a form and upload it to a directory that is outside the root folder of my webserver. then the image name is added to the preset location of the directory that contains all of the uploaded images and is placed into a mysql database so I can call it later. the problem I have is that when some one else signs up through this form and the file they upload has the same file name it replaces the one that is already in the images directory that has all the other pictures. I need to add something to this code that adds $username to the end of the original file name and then uploads it to the directory with the new name. Since every username is unique it will make every username unique and will eliminate my problem. I am not sure how to do this. Please, anyone that can help. Thanks. This is my code. // get file attributes!!!!! $photoname = $_FILES['photo']['name']; $tmp_name = $_FILES['photo']['tmp_name']; if ($photoname) { // start upload process $location = "../userpictures/$photoname"; move_uploaded_file($tmp_name,$location); } else { $location = "../userpictures/nophoto.png"; } $queryreg = mysql_query(" INSERT INTO users VALUES ('','$fullname','$username','$password','$date','$location','$email','$phone') "); If there is a better way to upload images to a mysql database and outputting it later then please let me know as well. Thanks.
-
My code won't display more than 3972 characters?
00stuff replied to 00stuff's topic in PHP Coding Help
The only other thing I needed to know is how to add a cool text editor like this one so people can make the content bold, put lists, and change color. If you have any suggestions I would really appreciate the help. "About marking the post as solved..." I have tried but I get this message every time. "Session verification failed. Please try logging out and back in again, and then try again." I've tried logging out and in again but I always get the same message. -
My code won't display more than 3972 characters?
00stuff replied to 00stuff's topic in PHP Coding Help
I tried passing just the id with the url and then calling everything else on the tutorial.php page from the database and it worked. I guess the problem was that the url was too long. Thanks guys. You "all" are always great help!!! -
Hi guys, I am still working on the same code, but encountered another problem. I have a form that takes imput to a MySQL database. It is 5 fields (id,title,category,content,tags). Then I have form a new page that searches with FullText on the (title and tags) fields and echos a link with the content of the result like this: $link = "<h2><a class='example7' href='tutorial.php?id=" . $rowS['id'] . "&title=" . htmlentities($rowS['title'], ENT_QUOTES) . "&category=" . htmlentities($rowS['category'], ENT_QUOTES) . "&content=" . htmlentities($rowS['content'], ENT_QUOTES) . "&tags=" . htmlentities($rowS['tags'], ENT_QUOTES) . "'>" . htmlentities($rowS['title'], ENT_QUOTES) . "</a></h2><br><br>"; Then when the user clicks this link, it takes them to the tutorial.php page that all it does is echo the content passed by this link and make it look nice. The problem is that when the data of the content field is greater than 3972 characters in length it doesn't generate the code in the tutorial.php page. It's like if the url is too long to be passed or something... Is that my problem that I'm passing the content in a url? If that is the problem then how can I correct it? How else can I pass the result from the link to the tutorial.php page?
-
Trying to query some fulltext results with php from MySQL.
00stuff replied to 00stuff's topic in PHP Coding Help
Hey guys, thank you very much for your help. I figured it out. I only had one entry in my database and when using FullText searches if the result takes up 50% or more it dosn't return anything. I just placed more entries and then it worked. Thanks. -
Trying to query some fulltext results with php from MySQL.
00stuff replied to 00stuff's topic in PHP Coding Help
Ok, I clicked on the T and it added the full text, but now I get this error on the page. Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/content/r/o/c/rochoa1/html/itsupport/database/page/index.php on line 142 Line 142: while($rowS = mysql_fetch_array($RESULT)) -
Trying to query some fulltext results with php from MySQL.
00stuff replied to 00stuff's topic in PHP Coding Help
That didn't work. I got an error message. I don't think it's a problem with the code, because I copied it from another script that I had. I just changed the table name and the fields of course. How do I make sure the fields ("title,tags") are set to fulltext? I'm pretty sure that's the problem. -
Trying to query some fulltext results with php from MySQL.
00stuff posted a topic in PHP Coding Help
Hi guys, i'm trying to search from a form and use php to display the results of the FullText Search from a MySQL database, but I don't get any results from the query. This is the query: $query="SELECT * FROM tutorials WHERE MATCH(title, tags) AGAINST ('$searchform')"; I think the query is right but it doesn't give me any results.... Does anyone know what could be wrong? I think it might be something wrong with my table (database). my table should have 5 columns: id, title, category, content, tags The form should search throught the title and tags columns to see if it finds anything matching the $searchform , but I don't think it is doing it. Can anyone help please? -
Ok, guys I tried the htmlentities() with the second parameter set to ENT_QUOTES like this: $link = "<a href='tutorialshow.php?id=" . $row['id'] . "&title=" . htmlentities($row['title'], ENT_QUOTES) . "&category=" . htmlentities($row['category'], ENT_QUOTES) . "&content=" . htmlentities($row['content'], ENT_QUOTES) . "&tags=" . htmlentities($row['tags'], ENT_QUOTES) . "' target='new'>" . htmlentities($row['title'], ENT_QUOTES) . "</a>"; echo $link . "<br>"; but I get this on the output for the title part (the part with the ' ) Can\'t be working. It places that \ and I don't need that. Do I have to use that stripslash function now?
-
Hi guys, I am creating a simple page that takes input from the user in several text boxes and one text area. Then when you click on the submit button it stores that data into a MySQL database. Additional to this input page there will be a second page that shows the data that was stored in the database. It should be a simple project. The problem that I'm having is that when the user inputs data with ' apostrophes in it. It crashes my code. It doesn't show what ever is after the ' apostrophe is disregarded and the data doesn't show with the echo command. I really don't know what to do. I tried using some addslashes and removeslashes functions but they did not work. Maybe I used them incorrectly. That is why I need help. Here is my code. page that takes input: ( right now it is also the page that shows the data from the database. I will separate it later. ) <html> <head> <title>Tutorial Input</title> </head> <body link="blue" vlink="blue" alink="blue"> <h2> New Article </h2> <br> <form name="tutorial_form" method="post" action="inputarticle.php"> Title: <input name="tutorial_title" type="text"> Category: <input name="tutorial_category" type="text"> <br><br> Content:<br> <textarea rows='10' cols='90' name='tutorial_content'> </textarea><br><br> Tags:<br> <textarea rows='5' cols='30' name='tutorial_tags'> </textarea><br><br> <input type="submit" value="Submit"> </form> <br> <hr> <br> <?php $con = mysql_connect("host","username","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("database", $con); $result = mysql_query("SELECT * FROM tutorial_articles ORDER BY title"); while($row = mysql_fetch_array($result)) { $link = "<a href='tutorialshow.php?id=" . $row['id'] . "&title=" . $row['title'] . "&category=" . $row['category'] . "&content=" . $row['content'] . "&tags=" . $row['tags'] . "' target='new'>" . $row['title'] . "</a>"; echo $link . "<br>"; } mysql_close($con); ?> </body> </html> Then the code that enters the data to the database is this. <?php $a_title = $_POST["tutorial_title"]; $a_category = $_POST["tutorial_category"]; $a_content = $_POST["tutorial_content"]; $a_tags = $_POST["tutorial_tags"]; $con = mysql_connect("host","username","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("itdirectory", $con); $sql="INSERT INTO tutorial_articles (title, category, content, tags) VALUES ('$a_title','$a_category','$a_content','$a_tags')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($con); ?> <html> <head> <script type="text/javascript"> <!-- function delayer(){ window.location = "tutorialform.php"} //--> </script> </head> <body onLoad="setTimeout('delayer()', 3000)"><h2>Prepare to be redirected!</h2> </body> </html> Then the last page is just the page that opens after someone clicks on the link that is displayed on the input/link page: <?php $id = $_GET['id']; $title = $_GET['title']; $category = $_GET['category']; $content = $_GET['content']; $tags = $_GET['tags']; ?> <html> <head> <title><?php echo $title; ?></title> </head> <body> <?php echo "<font size='5'>" . $title . "</font> - <font color='green' size='2'>" . $category . "</font><br><br>"; echo $content; ?> </body> </html> Any help is welcome. Thanks in advanced. EDITed for CODE tags