Jump to content

charliepoo

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Everything posted by charliepoo

  1. Thankyou, that's exactly what I needed! It works perfectly (:
  2. blog_catjoin - contains entry_id and cat_id blog - entry_id, added, title, body, is_public, comments_on Entry_id and title being the ones I'm wanting to manipulate.
  3. Yes I did just turn array into a verb I'm going to sound really noobish right now, but anyway I'm working with FanUpdate and I'm trying to display a list of the posts in a category by a link, so that on the navigation bar I don't have to keep adding every time a post gets added. This is what I have so far: <?php mysql_select_db("charioti_hive", $con); $result = mysql_query("SELECT * FROM blog_catjoin WHERE cat_id='8'"); while($row = mysql_fetch_array($result)) { echo "<a href=/activities.php?id=" . $row['entry_id'] . " class=n>"; } mysql_close($con); ?> So that loads obviously, all the entry_ids which are in category 8 and displays the link. This all works - what I'm wanting to do is query another table using these entry IDs so that I can get the entry names, so that instead of displaying "link" each time it displays the entry's actual name. Guessing it's fairly simple, but I've looked it up in my php book and I've googled it and can't find a tutorial that is simple enough for a dummy like me. Any help or even hints to where to go from here would be appreciated.
  4. Okay, my site is here: http://disfunctional-day.net Currently, I offer stock photography and I have about 2000 photographs all told, probably more, as shown here: animals photography page At the moment I've simply been coding this all myself manually by using html similar to this: <a href="photos/landscapes/IMAGENAME.JPG"><img src="photos/landscapes/thumb/IMAGENAME.JPG"></a> I know using a prewritten image gallery would probably be easier but I'm used to this kind of layout and tried coppermine once and didn't like it. I use a generator for this at the moment, but it's still a highly repetitive task which I'm guessing would be easier done by loading the names from the folder and then loading the matching names from the thumbnail folder, and then entering them into the HTML using some kind of loop. I however dunno the php directions for loading the names from the folder - I know a fair bit of C++ so could probably guess the loop part. Any help would be much obliged.
  5. Cheers, that helped alot (: Sorry, I'm really new to this. I've managed to do what you said, to put in the hidden input and to write the query needed, but now I'm stuck on how to process it so that I can check that the answer is the same as the one in the database. I am also not sure if my calling of the variable $qid is correct. <?php $answer = $_POST['answer'] $qid = $_POST['qid']; //select database for use mysql_select_db ('carlott_ravie') or die ('Unable to select database!'); //create and execute query $offset_result = mysql_query( " SELECT `questions`.`Qid`, `questions`.`Answer` FROM questions WHERE (`questions`.`Qid` $qid) " ) // is the last part correct? //check if records were returned if (mysql_num_rows($result) > 0) { this is the part I am having trouble with } //once processing is complete // free result set mysql_free_result($result); // close connection to MySQL server mysql_close($connection) ?>
  6. I tried the latter, but it showed up all of the input, while I only want to show up one on each refresh. questions (Qid, Question, Answer)
  7. Okay, so I'm trying to do a random question and answer php coding using a database to store each question, answer and ID. So far I've managed to get the random question, using this code: <?php //select database for use mysql_select_db ('carlott_ravie') or die ('Unable to select database!'); //create and exectue query $offset_result = mysql_query( " SELECT FLOOR(RAND() * COUNT(*)) AS `offset` FROM `questions` "); $offset_row = mysql_fetch_object( $offset_result ); $offset = $offset_row->offset; $result = mysql_query( " SELECT * FROM `questions` LIMIT $offset, 1 " ); //check if records were returned if (mysql_num_rows($result) > 0) { //print HTML //iterate over record set // print each field while($row = mysql_fetch_row($result)) { echo '' . $row[1] . ''; echo '</div></center>'; } } else { //print error message echo 'No events in planning.'; } //once processing is complete // free result set mysql_free_result($result); // close connection to MySQL server mysql_close($connection) ?> What I'm wanting to do further than that, is have the user enter the answer and check it against the stored answer in the database. If it's right the user gets a button or redirected to another page, if it's wrong, the user gets redirected to a different page telling them it's wrong. row[2] is where the answers are in the database, so I'm figuring since it's random, I'd have to load the question into a variable in the same php session, but my attempts have been unsuccessful. I have no idea how to check the user's answer is the same as the answer stored. Any help would be greatly appreciated.
  8. Actually it doesn't matter. Managed to find a way to do it myself.
  9. Basically, what I have is an email form. What I want to do is add a line which says how long ago the user submitted the form. I'm wondering whether I need to use javascript or PHP and if it is possible. Any help, please?
×
×
  • 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.