Jump to content

sjhwebdesign

Member
  • Posts

    46
  • Joined

  • Last visited

Posts posted by sjhwebdesign

  1. My friend has a ecommerce site, but its not database driven ie each product is an html page. The name of the product is in the page url eg ww w . site . co m/product_name . htm

     

    Is it possible to search for a url containing/matching a search term entered in a form?

     

    eg type in "red car" and get ww w . site. com/red_car_product. ht m

     

    preferably with php.

  2. I have a few map entries for my mobile disco business, in several different counties as it is a travelling business.

     

    I have had these for a long time and no issue.

     

    eg a PE10 (Lincs) postcode, CB1 (Cambs), LE1 (Leics), etc..

     

    Suddenly all 5 entries come up with the same address (LE1). Even though when I go into my local business center control panel they all have the correct addresses that I have given them. I haven't made any changes, it just suddenly happened, any ideas?

     

    Will this correct itself next tim Google re-indexes, caches etc?

     

    I know technically you are only supposed to use one address, but I provide a service that travels and Google maps doesn't really acommodate for this, I rank quite well in the main Google results but now that Google gives upto 10 map results for any area / business related search people will click all the map results before the main results. I don't want to bother with Adwords, I have tried this and its a waste of time, firstly people read top left down to bottom, so they rarely click them unless they are one of the ones that Google puts above the map results occassionally. Even then most click thrus are other businesses checking the competition, people looking for email address or generally people who want to waste your time offering services you don't require.

  3. in terms of 1 big main image and the rest as thumbs, you would need to tag one image as the main image.

     

    this could be done by having the main image in the user table as a main image feild and the images table is the additional images.

     

    or you could have a extra feild in the images table to tag the image order eg "theorder", and make the query:

     

    $getimages = mysql_query("SELECT * FROM images WHERE ownerid = '$userid' ORDER BY theorder ASC");

  4. eg search by name:

     

    <?php

     

    $name = $_POST['name'];

     

    $getresults = mysql_query("SELECT * FROM users WHERE name = '$name'");

     

    while ($results = mysql_fetch_array($getresults)) {

     

    echo $results['name'];

    echo $results['city'];

    echo $results['state'];

     

    $userid = $results['id'];

     

    $getimages = mysql_query("SELECT * FROM images WHERE ownerid = '$userid'");

     

    while ($images = mysql_query($getimages)) { ?>

    <? echo $images['imageurl']; ?>

    <?php

    }

     

    }

     

    ?>

     

    you would have to create your html layout to suit your webpage.

  5. your user table will have:

     

    id (autonumber, primary key)

    name

    city

    state

     

    your images table will have:

    id (autonumber, primary key)

    imageurl (the location of image on server eg http://www.yoursite.com/images/image.jpg

    ownerid (this is the id from the users table)

     

    example user:

     

    10

    fred

    orlando

    florida

     

    corresponding images:

     

    1

    http://www.yoursite.com/images/image1.jpg

    10

     

    ----------------

     

    2

    http://www.yoursite.com/images/image2.jpg

    10

     

    Both images are owner by 10 which is the id for fred in the user table.

     

    The image upload form will be:

     

     

     

     

     

     

     

     

     

    you would have already assigned $userid earlier in your script eg:

     

    $userid = $_COOKIE['userid']; // if your are using a login cookie for example.

  6. use html with php to display the image:

     

    <?php

     

    $getresults = mysql_query("SELECT * FROM yourtable WHERE id = '$userid'");

     

    while ($result = mysql_fetch_array($getresults)) {

     

    ?>

     

    <? echo $results['imageurl']; ?>

     

    <?php

     

    }

     

    ?>

     

    for multiple images you would do this in 2 ways;

     

    a) if you have a set amount of images, you would have imageurl, imageurl2, imageurl3 etc... in your user table.

     

    B) unlimitted images, you need two tables, users, images. you then link the tables eg:

     

    images table would contain; id, imageurl, imageowner - with imageowner being the id of the user.

     

    the query would then be

     

    $getimages = mysql_query("SELECT * FROM images WHERE ownerid = '$userid'");

  7. you can export / import between mysql and access so you can use access offline and mysql online, however one may not be as upto date as the other etc..

     

    you can't use mysql offline, so you would be limitted to access, which is better used with asp, not php.

     

    php and mysql go together but only online.

     

    asp and access go together and you can use access offline.

     

    HOWEVER:

     

    You could run the mysql database for both the customer with the website front end, and have a seperate admin website which is password protected for the company to use the data, however it would require an internet connection.

     

    On the other hand if the database is only to be accessed by the company, then you could have you own mysql server and access it locally (you would need to speak to your IT dept about this).

     

    either could be done with php/mysql or asp/access, so depends which way you want to do it.

  8. you don't need the access database, the mysql database is used instead(however you can import the access records into a mysql database if your export it as csv and use phpmyadmin to import it into your mysql database.

     

    To use a form with a mysql database you need to

     

    make a mysql connection:

     

    <?php

    // db settings

    $db_host = "mysql.yourhost.com";

    $db_user = "username";

    $db_pwd = "password";

    $db_name = "database";

    mysql_connect($db_host, $db_user, $db_pwd);

    mysql_select_db($db_name);

    ?>

     

    you then need to assign a variable to each form feild:

     

     

     

     

     

     

    You then need to handle the data:

    <?php

    if (isset($_POST['Submit'])) {

    $info = $_POST['info'];

    mysql_query("INSERT INTO `yourtable` (info) VALUES ('$info')");

    }

    ?>

  9. to remove from google add this to .htaccess;

     

    Redirect theredir/theirpage.htm http://www.yoursite.com/yourpage.htm'>http://www.yoursite.com/yourpage.htm

     

    (one for each page )

     

    Redirect theredir/ http://www.yoursite.com/yourpage.htm

     

    (one for each dir)

     

    This will look for people entering the offending url and redirect them to your site.

     

    I'm not sure how to remove from google cache if they wont do it for you.

     

    You should delete your cookies etc from your pc, your could have a tracking cookie/virus which has got hold of your ftp settings.

  10. $query="SELECT ID, Name, Description, Location, ListPrice, Price, Image FROM proclist WHERE ID = '$pass'";

     

    asks your database to return results where the ID feild is equal to "pass", you can't have an id of zero if this is the primary key for the database, so there will be no results in your table that have an ID of zero so nothing will be displayed, same way for example there where 5 entries in your database and you set "pass" as 6 it would return nothing.

  11. look up ip with h tt p://w ww.geo ipto ol.c om

     

    its a bit hit and miss though, because isp companies eg aol will route someone in northampton through an exchange in the lake district! other isp companies are more acurrate.

     

    the ip in this case is used so you can follow a visitors journey through your website.

  12. just rename the pages from page.htm to page.php

     

    to insert a php code block use <?php to start it and ?> to close it, the html will work as it is as a .php page is php + html

     

    as for hit counter, create a table in your mysql database called stats, with;

     

    ip(int 11 auto increment primary key), referer(vary 150) , browser(vary 150) , date(date), time(time), page(vary 150)

     

    and add the following code to the top of each php page you wish to track

     

    <?php

     

    // db settings

    $db_host = "mysql.yourhost.com";

    $db_user = "yourdatabaseuser";

    $db_pwd = "yourdatabasepassword";

    $db_name = "yourdatabasename";

    mysql_connect($db_host, $db_user, $db_pwd);

    mysql_select_db($db_name);

     

    // record stats

    $ip = $_SERVER['REMOTE_ADDR']; // there ip

    $referer = $_SERVER['HTTP_REFERER']; // where they came from eg google

    $browser = $_SERVER['HTTP_USER_AGENT']; // browser - can also show search bots

    $date = date("Y/m/d"); // current date

    $time = date("H:i:s"); // current time

    $page = $_SERVER['PHP_SELF']; // page they visited

    mysql_query("INSERT INTO `stats` (ip, referer, browser, date, time, page) VALUES ('$ip', '$referer', '$browser', '$date', '$time', '$page')");

    // end of stats

    ?>

×
×
  • Create New...