PHP Classes

File: example2.php

Recommend this page to a friend!
  Packages of Ersin Güvenç   SEO link factory class   example2.php   Download  
File: example2.php
Role: Example script
Content type: text/plain
Description: update example
Class: SEO link factory class
Retrieve friendly URLs from a database
Author: By
Last change: table fields changed
Date: 18 years ago
Size: 1,180 bytes
 

 

Contents

Class file image Download
<?php

    //!!!! PLEASE DOWNLOAD AGAIN ORIGINAL PACKAGE FROM BELOW THE URL ELSE YOU CAN'T SEE SOME UTF-8 CHARACTERS...
    # http://developer.bloggum.com
    ## Mysql connection.....
    $link = mysql_connect("localhost","root","","seo_example") or die (mysql_error());
    mysql_select_db("seo_example",$link) or die (mysql_error());
    mysql_query("SET NAMES 'utf8'");

    require "seo.class.php";

    $seo = Seo::getInstance();
    //set table
    $seo->table = array('TABLE_NAME'=> 'articles',    //table name
                        'ID'=> 'article_id',  //table id field name
                        'FIELD'=> 'title',    //which field you want to convert.
                        'FIELD_LINK'=> 'link' //link field name
                        );

    $title = "ç&#287;ü._e&#287;&#351;08ÀØñ";      //$title coming from $_POST variable..
    $id = "1";
    $link = $seo->update($title,$id); //enter article id
    echo $link;  //---->> USE THIS LINK WITH YOUR MYSQL UPDATE OPERATIONS..

    //forexample
    mysql_query("UPDATE articles SET link='$link' WHERE article_id='$id' LIMIT 1") or die(mysql_error());
    //refresh page and see..

?>