Jump to content

lancey10

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

Everything posted by lancey10

  1. ok so i have a script that displays all files in a folder! here it is: [code]<?            $dirpath = "./torrents";     $dh = opendir($dirpath);         while (false !== ($file = readdir($dh))) {                        if (!is_dir("$dirpath/$file")) {        $fileend = substr($file, -8);              $fileend = strtolower($fileend); if ( $fileend == ".torrent" ) {                  // If you want you could merge this into one echo                  // The info button takes you to parse.php, which is the important part                                 echo "<A HREF=\"parse.php?filename=$file\">info:</A><A HREF=\"$dirpath/$file\">$file</A><BR>";                                            } }     }      closedir($dh); ?> [/code] Now i have 2 questions: 1. How do i make a search engine that will search the folder and display the closest matches? 2. Pagin that will only display 40 results per page!
  2. Ok so i have a project that im trying to do and it is creating a forum (NO i dont want to use already made ones cuz im trying to make my own lol) here is what i got.... [code]<?php $host="localhost"; // Host name $username=""; // Mysql username $password=""; // Mysql password $db_name="test"; // Database name $tbl_name="forum_question"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT * FROM $tbl_name ORDER BY id DESC"; // OREDER BY id DESC is order result by descending $result=mysql_query($sql); ?> <?php while($rows=mysql_fetch_array($result)){ // Start looping table row ?> <table width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td width="6%" align="center" bgcolor="#E6E6E6">&nbsp;</td> <td width="53%" align="center" bgcolor="#E6E6E6"><div align="left"><strong><? echo $rows['Title']; ?></strong></div></td> <td width="15%" align="center" bgcolor="#E6E6E6">&nbsp;</td> <td width="13%" align="center" bgcolor="#E6E6E6">&nbsp;</td> <td width="13%" align="center" bgcolor="#E6E6E6">&nbsp;</td> </tr> <tr> <td bgcolor="#FFFFFF"><? echo $rows['id']; ?></td> <td bgcolor="#FFFFFF"><a href="view_topic.php?id=<? echo $rows['id']; ?>"><? echo $rows['topic']; ?></a><BR></td> <td align="center" bgcolor="#FFFFFF"><? echo $rows['view']; ?></td> <td align="center" bgcolor="#FFFFFF"><? echo $rows['reply']; ?></td> <td align="center" bgcolor="#FFFFFF"><? echo $rows['datetime']; ?></td> </tr> <?php // Exit looping and close connection } mysql_close(); ?> <tr> <td colspan="5" align="right" bgcolor="#E6E6E6"><a href="create_topic.php"><strong>Create New Topic</strong> </a></td> </tr> </table>[/code] Now for the Topic Title, i onlu want it to show ONCE (instead of repeating when there is another row added) how do i do that? and for the topics, how do i make it so lets say if catgorytype=1 then ONLY display those rows?
  3. ook so i tried and still no luck, is there a tutorial or can anyone tell me how to do it step by step? or example script?
  4. thanks but how would it retrive the other half of the text from another page.... tutorial doesnt help with that
  5. [!--quoteo(post=348857:date=Feb 23 2006, 07:16 PM:name=hitman6003)--][div class=\'quotetop\']QUOTE(hitman6003 @ Feb 23 2006, 07:16 PM) [snapback]348857[/snapback][/div][div class=\'quotemain\'][!--quotec--] Well, you could use strlen to find the length of your text, then if it exceeds the length that you have determined to be one page, you could use substr to seperate out only that many characters to display, along with a "next page" link. Of course doing that means that it wouldn't do clean transitions. In other words, if you decided that 10000 characters was one page, and the 10000th character was in the middle of a word, it would cut that word in two. [/quote] is there a script or a tutorial that i can see?
  6. how do i make it so a certain amount of text displayed on a page will create a new page to finish reading the text?
  7. ok, i think i found an easier way to do it, but it says "No rows found!" here is my script: [code]<?php $page = $_GET[page]; // mysql variables $host = "BLOCKED"; $user = "dbo154983898"; $pass = "BLOCKED"; $db = "db154983898"; // open connection $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!"); // select database mysql_select_db($db) or die ("Unable to select database!"); // Grabs variable from url // Setup mysql connection $query = "SELECT * FROM 'reviews' WHERE 'id' = '$page' "; $result = mysql_fetch_array($query); // Then display the result as you wish // see if any rows were returned if (mysql_num_rows($result) > 0) { // yes // print them one after another echo "$mysql_result[id]"; } else { // no // print status message echo "No rows found!"; } // close connection mysql_close($connection); ?> [/code] what did i do wrong?
  8. ok lets say when i submit the form it makes and ID that equals 1 and the id will be inserted it to the url like: index.php?page=1, now when i click on that link, it wont do anything because it doesnt know where to connect to..... so how do i make the submit button that will grab a certain row information (like row 1 a.k.a ID 1) and display it on a template, and give it a name index.php?page=1
  9. second question is how can u submit to mysql and post to a php file at the same time?
  10. also how do i go by creating a entire different page with the content that u filled out on a form and you click submit?
  11. Ok, i would like to insert information from a Row, lets say row 1 ( SELECT * FROM `table` WHERE `id` = '1' ) and insert the data in a template, and it will have a url that will be something like index.php?page=1. How do i go by doing that? and how would i go by doing that with every row that is created?
  12. Ok so i made a a script with 2 files, db.php, and index.php...... here is my script: db.php: [code]<?php // Database variables $host = 'db304.perfora.net'; $user = 'dbo154983898'; $pass = 'Q439a.gw'; $dbname = 'db1549838989'; // Connect to Mysql Database $mysql = mysql_connect($host,$user,$pass); $db = mysql_select_db($dbname,$mysql); //grab rveiews vars function reviews($reviews) {          $get_reviews = mysql_fetch_array(mysql_query("select * from reviews"));     $reviews = $get_reviews[$reviews];     return $reviews; } ?>[/code] index.php: [code]<?php include("db.php"); access(); echo ('<h4>Submit a Review</h4>'); if($_POST['options']){          $title  = $_POST['title'];     $posted = $_POST['posted'];     $story = $_POST['story'];     $picturepath = $_POST['picturepath'];     $quality = $_POST['quality'];     $effect = $_POST['effect'];     $overall = $_POST['overall'];          $options = "UPDATE reviews SET title='$title',posted='$posted',story='$story',picturepath='$picturepath',quality='$quality',effect='$effect',overall='$overall'";     $update_options = mysql_query($options);              echo("Reviews Submited.<br /><br />");      }           $config = mysql_fetch_array(mysql_query("select * from reviews"));     $title  = $config['title'];     $posted = $config['posted'];     $story = $config['story'];     $picturepath = $config['picturepath'];     $quality = $config['quality'];     $effect = $config['effect'];     $overall = $config['overall'];;              ?> <form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post"> <table cellspacing="1" cellpadding="4" border="0" bgcolor="#f2f2f2"> <tr>   <td width="95">Title: </td><td width="352" style="border-right: 10px solid <? echo $bg1; ?>;"><input type="text" name="bg1" value="<? echo $title; ?>" size="20" /></td></tr> <tr>   <td>Posted By : </td><td style="border-right: 10px solid <? echo $bg2; ?>;"><input type="text" name="bg2" value="<? echo $posted; ?>" size="20" /></td></tr> <tr>   <td valign="top">Story: </td><td style="border-right: 10px solid <? echo $text; ?>;"><textarea name="text" cols="50" rows="8"><? echo $story; ?></textarea></td></tr> <tr>   <td>Picture Url: </td><td><input type="text" name="size" value="<? echo $picturepath; ?>" size="20" /></td></tr> <tr>   <td>&nbsp;</td>   <td><b>Ratings:</b></td> </tr> <tr>   <td>Picture Quality: </td>   <td><label>     <select name="select">       <option value="<? echo $quality; ?>">1</option>       <option value="<? echo $quality; ?>">2</option>       <option value="<? echo $quality; ?>">3</option>       <option value="<? echo $quality; ?>">4</option>       <option value="<? echo $quality; ?>">5</option>     </select>   </label></td> </tr> <tr>   <td>Effects:</td>   <td><select name="select2">     <option value="<? echo $effect; ?>">1</option>     <option value="<? echo $effect; ?>">2</option>     <option value="<? echo $effect; ?>">3</option>     <option value="<? echo $effect; ?>">4</option>     <option value="<? echo $effect; ?>">5</option>     </select></td> </tr> <tr>   <td>Overall:</td>   <td><select name="select3">     <option value="<? echo $overall; ?>">1</option>     <option value="<? echo $overall; ?>">2</option>     <option value="<? echo $overall; ?>">3</option>     <option value="<? echo $overall; ?>">4</option>     <option value="<? echo $overall; ?>">5</option>     </select></td> </tr> </table> <br /><br /> <input type="submit" name="options" value="Submit" /> </form>[/code] now everytime i clciiksubmit, it isnt updating the mysql database, how do i go by fixing that? is there a problem wuith my code?
×
×
  • 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.