PHP - Who Url Is Better For Searching Engines ?
Hello friends,
i'm coding simple free script for articles but i need to know which url should be better 1- at this way article_title_words (sperated by _ ) 2- at this way article-title-words (sperated by - ) 3- at this way article+title+words (sperated by + ) which is better for searching engines ? thanks everybody Similar TutorialsSearch engines don't see the php programming of a site, they only see the output, right? What we see when we "View Source" of a webpage? This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=347958.0 Hi there, I am designing a PHP MYSQL web site and I want all pages to appear in search engines. I have seen a web site listed in a search engine with a link like: www.website.co.uk/product.php/4478/ If the number is changed to 4477 then a different product is loaded. How does this work? I thought the link needed a question mark (?) in the link to pass the information and I thought this was bad news in terms of SearchEngineOptimisation? I am aware that if the link passed 4478 in the URL along with a question mark (?) in the URL it would load that product also but IT WOULD NOT APPEAR IN SEARCH ENGINES. Is this a common way around the search engine issue and how does it work??? Are there other, perhaps better ways to design my links and also the Search Engine prospects for the web site I am creating? Thanks, Matt. Hi, A web site designed about 5 years ago is doing well in search engines but I am designing a new web site using PHP, CSS and MySQL. The old site was HTML and CSS. Do you have any design tips for Search Engines Optimisation when using PHP and MySQL? --- I will start coding soon, so all tips will be used. Thanks, Matt. Search Engines punish us for having "links" pages because some people do this to promote sites to raise their search rankings. I don't do that for the same reason. I want to recommend certain sites to my guests but I don't want to get punished for doing so. I might have a solution. (So, in addition to asking about the php code that I would need, I'm also asking if the following trick will even work to avoid getting punished in my ranking.) Instead of the traditional. . . Code: [Select] <p><a href="http://www.phpfreaks.com">PHP Freaks</a></p> I thought I would try something like this. . . Code: [Select] <!-- SEARCH ENGINES --> <form name="myform" action="http://www.mywebsite.com/searchformhandler.php" method="POST"> <div align="center"> <select name="searchengineselection"> <option value="http://www.bing.com/">Bing</option> <option value="http://www.dogpile.com">Dog Pile</option> <option value="http://www.google.com">Google</option> <option value="http://www.startpage.com">Start Page</option> </select> <input type="submit" name="searchengineselection" value="Insert"> </div> </form> These are only example sites. I have a whole page of suggested websites to send my guests to. Now, if this is a good idea, I'll need to create a file called, "searchformhandler.php." I think I know enough to figure out how to echo the right substitute code, I just don't know how to execute it. I'm rusty. There's got to be a command to open a web page. I don't think I would do some like this. . . Code: [Select] <?PHP echo "<a href='" + searchengineselection + '"> // or whatever ?> Isn't there some kind of php command to send a link? Also, I need way to pass the form data value from the weblinks.php page to the searchformhandler.php file How do you have a log generate two different logs, and having where it posts the log at, depend on if it's a visitor, or a search engine spider HTTP_USER_AGENT (Like Googlebot, Msnbot, Yahoo! Slurp.) <?php define("DATE_FORMAT","m-d-Y - H:i:s"); define("LOG_FILE","/full_path/visitors.html"); define("LOG_FILE2","/full_path/search_engine_bots.html"); $logfileHeader='DATE - IP - HOSTNAME - BROWSER - URI - REFERRER'."\n"; $userAgent = (isset($_SERVER['HTTP_USER_AGENT']) && ($_SERVER['HTTP_USER_AGENT'] != "")) ? $_SERVER['HTTP_USER_AGENT'] : "Unknown"; $userIp = (isset($_SERVER['REMOTE_ADDR']) && ($_SERVER['REMOTE_ADDR'] != "")) ? $_SERVER['REMOTE_ADDR'] : "Unknown"; $refferer = (isset($_SERVER['HTTP_REFERER']) && ($_SERVER['HTTP_REFERER'] != "")) ? $_SERVER['HTTP_REFERER'] : "Unknown"; $uri = (isset($_SERVER['REQUEST_URI']) && ($_SERVER['REQUEST_URI'] != "")) ? $_SERVER['REQUEST_URI'] : "Unknown"; $hostName = gethostbyaddr($userIp); $actualTime = date(DATE_FORMAT); $logEntry = "$actualTime - $userIp - $hostName - $userAgent - $uri - $refferer<BR>\n"; if (!file_exists(LOG_FILE)) { $logFile = fopen(LOG_FILE,"w"); fwrite($logFile, $logfileHeader); } else { $logFile = fopen(LOG_FILE,"a"); } fwrite($logFile,$logEntry); fclose($logFile); ?> So I've full text indexed the columns I want searchable: I have some rows inserted: Yet when I run a match() against(), I get 0 results: If I do: Code: [Select] SELECT * FROM video WHERE MATCH (name) AGAINST ('test') I get 2 results. Why does that work, yet keywords don't? Hi, I want to create a search which uses the 'title' of my 'product' table and matches the terms the user has submitted. At the moment, my products are displaying one by one. For example, I have an apple and apricot in my table. The user searches 'a' and the search results show 'apple' but not apricot. Here's my code: Code: [Select] <?php require_once('inc/global.inc.php'); # search.inc.php /* * This is the search content module. * This page is included by index.php. * This page expects to receive $_GET['terms']. */ // Redirect if this page was accessed directly: if (!defined('BASE_URL')) { // Need the BASE_URL, defined in the config file: require_once ('../includes/config.inc.php'); // Redirect to the index page: $url = BASE_URL . 'index.php?p=search'; // Pass along search terms? if (isset($_GET['terms'])) { $url .= '&terms=' . urlencode($_GET['terms']); } header ("Location: $url"); exit; } // End of defined() IF. // Print a caption: echo '<h2>Search Results</h2>'; // Display the search results if the form // has been submitted. if (isset($_GET['terms']) && ($_GET['terms'] != 'Search...') ) { $terms = $_GET['terms']; $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) or die *('Error connecting to MySQL server'); // Query the database. $query = "SELECT * FROM product WHERE title LIKE '%$terms%'"; $result = mysqli_query($dbc, $query); // Fetch the results. $row = mysqli_fetch_array($result); // Print the results: $output[] = '<ul>'; $output[] = '<li>'.$row['title'] .': £'.$row['price'].'<br /><img src="'.$row['img'].'" alt="'.$row['title'].'" /></li>'; $output[] = '</ul>'; echo join('',$output); } else { // Tell them to use the search form. echo '<p class="error">Please use the search form at the top of the window to search this site.</p>'; } ?> A friend told me I need to use a for-each loop but I can't figure it out. Any help is appreciated, thanks for reading. Hi im really confused and annoyed Im making a real estate website and im stuck ont eh searching for a house part. Im trying to set up some searches on the different parts of the house usign text boxes for area and postcode and drop boxes for type and bedrooms and bathrooms i now you have to set up a form with input type text and then call it a name use get/post on a php side and then $_POST['search']; But i dnt seem to be able to make a search was hoping someone was kind enough to knock me up some quick code so it is functional and makbe i can work from it A;so any help towards searching using dropboxes would be awsume and if i have 2 boxes for price upper and lower how would this work Much appreciated Ok I have a set of PDF files that i need to be searchable. My question how do i go about doing this. Can this be achieved with php or do a need to do something else? I've been reading a few tutorials on how the best way to search key words in a database and at the moment im trying to get this query to work but its coming back with a error:
#1191 - Can't find FULLTEXT index matching the column listquery: SELECT title, description FROM items WHERE MATCH(title, description) AGAINST('xbox')any help or advise on how the best way to search 2 columns on matching words...thank you I'm having some trouble with a GET search code; everything works until the stringresult but then it dies to Error Querying Database Code: [Select] <html> <body> <?php //Get sort setting and search terms from URL with GET $usersearch = $_GET['usersearch']; echo 'Search word: ' . $usersearch; echo '<br>'; require_once("dbvars.php"); //Connect to Database $dbc = mysqli_connect (DB_HOST, DB_USER, DB_PW, DB_NAME) or die ("Error connecting to database."); //Build the Query $query = "SELECT * FROM customers" . 'WHERE customers.given_name=\'' . $usersearch . '\''; echo $query; //Execute the Query $result = mysqli_query($dbc, $query) or die ("Error querying database."); //Create the Table Headings echo '<table border="1"><tr>'; echo '<td><b>First Name</b></td>'; echo '<td><b>Last Name</b></td>'; echo '<td><b>Address</b></td>'; echo '<td><b>City</b></td>'; echo '<td><b>Province</b></td>'; echo '<td><b>Postal Code</b></td>'; echo '<td><b>Phone Number</b></td>'; echo '</tr>'; //Display Results through Array Loop While ($row = mysqli_fetch_array($result)) { echo '<tr><td>' . $row['given_name'] . '</td>'; echo '<td>' . $row['surname'] . '</td>'; echo '<td>' . $row['address'] . '</td>'; echo '<td>' . $row['city'] . '</td>'; echo '<td>' . $row['province'] . '</td>'; echo '<td>' . $row['postal_code'] . '</td>'; echo '<td>' . $row['phone_number'] . '</td></tr>'; } '</table>'; // Close the database connection mysqli_close($dbc); ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get"> <input name="usersearch" type="text" size="30" /> <input name="submit" type="submit" value="go" /> </form> </body> </html> Hi, I was wondering what would be a good way to search through html for specific tags using php so that I can insert some other html in to that? I have used some parsing of an html that was converted in to a string, but the way I did it might not be fully efficient lol So i was wondering how everyone else would go about this? I don't need a complete in depth description but at least a pointer to what i could do that way i can just search for it on my own. I need to do some searching through PDF or Doc files, whichever will be more efficient. All the files will be in one folder, and I've written a script that will let me search the file names just fine. Each file though, has a header, with the actual title of of the document, since sometimes the file names are abbreviated. How would I search through the document (only the header) and return the matching results? If you need a sample document, let me know. Thanks! I don't mean to bother you with silly questions, but I must be using the wrong search terms to find any viable answers to this. Hypothetical situation: I have a table [Customers] with with an auto-increment id, customer_name and email generated from a form. Now, I decide to expand my database to include customer-address and telephone number. I decide to create a second table named Contactinfo for this purpose (assuming this is a better database practice). As Customerinfo is generated, I want it to POST in association with the respective customer (assuming that 'id' is the best field for association). I need some examples and best practices to accomplish this. Examples, links, or preferred terminology would be great so I can attack this phase. Thanks. Hi, as a newbee i'm trying to figure this code out: $search = get_the_title(); $lines = file('links.txt'); // Store true when the text is found $found = false; foreach($lines as $line) { if(strpos($line, $search) !== false) { $found = true; echo $line,"<br/>"; } } // If the text was not found, show a message if(!$found) { echo 'not found'; links.txt file contains links like: <a href="https://blabla.com/blablabla/blablablabla/The word or file to search" target="_blank" rel="noopener noreferrer">The word or file to search</a> I just want to search the this part: ( ">The word or file to search</a> ) of the url then return it as an clickable url and also limit search results to 3. Could somebody help me which code and where to put in php code above? Thanks in advance. Hi everyone,
I've got a simple script that is searching for the results of running races in a database.
Searching for a finisher's position works perfectly with this script:
$position = $_POST['position']; $pos_operator = $_POST['pos_operator']; if ($pos_operator == '=' && $position != '' ) { $where .= " AND position='$position'"; } if ($pos_operator == '<' && $position != '' ) { $where .= " AND position<'$position'"; }$position refers to a text field in the form where the user can type in a digit. $pos_operator refers to a text field in the form where a user can select = or < However, when I try to do a similar thing with time, I'm not getting the expected results. $time_stated = strtotime($_POST['time_stated']); if ($time_stated != '' ) { $where .= " AND time < '$time_stated'"; }$time_stated refers to a text field where the user is asked to look for a time less than the time they input in xx:xx:xx format. I tried this with and without the strtotime Any tips? Cheers, Dave I was kind of looking for a little direction, I have scoured the internet and exhausted every other resource I could think of before coming here... Does anyone know of any classes or resources that have some solid explanation or can give an explanation on how to go about searching within a PDF file?? I have literally beren trying to figure it out for over a year...I need to wrap this up it is consuming my life. All help is greatly appreciated, thanks in advance I am trying to perform a search but it doesn't see to pass through i thing its because of this \ does any one know how i can pass this trought to search in mysql table 12\019PB (i cant search this item) Code: [Select] $searchlading = mysql_real_escape_string($_GET['searchlading']) ; // get the query for the search engine (if applicable) $trimmed = trim($searchlading); //trim whitespace from the stored variable //query for pedimento $sql_ped = "SELECT order_id, bill_of_lading, pedimento_num FROM `".TABLE_ORDERS."` WHERE bill_of_lading LIKE '%$trimmed%'"; Hi there, I'm working on PHP webform and I have a variable called $weightInfo which has the value 5000|6000 Now I have a list of Arrays and I would like to see if our variable value (i.e 5000|6000) is in that list of Array: Here is the ArrayList: $WeightArray = array('' => '', '0|100' => '100g or Less', '101|250' => '101g to 250g', '251|500' => '251g to 500g', '501|1000' => '501g to 1kg', '1000|2000' => '1kg to 2kg', '2000|3000' => '2kg to 3kg', '3000|4000' => '3kg to 4kg', '4000|5000' => '4kg to 5kg', '5000|6000' => '5kg to 6kg', '6000|7000' => '6kg to 7kg', '7000|8000' => '7kg to 8kg', '8000|9000' => '8kg to 9kg', '9000|10000' => '9kg to 10kg', 'customValues' => 'Custom Values' ); Now as we can see, in this ArrayList, there is that value 5000|6000. How do we find this through code, do we need some kind of looping or how do we check it. Kindly reply. Thank you |