Jump to content

Bentley4

Members
  • Posts

    58
  • Joined

  • Last visited

    Never

Everything posted by Bentley4

  1. So basically you're saying that search engines(or rather webcrawlers associated to them) will always be able to find and list my main/homepage in search engines but not subdivisions if I don't link to them? Thnx
  2. If that is the case I don't understand the following: I have a www.myname.info page. I have never linked to it anywhere and I'm pretty sure noone ever has because its relatively new and is blank. Yet when I type 'myname' it comes up as the 6th search result on google. I also have a flickr account with my name recently created, it contains no photos, haven't linked to it and I don't understand why anyone would link to it if it's still blank(so I assume noone did.) I can also find this account by typing in my name.
  3. Actually I'm not even going to use it for friends, just for people I don't know yet that I want to show my profile in a non-work related context. (different structure of website, work: more emphasis on skills, non-work: more emphasis on intrests and hobbies.) I also have a public one that everyone can look up, which gives less detail.
  4. I want to implement different versions of my site, one for potential employers, one for friends,... I would give them a link if I wanted them to check it out. When you said 'lawful good ones'; In other words it is possible for google, yahoo and bing?
  5. Hi guys, Is it possible for a website to only be accessed by a link or typing the url? (in other words I don't want search engines to pick it up) How should I do this? B
  6. Ok, I'm sorry. Thnx for the tip. I've implemented the session construct but it still doesn't work appropriatly. Does anyone know what is wrong with the following code? : <?php session_start(); $_SESSION['time'] = time(); $starttime = $_SESSION['time']; ?> <html> <body> <?php if(!isSet($_GET['sid'])){ echo '<form name="input" action="./StudentAnswers.php" method="GET">'; echo '<input type="text" name="sid"/>'; echo '<input type="submit" value="Submit">'; } else{ echo "End of exercices"; $endtime = time(); $totaltime = endtime - starttime; echo "Total time: ".$totaltime; } ?> </body> </html>
  7. Well, that just doesn't work. The complete code for several screens is in 1 page.(because I used get) If you do starttime - endtime it just returns 0 because for each screen the code completely runs. It doesn't work either if you place the starttime under an a certain event using 'if'.
  8. Hi WebStyles, I want to do it without using awstats or google analytics. Just with php code and without using MySql. I know I can store the startdate. I just don't know how to subtract the time form the first screen from the time the user comes on the last screen. I was also thinking along the lines of using fget or fread, but I don't know how to recall information from a specific line or next to a certain word.
  9. Hi guys! I would like to know the total time someone spent on my website by saving it into a textfile. Is this possible? I've used this code so far. When the form is filled in, I want to know the time spent on filling in the form and submitting it(real code is longer). This code is not good because it just displays the time when a user visits the last screen(I understand why). But If I declare it above the if statement, it returns a totaltime of 0:0:0.(I also understand why, I just don't know any solution to the problem.) Is there any solution without using MySql? <?php $name = $_GET['sid']; if(!isSet($_GET['sid'])){ $Hin = date("H"); $Min = date("i"); $Sin = date("s"); $timein = $Hin.":".$Min.":".$Sin ; $date = date("D d M Y"); $fp = fopen("formdata.txt", "a"); $savestring = $name . ", ".$date. ", " . $timein . "\n"; fwrite($fp, $savestring); fclose($fp); echo '<form name="input" action="./StudentAnswers.php" method="GET">'; echo '<input type="text" name="sid"/>'; echo '<input type="submit" value="Submit">'; } else{ echo "End of exercices"; $Hout = date("H"); $Htot = $Hout - $Hin; $Mout = date("i"); $Mtot = $Mout - $Min; $Sout = date("s"); $Stot = $Sout - $Sin; $TotalTime = $Htot.":".$Mtot.":".$Stot ; $fp = fopen("formdata.txt", "a"); $savestring = $name . ", total time: " . $TotalTime. "\n"; fwrite($fp, $savestring); fclose($fp); } ?>
  10. It was for the folowwing structure: I. Mainquestion 1.Question1 Answer1 2.Question2 Answer2 .... I needed seperate layout control for the Mainq, question and answers. The problem is that they are echoed by conditional statements.
  11. Thanks, works! What do you reccomend me to do in this situation?
  12. Hi guys, When I use this statement it gives the syntax error, unexpected T_STRING, expecting ',' or ';' : echo "<p class="SuperqAndQAndA">" ; Any idea why? Also, can I nest different p classes? Eg: echo "<p class="QandA"><p class="Answers">".$row['TAnswer']."</p></p>";
  13. I know it is. But before I used double quotes and I had to escape it, like in this example: echo "<a href=\"/index.php?sid=".$name."&question=".$nextquest."\">next</a>"; It is not an answer unless you meant to say, concatenation quotes never need to be escaped.
  14. What I don't understand though is why I don't need to escape the double quotes in: $result = mysql_query("SELECT * FROM " . $Trow['NameOfTable'] . " WHERE id = $counter"); and $totalresult = mysql_query("SELECT * FROM ".$Trow['NameOfTable'].""); This works, but I don't understand why.
  15. Thanks, this one does work!!!! Ok, I'm sorry. It works now though. Indeed, I changed it and the functionality doesn't change.
  16. Dear PFMaBiSmAd, 1. Thanks for your response. 2. It still doesn't work with curly brackets either. Any clue why? 3. I'm trying to loop through different tables, completely automise it. I don't see any other way. btw, the full code is longer though, I just chopped a bit out of it for brevity. Which other code do you suggest to have the same functionality? Here is the full code as a reference: <?PHP echo "<h2>Exercises</h2>"; $name = $_GET['sid']; $timein = time(); $quest=1; $nextquest=2; $con = mysql_connect("localhost","XXX", "YYY"); if (!$con) {die('Could not connect: ' . mysql_error("oop"));} mysql_select_db("XXX_testDB") or die(mysql_error()); if(!isSet($_GET['qandanumber']) && isSet($_GET['sid'])){ $_GET['qandanumber'] = 1; $qanda = $_GET['qandanumber']; $nextqanda = $qanda+1;} if(isSet($_GET['qandanumber'])){ $qanda = $_GET['qandanumber']; $nextqanda = $qanda+1;} $totalresult = mysql_query("SELECT * FROM QANDATable"); $num_rows = mysql_num_rows($totalresult); $counter = 1; $i = 1; $Tcounter = 1; while($counter <= $qanda){ $Tresult = mysql_query("SELECT * FROM NameTable WHERE id = $Tcounter"); $Trow = mysql_fetch_array($Tresult); $num_Trows = mysql_num_rows($Tresult); if($counter < 2){ $result = mysql_query("SELECT * FROM QANDATable WHERE id = $counter"); $row = mysql_fetch_array($result); echo $row['TSuperQuestion']; echo $row['TQuestion'];} else{ if($counter%2){ $result = mysql_query("SELECT * FROM QANDATable WHERE id = $counter - $i"); $row = mysql_fetch_array($result); echo $row['TQuestion']; $i++;} else { $result = mysql_query("SELECT * FROM QANDATable WHERE id = $counter - $i"); $row = mysql_fetch_array($result); echo $row['TAnswer'];}} if($counter/2 == $num_rows){ $Tcounter ++; } $counter++;} echo "<a href=\"/Code-sandbox.php?sid=".$name."&qandanumber=".$nextqanda."\">next</a> <br/>"; } ?> So what I essentially want to do is when the last element of a table is echooed, start echo each element again from a next table. For those just tuning in, I want to replace 'QANDATable' by '$Trow['NameOfTable'];' . This should be a looped so I don't see any other way than replacing the name of each table by a variable in the SELECT language construct. What do you think?
  17. Hi guys, the following code gives the parsing error "unexpected T_VARIABLE": <?php $con = mysql_connect("localhost","XXX", "YYY"); if (!$con) {die('Could not connect: ' . mysql_error("oop"));} mysql_select_db("XXX_testDB") or die(mysql_error()); $counter = 1; $Tcounter = 1; $Tresult = mysql_query("SELECT * FROM NameTable WHERE id = $Tcounter"); $Trow = mysql_fetch_array($Tresult); $result = mysql_query("SELECT * FROM "$Trow['NameOfTable']" WHERE id = $counter"); $row = mysql_fetch_array($result); echo $row['TQuestion']; ?> So I have a Table in Mysql that is called 'NameTable'. From that table I am drawing an element in the 1st row under the column of NameOfTable. I want to call another element of another table through the table I described using a variable. Like this: $result = mysql_query("SELECT * FROM "$Trow['NameOfTable']" WHERE id = $counter"); "$Trow['NameOfTable']": I also tried using single quotes or without and it doesn't work either. What is wrong with this?
  18. Hi guys, When I insert the following code I get the parsing error "unexpected $end": <?PHP if(isSet($_GET['sid'])) { $con = mysql_connect("localhost","YYYYY", "XXXXX"); if (!$con) {die('Could not connect: ' . mysql_error("oop")); mysql_select_db("YYYYY_testDB") or die(mysql_error()); $totalresult = mysql_query("SELECT * FROM QANDATable"); $num_rows = mysql_num_rows($totalresult); $limit; $counter = 1; while($counter < mysql_num_rows($totalresult)){ $result = mysql_query("SELECT * FROM QANDATable WHERE id = $counter"); $row = mysql_fetch_array($result); echo $row['TSuperQuestion']; if(isSet($_GET['sid'])){ echo "<a href=\"/Code-sandbox.php?sid=".$name."&qandanumber=".$counter."\">next</a>";} echo $row['TQuestion']; echo $row['TAnswer']; $counter++;} } else { echo "<h2>Enter Student Number:</h2>"; echo '<form name="input" action="./Code-sandbox.php" method="GET">'; echo '<input type="text" name="sid"/>'; echo '<input type="submit" value="Submit">'; echo '</form>'; } ?> The code worked before I inserted: if(isSet($_GET['sid'])){ echo "<a href=\"/Code-sandbox.php?sid=".$name."&qandanumber=".$counter."\">next</a>";} Any idea what is wrong here?
  19. Hey! echo "<ol type=\"a"\>"; This gives an error, how am I supposed to escape the " " correctly?
  20. The point of this table is just to recall info. Not to store answers. I will do that in a different table. So the elements will always remain fixed. The id number
  21. Just each row has an id. I did this: $result2 = mysql_query("SELECT * FROM QANDATable WHERE id = 2"); $row2 = mysql_fetch_array($result2); echo $row2['TQuestion']; This works. But is there really no faster way then having to declare 2 new variables each time I want another element from a different row and column?
×
×
  • 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.