Jump to content

Javil

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Everything posted by Javil

  1. Hi, i have alot of trouble getting wordpress going. - I uploaded wordpress to my hosting server - I startup wp-admin/install.php and fill in my account settings. Then i get this error: Phymyadmin is really troubling me, if i look up a tutorial te use phpmyadmin then it always say to create a new database. But in my case it say : Anyone any idea?
  2. Sorry, i'm really stuck. There are so many variable's now.. <input type="hidden" id="pageid" name="pageid" value="1" /> on my form i have pageid, with a value of 1.. $comments = array(); $result = mysql_query("SELECT * FROM comments WHERE page_id = ".$pageid." ORDER BY id ASC"); also on my form webpage, i have this ".$pageid." <- is this correct ?? mysql_query(" INSERT INTO comments(name,url,email,body,page_id) VALUES ( '".$arr['name']."', '".$arr['url']."', '".$arr['email']."', '".$arr['body']."', '".$arr['pageid']."' )"); and is this correct? Maybe you can have a a look here, for the complete tutorial. http://tutorialzine.com/2010/06/simple-ajax-commenting-system/ The only thing i want, is to make this comment system unique.. I'll hope you have some patience left for me..
  3. I adjusted this, but is this the correct id? ".$pageid." ? $comments = array(); $result = mysql_query("SELECT * FROM comments WHERE page_id = ".$pageid." ORDER BY id ASC"); while($row = mysql_fetch_assoc($result)) { $comments[] = new Comment($row); } ?> And in my submit.php i adjust, like you told: mysql_query(" INSERT INTO comments(name,url,email,body,page_id) VALUES ( '".$arr['name']."', '".$arr['url']."', '".$arr['email']."', '".$arr['body']."', '".$arr['pageid']."' )"); Error : Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /webadres/ Yes it is an ajax system. I dont think the problem is really big, i is just that i don't know the right syntax..
  4. <?php // Error reporting: error_reporting(E_ALL^E_NOTICE); include "connect.php"; include "comment.class.php"; /* / This array is going to be populated with either / the data that was sent to the script, or the / error messages. /*/ $arr = array(); $validates = Comment::validate($arr); if($validates) { /* Everything is OK, insert to database: */ mysql_query(" INSERT INTO comments(name,url,email,body) VALUES ( '".$arr['name']."', '".$arr['url']."', '".$arr['email']."', '".$arr['body']."' )"); $arr['dt'] = date('r',time()); $arr['id'] = mysql_insert_id(); /* / The data in $arr is escaped for the mysql query, / but we need the unescaped variables, so we apply, / stripslashes to all the elements in the array: /*/ $arr = array_map('stripslashes',$arr); $insertedComment = new Comment($arr); /* Outputting the markup of the just-inserted comment: */ echo json_encode(array('status'=>1,'html'=>$insertedComment->markup())); } else { /* Outputtng the error messages */ echo '{"status":0,"errors":'.json_encode($arr).'}'; } ?> This is the submit.php which is a part of the comment system. My trouble is that i have experience of php /html, but database and phpadmin is really a struggle for me.. If i can manage to create a system where i can put unique comment system to every page i like, and how to setup that in phpadmin, i would be really glad, but for now, i really dont know how to realize that. So if i knew the correct setup... I really appreciate your help!
  5. Ehm, maybe i need to be more specific, What i want is to make a comment system. I put this on one of my webpages where i want to add a commentsystem: <?php // Error reporting: error_reporting(E_ALL^E_NOTICE); include "connect.php"; //my connection details are in here include "comment.class.php"; /* / Select all the comments and populate the $comments array with objects */ $comments = array(); $result = mysql_query("SELECT * FROM comments ORDER BY id ASC"); while($row = mysql_fetch_assoc($result)) { $comments[] = new Comment($row); } ?> And this, on the same page: <div class="commentBox"> <?php /* / Output the comments one by one: */ foreach($comments as $c){ echo $c->markup(); } ?> <div id="addCommentContainer"> <p>Add a Comment</p> <form id="addCommentForm" method="post" action=""> <div> <label for="name">Your Name</label> <input type="text" name="name" id="name" /> <label for="email">Your Email</label> <input type="text" name="email" id="email" /> <label for="url">Website (not required)</label> <input type="text" name="url" id="url" /> <label for="body">Comment Body</label> <textarea name="body" id="body" cols="20" rows="5"></textarea> <input type="submit" id="submit" value="Submit" /> </div> </form> </div> </div> What i did is, i execute a *.sql file. -- -- Table structure for table `comments` -- CREATE TABLE `comments` ( `id` int(10) unsigned NOT NULL auto_increment, `name` varchar(128) collate utf8_unicode_ci NOT NULL default '', `url` varchar(255) collate utf8_unicode_ci NOT NULL default '', `email` varchar(255) collate utf8_unicode_ci NOT NULL default '', `page_id` varchar(50) collate utf8_unicode_ci NOT NULL default '', `body` text collate utf8_unicode_ci NOT NULL, `dt` timestamp NOT NULL default CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; So my database is made. This all is working! BUT, if i want to make another comment system for another topic, i get in trouble because if i copy this all over in another webpage, i will load the same comments. So i need to make it unique.. The trouble is that i don't know how to do this...
  6. Hi all, In a tutorial of making a comment system using php/ database, is written: $comments = array(); $result = mysql_query("SELECT * FROM comments WHERE page_id = ".$theIDofThePage." ORDER BY id ASC"); I created a database, now after days of searching and a lot of trouble i still not able to get it working.. So i will be glad to get some help. Ok, i created a database.., it is working. I put this in my webpage: <?php // Error reporting: error_reporting(E_ALL^E_NOTICE); include "connect.php"; // conection details in here include "comment.class.php"; /* / Select all the comments and populate the $comments array with objects */ $comments = array(); $result = mysql_query("SELECT * FROM comments WHERE page_id = ".$theIDofThePage." ORDER BY id ASC"); while($row = mysql_fetch_assoc($result)) { $comments[] = new Comment($row); } ?> I created the database like this: -- -- Table structure for table `comments` -- CREATE TABLE `comments` ( `id` int(10) unsigned NOT NULL auto_increment, `name` varchar(128) collate utf8_unicode_ci NOT NULL default '', `url` varchar(255) collate utf8_unicode_ci NOT NULL default '', `email` varchar(255) collate utf8_unicode_ci NOT NULL default '', `page_id` varchar(50) collate utf8_unicode_ci NOT NULL default '', `body` text collate utf8_unicode_ci NOT NULL, `dt` timestamp NOT NULL default CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; Now, my page_id is in the database, but where must i put the ".theIDofThePage."? Hope someone understand want i'm doing here..
  7. Yes. Example.com\mypage.php. In mypage.php stands this code: <div class="psdBox"><a href="downloads/001_PSD.php"><img src="webBuild/psdIcon.png" alt="psd icon" /></a> <div class="phpBox"> <?php $hit_count = @file_get_contents('http://example.com/downloads/001_PSD.txt'); echo $hit_count; ?></div></div> So yes, the .txt .zip and .php stands in the folder.
  8. Hi all, i have trouble with a piece of code. HTML: <div class="psdBox"><a href="downloads/001_PSD.php"><img src="webBuild/psdIcon.png" alt="psd icon" /></a> <div class="phpBox"> <?php $hit_count = @file_get_contents('http://example.com/downloads/001_PSD.txt'); echo $hit_count; ?></div></div> PHP: <?php $url = 'http://example.com/downloads/001_PSD.txt'; $hit_count = @file_get_contents($url); $hit_count++; @file_put_contents($url); header ('Location: http://example.com/downloads/001_PSD.zip'); ?> What i'm trying to do is to count the downloads on my site using PHP without sql. This code working from the root. [www.example.com/here] But if i want this code work from a folder [www.example.com/downloads/here] then i does not work. The 001_PSD.txt won't count up from a folder. In the root, where it works, the chmod of the 001_PSD.txt is standard 0644. This works! I always thought that i must be 0777, but from the root 0644 is ok. When i tested it from /downloads folder, i tried to set 001_PSD.txt to chmod 0777, but that also fails.. Can someone help me to make this work.. i cannot find the problem, i want to make multiple downloads and don't want to put every download in the root folder.. thank, javil
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.