Jump to content

pixy

Members
  • Posts

    295
  • Joined

  • Last visited

    Never

Posts posted by pixy

  1. $row is fetching the array from the database. The mysql_fetch_array() function is what pulls the information out.

    The $row['title'] part is where you are telling it from which column to take it. You're using the method MYSQL_ASSOC (associative, as opposed to numeric) so you call the array based on the name of the column.
  2. Yea, I figured out that I have to switch them, but it never occured to me that it would be a problem.

    Thanks for the clarification! :D It was getting frustrating trying to make my messages database and having it give me stupid errors. XD
  3. If you want to test on your computer without having to be connected to the internet, you can install WAMP which will put PHP, Apache, MySQL, and PHPmyAdmin, and SQLite on your computer. Then, when you try to preview in browser your PHP code something will pop up and say "The page you are looking at contains server side code, would you like to select..." and then you say yes and fill out the form with the information.
  4. Okay, so I'm using sessions to remember a user's username.

    At the top of every page I have
    session_start();
    $user = $_SESSION['user'];

    Since using $_SESSION['user'] messes mysql queries.

    My first question is:
    Why do I get errors if I do it this way:
    $_SESSION['user'] = $user;

    Or when I have something like this...
    while ($row = mysql_fetch_array($result, MYSQL_NUM) {
      $row[0] = $name;
    }
    It gives me an error, but...
    $name = $row[0];
    is okay!

    It's not a big deal, but I'm wondering. I read in a book that people can do variables backwards and it works, so I dont know.

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

    My other question:

    I tried to query the database with a fields called "to" and "from" and "read" and it gave me errors when I used those field names. I changed them to user_to, user_from, and is_read and it's fine. Why did it mess up when I used those names? They were inside parenthasis, so I wouldn't think it would assume that those are some properties of the table...right?
  5. Several people have suggested that allowing your clients to purchase your services through paypal seems unprofessional, yet I have no clue how else to recieve funds. I wouldn't ask them to mail a check in the mail, lol, that's just crazy.

    How do you charge your clients?
  6. [!--quoteo(post=383318:date=Jun 13 2006, 10:27 AM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Jun 13 2006, 10:27 AM) [snapback]383318[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    Try [a href=\"http://127.0.0.1\" target=\"_blank\"]http://127.0.0.1[/a] instead of [a href=\"http://localhost/\" target=\"_blank\"]http://localhost/[/a]

    Web browsers should recognise these as internal address and should not be requesting you to access the internet, you do have Apache running and setup to use port 80 (defualt port)? and that (windows) firewall is allowing access to port 80 (if enabled).

    I have never came across this before, however my old PC has Apache, PHP and MySQL setup on it and is not connected to the net at all yet I am able to access [a href=\"http://localhost/\" target=\"_blank\"]http://localhost/[/a] with no problems.

    Also to change your homepage in IE go to Tools -> Internet Options -> and change the address in the home page box to something else, such as [a href=\"http://localhost/\" target=\"_blank\"]http://localhost/[/a]
    [/quote]

    I clicked "install service" for Apache, and it says port 80 isn't used. So I click enter so it'll continue installation and it says theres an internal error and some file couldn't be found...?

    I dont have firewall on that computer, since it's not online, so it shouldn't be blocking that from being installed.
  7. I googled it...
    I found something called "HTTP_ACCEPT_LANGUAGE" in the PHP manual:
    "'HTTP_ACCEPT_LANGUAGE'
    Contents of the Accept-Language: header from the current request, if there is one. Example: 'en'."

    [a href=\"http://techpatterns.com/downloads/php_language_detection.php\" target=\"_blank\"]http://techpatterns.com/downloads/php_language_detection.php[/a]

    This place seems to offer a script that will do the language detection for you. Then you can easily use that to do the different "good morning" languages you wanted.

    EDIT:
    I found a tutorial on the language thing:
    [a href=\"http://www.domsmith.co.uk/resources/4/php_accept_lang.pdf\" target=\"_blank\"]http://www.domsmith.co.uk/resources/4/php_accept_lang.pdf[/a]

    It's quite lengthy, but hopefully helpful to you.
  8. [!--quoteo(post=382548:date=Jun 11 2006, 11:49 AM:name=samirk)--][div class=\'quotetop\']QUOTE(samirk @ Jun 11 2006, 11:49 AM) [snapback]382548[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    We have an eCommerce site where we would like to get our customers to rate us -- basically like people can rate products on Amazon. Our customers would be emailed a link to put in a rating (1 to 5 star) and a comment. These would then be stored in a DB/file. New visitors to our site would be able to go in and see our overall (average) rating and drill down to individual ratings/comments. What script could I can start with to implement something like this? Thanks for your help.
    [/quote]
    I wouldn't know one off the top of my head. You know, you could always check the freelance forum. This script wouldn't be expensive to have one of them make. All you do is make a form and let them rate you + comments, and log the IP addresses so no one votes twice, and then do a column average for the ratings.

    If you want someone to write one for you, please check my [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=95737\" target=\"_blank\"]freelance thread[/a].
  9. Alrighty, I know it's connected because if it couldn't connect to the database it has an error message to give me. So, the problem is when I attempt to add a new advertisement, it tells me table 'ads.danceinside_monica' doesn't exist. However, I know table 'ads' exists, but it shouldn't be concatenating the two...

    This is my code for ads.php?action=add. Please tell me if you see something I dont--because I've been trying to get to this work. O_O

    [code]
    elseif ($action=='add') {
        $errors = array();
            if (isset($_POST['submitted'])) {
                if (empty($_POST['name'])) {
                    $errors[] = 'You forgot to enter a name!';
                }
                else {
                    $name = $_POST['name'];
                }
                if (empty($_POST['banner'])) {
                    $errors[] = 'You forgot to link to a banner!';
                }
                else {
                    $banner = $_POST['banner'];
                }
                if (empty($_POST['url'])) {
                    $errors[] = 'You forgot to enter a url!';
                }
                else {
                $url = $_POST['url'];
                }

    // Check for errors in the $errors array
                    if (empty($errors)) {
                       $query = "INSERT INTO ads (name, banner, url) VALUES ('$name', '$banner', '$url')";
                       $result = @mysql_query($query) or die(mysql_error());
                       if ($result) {
                           echo "<b>Advertisements updated successfully!</b><p>
                           If you would like to add another banner, <a href=\"ads.php?action=add\">click here</a>.";
                           mysql_free_result ($result);
                           mysql_close();
                        }
                        else {
                           print 'Couldn\'t insert information into database.';
                       }
                    }
                    else {
                        print '<b>Error!</b><br>';
                        foreach ($errors as $msg) {
                            echo "- $msg<br>";
                        }
                        mysql_free_result ($result);
                        mysql_close();
                   }
        }
        else {
            print "To add a new banner, fill in the information below:";
            echo '<form action="ads.php?action=add" method="post">
            <b>Name:</b> <input type="text" name="name" size="15">
            <br><b>Banner Img:</b> <input type="text" name="banner" size="15" value="http://">
            <br><b>Links to:</b> <input type="text" name="url" size="15" value="http://">
            <input type="hidden" name="submitted" value="TRUE">
            <center><input type="submit" name="submit" value="Add New Advertisement"></center></form>';
        }
    }
    [/code]
  10. [!--quoteo(post=383225:date=Jun 13 2006, 07:23 AM:name=SemiApocalyptic)--][div class=\'quotetop\']QUOTE(SemiApocalyptic @ Jun 13 2006, 07:23 AM) [snapback]383225[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    Have you got your homepage set to an address that is not local? Maybe it is trying to load your homepage up when opening IE, thus requiring a connection?
    [/quote]
    I haven't the slightest idea what the homepage is--like I said, I can't go online with that computer. Whenever I click the WAMP icon and click on localhost, it opens up the "internet connection wizard". I went in the www directory and tried to run a file, but it didn't convert it to PHP, so I'm guessing I have to access that through localhost.
  11. [!--quoteo(post=383079:date=Jun 12 2006, 10:09 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 12 2006, 10:09 PM) [snapback]383079[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    You don't need to be connected to access localhost.

    If you're using IE just click on "Connect" and it will work (usually), even though you're not connected.
    [/quote]

    Well I'm not an admin, so it wont let me establish a fake connection. But i'll try that out when my dad gets home and makes me an admin.

    Thanks for your reply!
×
×
  • 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.