Search the Community
Showing results for tags 'comment'.
-
foreach($text as $key => $value) { echo "test"; echo "value: " . $value . "<br />"; $tab=explode("\t", trim($value)); echo "<br />" . $tab[0] . $tab[$i1] . $tab[$i2] . $tab[$i3] . $tab[$i4] . $tab[$i5]. "<br />"; ... So this snippet is driving me mad. I'm trying to clean up some code that I've been working on in order to move on to the next segment. When I comment out the "echo value . $value" line, the whole thing 500's on me. I added in the echo test statement just to see if there was something weird going on with the open brace in the foreach statement. Does anyone have any idea why this would be acting this way. More code available upon request, but literally all I'm doing in between saves is adding a // in front of the word echo (I've tried at the very front of the line as well as directly in front of the e in echo with the same results). Thanks.
-
Hi all, I'm fairly new with PHP/HTML and I'm working on implementing a simple comment field for a website I'm designing. The issue I'm having is that the comment field seems to only display integers, and not strings. Other then not displaying words, I'm not getting any errors. The database seems to be working fine, however it's only saving Integers, and not Strings. I've checked the columns and the one which is holding the comments is using type "text", and the ID is "int". I don't believe the issue is with the table, but rather somewhere with the PHP. Here is the code below: <?php 02 mysql_connect("localhost","root","changeme"); 03 mysql_select_db("certestdb"); 04 $comment=$_POST['comment']; 05 $submit=$_POST['submit']; 06 07 08 $dbLink = mysql_connect("localhost", "root", "changeme"); 09 mysql_query("SET character_set_client=utf8", $dbLink); 10 mysql_query("SET character_set_connection=utf8", $dbLink); 11 12 13 14 if (!empty($_POST)) { 15 //$comment=$_POST['comment']; 16 //$submit=$_POST['submit']; 17 18 19 if($submit) { 20 if($comment) { 21 $insert=mysql_query("INSERT INTO comment (comment) VALUES ($comment) "); 22 } else { 23 echo "please fill out all fields"; 24 } 25 } 26 } 27 28 ?> 29 30 <html> 31 <head> 32 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 33 <title>Comment box</title> 34 </head> 35 <div style="width:100px; height:100px; margin: 2 auto;"> 36 <body> 37 <center> 38 <form name="comment.php" method="post" action=""> 39 <table> 40 <tr><td colspan="2">Comments: </td></tr> 41 <tr><td colspan="5"><textarea name="comment" rows="5" cols="150"></textarea></td></tr> 42 <tr><td colspan="2"><input type="submit" name="submit" value="Comment"></td></tr> 43 </table> 44 </form> 45 46 <?php 47 $dbLink = mysql_connect("localhost", "root", "changeme"); 48 mysql_query("SET character_set_results=utf8", $dbLink); 49 50 51 52 $getquery=mysql_query("SELECT * FROM comment ORDER BY id DESC"); 53 while($rows=mysql_fetch_array($getquery)) { 54 $id=$rows['id']; 55 $comment=$rows['comment']; 56 echo $comment . '<br/>' . '<br/>' . '<hr size="1"/>'; 57 } 58 59 ?> 60 61 </body> 62 </html> If anyone might know what is causing this and could help, it would be much appreciated! Thanks!
-
Hey guys, I was just wondering if anyone on here has some guidance for someone trying to build a comment time stamp (30 seconds ago, 1 minute ago, 1 month ago, 1 year ago, etc.) that takes the different day count of every month + leap year into consideration. I'm not asking for you guys to give me straight code or anything. I just need some guidance on finding the proper/best method of going about this. I'm guessing placing everything in arrays is a must? Thanks!
-
I'm pretty new to php, not so new to programming. My problem is really simple, and seems almost impossible to search for. When I reference an html link, the // renders everything after http: as a comment. I'm trying to learn to write webbots. This is the first basic lesson of the book "Webbots, Spiders and Screenscrapers": $target = "http://www.example.com/index.html"; $file_handle = fopen($target, "r"); while(!feof($file_handle)) echo fgets($file_handle, 4096); fclose($file_handle); It fails on both my Linux machine and Mac. "Parse error: parse error in Command line code on line 1". In the editor (nano) I see that everything after http: in line 1 is highlighted as a comment. This is straight from the book. What am I doing wrong?
-
Hey all I've had the idea of people posting political topics for others to rate, comment, agree/disagree and so on for about 5 years, built a website about 5 years ago which didn't really take off cos I didn't have the cash to market it. Started to recreate the idea about 3 months ago and I released it in the past couple of days. SpeekUp.com - Political Opinion On Steroids (Please note, as a political website, there are some opinions that you may find offensive) --- One thing, the logo is being worked on. I might also want to change the font but I'll await you feedback on that.