Jump to content

hitokirikensan

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Everything posted by hitokirikensan

  1. I needed to create dynamic hyperlinks with <?php $value=mysql_query("SELECT screenname FROM users"); while($list=mysql_fetch_assoc($value)) { $owner=$list[screenname]; echo "<a href='/php/profile.php?action=makepage&owner=$owner'>$owner<br></a>"; } ?> Then i created a profile.php with function makepage() and got the value from the URL function makepage() { $owner=$_GET['owner']; include '../pp.html'; } this way, the owner of the page is known (reflected in the URL) and i just created a basic profile page <body> This is <?php if($_SESSION[screenname]=owner){echo "your";} else{echo $owner;} ?> page </body> thanks
  2. if i have a profilepage.html which the php includes, how would i make the url dynamic? because it would just show test/profilepage.html no matter who i am looking at, right?
  3. yes, every user should have their own profile page that other's can view
  4. But with that code, i won't be able to view other member's profile pages. So if i'm jack_nicholas, i won't be able to see santa_claus's profile page
  5. Hi, i coded a very simple forum "website" with registration, login, and a place where everyone posts comments. I wanted to make some sort of profile page for each user so they would each have their own URL too (e.i. test/barney or test/simpsons). each of these pages would have different content, depending on what barney or simpsons puts on that page. i've been looking everywhere trying to find documentation but i don't think i know how to search it correctly. I checked a lot of mod_rewrite documentation but i don't understand if i'm suppose to call a php function to create a profile page or something. Any guidance would be greatly appreciated Thanks!
  6. @thorpe i was able to connect before i added the $_GET. (also have a include "php/connect.php"; at the top of index) i don't really get the logic of how the new line i just added works. i did include "php/comment.class.php"; at the top of index so then when the addcomment function is called, it automatically checks the isset? so the isset can be placed anywhere in my comment.class.php? @kira do you mean jquery+ajax? i haven't learned ajax yet =p
  7. So i wrote if(isset($_GET['action']) && $_GET['action']=='addcomment' && isset($_POST['body'])) { addcomment($body); } but i'm not sure where to put it. in the php file? i tried putting it before and after the function addcomment()... and i'm getting alot of weird errors like Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user that i didn't see before
  8. Hi all, I have a regular comment section and i want the submit button to call a mysql_query function in comment.class.php so <form method="post" action="../php/comment.class.php?action=addcomment" name="commentform" id="commentform" onsubmit="validateForm()"> <label for "body">Your Comment</label> <div><textarea cols="20" rows="4" name="body" id="body"></textarea></div> <input type="submit" id="submit" value="Submit"/> and my comment.class.php is... function addcomment($body){ $body=mysql_real_escape_string($_POST['body']); if($body!=''){ mysql_query("INSERT INTO comment(uid,screenname,body) VALUES ('$_SESSION[uid]','$_SESSION[screenname]','$body')") or die('lame'); } header("location:../index.php"); } but when I click submit, i'm taken to a blank page with the URL: http://test/php/comment.class.php?action=addcomment any tips? and is there a better alternative to header? Thanks
  9. I'm a complete newb at programming so please bear with me i'm trying to check to make sure my sql query $result=mysql_query("SELECT screenname FROM users WHERE privacy='0'"); shows the correct results so i did a print_r($result); die(); but when i reload the page, it shows a syntax error after the die(); isn't the script suppose to completely stop so syntax errors after die() shouldn't matter? also i'm expecting the $result to be an array of names and i wanted to do a query to another table to grab comments from each of those screennames, is the only way to do a for loop of mysql queries? Thanks
×
×
  • 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.