Jump to content

runnerpaul

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Everything posted by runnerpaul

  1. Does anybody know anything about Meta Search Engines? A friend of mine is trying to design a site that will search three search engines, pull the top 100 from each then rank them. The way he hopes to rank them is if the result appears on all 3 search engines it gets a higher rank than if it appears in only one. He was asking for my advice but I have to say its really not my area of expertise. Can any of you offer some tips/advice? H hopes to do this in PHP. Cheers Paul
  2. Think I'm getting somewhere with: for ($i = 0; $i < mysqli_num_rows($result); ++$i) { $line = mysqli_fetch_row($result); echo "<a href='ShowPetsMembers.php?petType=".$line[0]."' name='category'>".$line[0]."</a>\n"; }
  3. Essentially yes. My current script pulls information on pet types from the databases and assigns a radio button to each. If a particularly radio button is selected and the 'Select Pet Type' button clicked, all instances of that pet type are displayed on the next page. I wish to change these radio buttons for hyperlinks. Therefore I would like a hyperlink for each pet type. If one is clicked the next page will show all pets of that type.
  4. Ah yes. I could create a drop down menu. I was just wondering if it was possible basically get the same results using hyperlinks. Can this be done not using forms? The only reason I ask is that I think it would look better in the site I am creating.
  5. Im aware of the differences between input and a link. Basically I came across several things that looked like they might work but had very little explanation around them and when I tried them they didnt work. eg: <a href='ChoosePetName.php?petType'>$petType</a> That mightnt be exactly what I came across but its along the lines of what I saw. However when it didnt work I searched a little further and came across what I had in the last post. I know its not a link but as I couldnt get a link further and when I came across this while searching for ways to create links in php I thought it may be worth looking into.
  6. Lol yeh. Came up with the following based on stuff I came across on a Google search. Creates a text box though. I'm guessing its something fairly straight forward but just havnt worked it out yet. I have actually messed about so much that I have got a bit frustrated so am going to take a few hours break. I thought I might put up a post in case somebody has experience of this and could offer a few pointers. echo "<li><form action='ChoosePetName.php' method='POST'> <input type='hyperlink' value='hyperlink' name=$petType value=$petType\n"; echo "/> </form>\n";
  7. Hi, I have the below code which pulls pet types from the database, and when you pick the particular type by selecting a radio button amd press 'Select Pet Type' you are brought to a page listing all examples of that pet. Is there any way of changing this so the pet types are listed as hyperlinks instead and when you click each particular hyperlink you are brought to a page where that pet type is listed? <?php /* Program: PetCatalog.php * Desc: Displays a list of pet categories from the PetType table. Includes descriptions. * Displays radio buttons for user to check. */ ?> <html> <head><title>Pet Types</title></head> <body> <?php include("misc.inc"); #12 $cxn = mysqli_connect($host,$user,$password,$dbname) #14 or die ("couldn't connect to server"); /* Select all categories from PetType table */ $query = "SELECT * FROM pettype ORDER BY petType"; #18 $result = mysqli_query($cxn,$query) or die ("Couldn't execute query."); #20 /* Display text before form */ echo "<div style='margin-left: .1in'>\n <h1 style='text-align: center'>Pet Catalog</h1>\n <h2 style='text-align: center'>The following animal friends are waiting for you.</h2>\n <p style='text-align: center'>Find just what you want and hurry in to the store to pick up your new friend.</p> <h3>Which pet are you interested in?</h3>\n"; /* Create form containing selection list */ echo "<form action='ShowPets.php' method='POST'>\n"; #33 echo "<table cellpadding='5' border='1'>"; $counter=1; #35 while($row = mysqli_fetch_assoc($result)) #36 { extract($row); #38 echo "<tr><td valign='top' width='15%' style='font-weight: bold; font-size: 1.2em'\n"; echo "<input type='radio' name='interest' value='$petType'\n"; #43 if( $counter == 1 ) #44 { echo "checked"; } echo ">$petType</td>"; #48 echo "<td>$typeDescription</td></tr>"; #49 $counter++; #50 } echo "</table>"; echo "<p><input type='submit' value='Select Pet Type'> </form></p>\n"; #54 ?> </div> </body></html>
  8. Ah thats great. Cheers. If I then wanted to add a link that pulls a picture where date is equivalent to the current date selected - 1 day. i.e. the picture from the previous day. Apolgies if this is simple or obvious. I havnt looked at php in 6 years and havnt a clue about it.
  9. Hi, I have the following table: ID picName description date 1 Us Time.jpg A couple watching the sunset at Ballintoy Harbour 2011-02-04 2 Pic.jpg This is the house on Castle Island taken in fog. 2011-02-03 3 catblack.jpg Pic of a cat 2011-02-05 I am trying to display th picName that belongs to the highest date but only know how to display all pictures. Can anybody help me? Here is what I have: <?php include("db.inc"); $cxn = mysqli_connect($host,$user,$password,$dbname) or die ("couldn't connect to server"); /* Select */ $query = "SELECT * FROM pictures"; $result = mysqli_query($cxn,$query) or die ("Couldn't execute query."); while($row = mysqli_fetch_assoc($result)) { echo "<tr><td colspan=2> </td> <td><img src='./images/{$row['picName']}' border='0' width='500' height='400' /><p></td></tr>\n"; } ?>
  10. Could somebody please explain what the below code means? if(!mb_ereg("^[0-9)(xX -]{7,20}$",$value)) I just understand it. It comes from the following: if(mb_eregi("phone",$field) or mb_eregi("fax",$field)) { if(!mb_ereg("^[0-9)(xX -]{7,20}$",$value)) { $errors[] = "$value is not a valid phone number. "; } } Cheers Paul
  11. Ah. <?php echo "<img src=\"/fermpix/Pics/{$row["Name"]}\" />";?> worked. Cheers for all the help guys. I was really starting to crack up.
  12. Lol. Apologies. Didnt mean it like that. I appreciate any help as I havnt looked at PHP in years. I got rid of my error from the second piece of code you give me. It was due to a mistake I made. Still not getting any image displayed though.
  13. Sorry, that was incorrect. With your first piece of code I get the same as in my screenshot. With your second I get: Parse error: parse error, expecting `','' or `';'' in C:\wamp\www\fermpix\index.php on line 53
  14. Hey, thanks for the quick response. What did you change there? I still get the same result with both pieces pf code(no image).
  15. Hi, Im trying to get an image to display from a reference in the database but am having no joy. At the minute Im just playing about with PHP to get familiar with it so you can ignore most of the code. The line im interested in is: <td><?php echo "<img src=\"C:\wamp\www\fermpix\Pics\'{$row["Name"]}'\">";?></td> When I view the page in my browser I see the attached. Can anybody see what im doing wrong? Heres the full page: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Browse Upload Files</title> </head> <body bgcolor="white"> <?php error_reporting(E_ALL); include 'db.inc'; $query = "SELECT ID, Name, Path, Date, Description FROM Pics"; if (!($connection = @ mysql_pconnect($hostName, $username, $password))) showerror(); if (!mysql_select_db("fermpics", $connection)) showerror(); if (!($result = @ mysql_query ($query, $connection))) showerror(); ?> <h1>Image database</h1> <h3>Click <a href="insert.php">here</a> to upload an image.</h3> <?php //require 'disclaimer'; if ($row = @ mysql_fetch_array($result)) { ?> <table> <col span="1" align="right"> <tr> <th>File Name</th> <th>Date</th> <th>Image</th> </tr> <?php do { ?> <tr> <td><?php echo "{$row["Name"]}";?></td> <td><?php echo "{$row["Date"]}";?></td> <td><?php echo "<img src=\"C:\wamp\www\fermpix\Pics\'{$row["Name"]}'\">";?></td> </tr> <?php } while ($row = @ mysql_fetch_array($result)); ?> </table> <?php } // if mysql_fetch_array() else echo "<h3>There are no images to display</h3>\n"; ?> </body> </html> I would appreciate any help. Cheers Paul [attachment deleted by admin]
  16. Hi, I am creating a website but am having trouble with the following: I have an include file(db.inc) which contains the following: function clean($input, $maxlength) { $input = substr($input, 0, $maxlength); $input = EscapeShellCmd($input); return ($input); } The file I am having the problem with is my view.php file. I get the following error: Notice: Undefined variable: file in C:\wamp\www\fermpix\view.php on line 4 Line 4 contains the following: $file = clean($file, 4); My view.php does have the line: include 'db.inc'; Does anybody have any idea what the issue might be? Cheers Paul
  17. Hey, I just installed phptriad. It appears to be working in that when I type http://localhost into my browser the index.html file which is in the htdocs folder appears. However when I type http://localhost/index.php I am given the following error: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, you@your.address and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Apache/1.3.23 Server at localhost Port 80. Does anybody know what may be causing this and how I can sort it out. Could it be a case that php wasnt installed. Im told that phptriad should install and configure php, mysql and apache.
×
×
  • 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.