1. Tripod websites

    Date: 11/12/05 (PHP Community)    Keywords: php, mysql, database, sql, web

    Hello All. Just a short introduction.

    I'm Sam, 17 years of age from England. I'm currently a student, and am soon to leave for university to study computer gsmes development, which should be fun.I've been teaching myself php along with MySQL for about a week now, and all has been pretty good so far. It's surprising how simple php really is.

    Now thats over with, I have a small problem. I'm not sure if this is the right place to ask, but here goes:

    Does anybody have any experience making websites hosted by the free lycos tripod service? If so, how do you get php to communicate with MySQL in it? I've created a site that works fine on the test server I've created, but as soon as I upload it to tripod, it just stops working. The lycos help page said it would automatically connect to and select your database at the beginning of the script, so I figured you just skip all the mysql_connect() stuff and start straight away with the queries, however it still doesnt work. I know for a fact my query is fine, as I copied and pasted it straight into the mysql client and it all worked beautifully.

    If all else fails, could you recommend a good, preferably free php and MySQL webhost?

    Thankyou Greatly

    Sam

    Source: http://www.livejournal.com/community/php/366601.html

  2. mysql rows

    Date: 11/16/05 (MySQL Communtiy)    Keywords: php, mysql, sql

    Hi, I feel a bit silly asking this. I don't think I quite understand how to apply functions such as mysql_num_rows() or MySQL commands such as COUNT().

    Obviously I'm having trouble with some code, but I want more general answers before working on the code.

    Can anyone explain how to count the number of rows from a table which have a particular value in a particular column? What if one or both of those are variables?

    Thanks in advance. :)

    Cross-posted to '[info]'php.

    Source: http://www.livejournal.com/community/mysql/72773.html

  3. mysql rows

    Date: 11/16/05 (PHP Community)    Keywords: mysql, sql

    Hi, I feel a bit silly asking this. I don't think I quite understand how to apply functions such as mysql_num_rows() or MySQL commands such as COUNT().

    Obviously I'm having trouble with some code, but I want more general answers before working on the code.

    Can anyone explain how to count the number of rows from a table which have a particular value in a particular column? What if one or both of those are variables?

    Thanks in advance. :)

    Cross-posted to '[info]'mysql.

    Source: http://www.livejournal.com/community/php/367931.html

  4. Another MySQL query question

    Date: 11/16/05 (PHP Community)    Keywords: php, mysql, sql

    The query I have is this:

    $query1 = "SELECT DAYOFMONTH(eventdate) as day, DAYOFMONTH(enddate) as endday, event FROM calendar WHERE MONTH(eventdate) = '$month' AND YEAR(eventdate) = '$year' AND type = 1 ORDER BY day";
    $result1 = mysql_query($query1) or die('Query failed: please try again ' . mysql_error());

    The accompanying result php code I have is this:

    while ($a_row = mysql_fetch_array($result1)) {
    if ($a_row['enddate'] != '') {
    print "< font size=-2>".$a_row['day']." to ".$a_row['endday']." - ".$a_row['event']."< br>< /font>";
    }
    else {
    print "< font size=-2>".$a_row['day']." - ".$a_row['event']."< br>< /font>";
    }
    }

    I get no errors anywhere; it simply only prints the else part and doesn't examine the if part. Is this just the wrong way to go about it? Or am I missing something elementary?

    Source: http://www.livejournal.com/community/php/367619.html

  5. Url location

    Date: 11/17/05 (PHP Community)    Keywords: php, mysql, database, sql

    Hello everyone
    This is my first post here so please go easy on me. I've been using/developing php for little over a year now, simple things (help desk, asset database) for my company. But there is 1 thing that has always bugged me and I can't find out how to do it.

    I've noticed on some site's (blogs and php.net) that they dont have the usually page url, such as
    http://www.somedomain.com/pages/about.php
    but more like
    http://www.somedomain.com/about/
    or blog entries like
    http://www.somedomain.com/blog/2005/11/09/

    I just wondered how do they do that? I don't think they create a new directory for each entry or am I wrong there?

    I know that is kinda of a vague question, it's just im redoing my blog atm (i use mysql for storing all my entries) and at the moment the url is usually like http://www.somedomain.com/blog/id=23232 < entry number
    I'd really like to change that to http://www.somedomain.com/blog/2005/11/09.

    If anyone can help that would be great

    Source: http://www.livejournal.com/community/php/368298.html

  6. Loading a MySQL Dump File via PHP NOT the mysql command line

    Date: 11/18/05 (PHP Community)    Keywords: php, mysql, sql

    I've searched and searched and haven't found anything, so any help or direction would be greatly appreciated.

    I have mysql dump files, that are very large, some close to 100 megs (ok large in my opinion), the contain the MySQL statements to dump the table if exists, create, then load the data. I had a daily routine where I would use the mysql command line to load them, but a server issue happened that caused the mysql command to not load due to a segment error (libs were upgraded that shouldn't have been - long story) however the mysql "service" works, and PHP connects to it just fine. What I would like to do is use a PHP script to load these dump files. I tried some script examples on php.net, but they failed, and I wanted to know if anyone else had done this successfuly? And how?

    Thanks!

    Source: http://www.livejournal.com/community/php/369639.html

  7. Any PHP Gurus wanna answer a question for me?

    Date: 11/26/05 (Computer Geeks)    Keywords: php, programming, mysql, browser, html, database, asp, sql

    I've done plenty of ASP.NET programming but this is my first foray into the wonderful land of PHP and I've got a question about how often you hit the database in a normal page load... basically I have tags like:

    within the front end page and listing.php goes something like

    $database = mysql_connect("localhost", "your_database_user_id", "your_database_password");
    mysql_select_db("your_database_name", $database);
    
    switch($type){
    	case 'thumbnail':
    		header("Content-type: image/jpeg"); // act as a jpg file to browser
    		$query = "SELECT thumbnail
    			FROM your_table
    			WHERE id = $id";
    		$result = mysql_query($query, $database);
    	
    		$row = mysql_fetch_array($result);
    		$jpg = $row["thumbnail"];
    		echo $jpg;
    		break;
    	case 'address':
    		header("Content-type: text/html"); // act as an html file to browser
    		$query = "SELECT address
    			FROM your_table
    			WHERE id = $id";
    		$result = mysql_query($query, $database);
    	
    		$row = mysql_fetch_array($result);
    		$address = $row["address"];
    		echo $address;
    		break;
    }
    

    Now if I understand this correctly, anytime the parser hits a tag (or w/e) it will connect to and select from the database. So on a page with 5 tags that pull from listings.php, the scripts will connect to, select from and disconnect from the database 5 times right? Is this is proper way to do things? It kinda makes me uncomfortable to make so many database hits but this seems to be the average way php developers do it.

    Source: http://www.livejournal.com/community/computergeeks/824527.html

  8. Undesireable sticky form

    Date: 11/25/05 (PHP Community)    Keywords: php, mysql, sql

    This is a first for me and I wonder if anyone else has ran into this problem. The code is really long and consists of several files so I'm not going to list it all. But I'll explain what it does and see if anyone has ever had this problem:

    The "main" page runs a MySQL query. If they've never filled out the form, their data is not in MySQL, therefore the $_SESSION variable will not be set. The code that does this is near the top of the script (after including required files, etc.).

    When the form is filled out and submitted, it calls the same page and also includes another file that processes the form.

    Now with the information submitted and entered into MySQL, it runs back through the "main" page. The code that sets that $_SESSION variable runs a query looking for their entry and then sets the $_SESSION variable to true:

    if ($characters) {
    $_SESSION['characters'] = $characters;
    $_SESSION['character_initialized'] = 1;
    }
    I've tested it with "echo debugs" and it is indeed within the if statement.

    The only way the form is supposed to be shown is if $_SESSION['character_initialized'] is not set. The following calls the form:

    if (!isset($_SESSION['character_initialized'])) {
    include_once ($root_dir . 'content/create_character.php');
    }

    What happens is when the form is submitted, the form comes right back up! But any other click to a link then presents the page the way it's supposed to be. If you try to fill out the form again, it's just going to give back a message that you've already filled out the form.

    So, am I missing something? I might want to add that the $_SESSION variables are within a function. Am I maybe having a variable scope issue? But then, if I am, I would think that the $_SESSION variable would NEVER get set and the second click on the page would just give me back the form again.

    I have never had this problem before and have tried this script literally 30 different ways to find the problem.

    Source: http://www.livejournal.com/community/php/370941.html

  9. "insert into" сразу в две таблицы

    Date: 11/29/05 (MySQL Communtiy)    Keywords: php, mysql, sql

    Уважаемые mysql-гуру,

    никак не могу найти решение для (как мне казалось) простой задачи.
    Ситуация такая: на сайт загружается графический файл. Его название и номер объекта, к которому относится этот файл, заносятся в таблицу.
    При этом мне те же значения ('$id','$filename') нужно занести в ещё в одну таблицу.
    Можно ли сделать это за один прогон?
    Мне не знаком вариант insert с двумя таблицами.
    Может вы что-то подскажете?

    спасибо! 

    upd
    sorry, a wrong community (or a wrong lanuage for the rihgt community)
    the question was if it’s possible to insert values into two tables at once – I
    upload a file and insert information about this file into two tables
    (PHP&MySQL).
    I’d like to know if there is a way to do it with one insert
    only …

    Source: http://www.livejournal.com/community/mysql/74109.html

  10. Sending a weekly email based on predefined search criteria

    Date: 11/29/05 (PHP Community)    Keywords: mysql, database, sql, web

    Need some tech help and pointers.


    My client is asking to send users an email every week, automatically. I have no clue how to do this.

    The content of that email will be created by doing a search of a MySQL database.


    If anyone knows how to do this or can point me some where useful, I'd appreciate the help.


    [UPDATE you guys are making me laugh, relieving a lot of stress]
    I could set up an event to run from my iCAL that loads a web page!

    Source: http://www.livejournal.com/community/php/371609.html

  11. stored procedures

    Date: 12/02/05 (MySQL Communtiy)    Keywords: mysql, sql

    So MySQL 5.0 has stored procedures..  Could someone touch on why I would want to use these in an environment developed around 4.1? 

    Source: http://www.livejournal.com/community/mysql/74834.html

  12. PHP form problem

    Date: 12/05/05 (PHP Community)    Keywords: mysql, sql, security

    I was just asked to take a look at a form here at work. The purpose of it is to allow people to sign up for a mailing list: first name, last name, email. It takes the details from the form and just adds it to a MySQL db without doing any error checking. The client has just said that they're getting all kinds of weird entries. What's showing up look like pieces from email headers. I just took a look at the script (which I didn't write) and there doesn't seem to be any security on it to restrict access to the form script to just the client's domain. All of the weird entries seem to be coming from the same email address (onemoreaddress@hotpop.com)

    My guess is that someone is submitting info to the form through another domain or otherwise hacking the form/db. Has anyone had a problem like this before or have any other opinions on what might be causing it?

    I'm going to add in some error checking and see if I can set up something to only allow the form to be processed if submitted on the client's domain. Anything else I should think about?

    Source: http://www.livejournal.com/community/php/374052.html

  13. I think I'm in serious trouble.

    Date: 12/06/05 (MySQL Communtiy)    Keywords: php, mysql, sql

    I have a DB. Had RedHat 9.0. Went to Ubuntu (I love it). I've been setting everything back up. Before wiping the drive, I copied my entire DB folder (had mysql folder and my db folder). I thought that was sufficient to back it up. Upon installing Ubuntu, I apparently have a newer version of MySQL.

    I usually use phpmyadmin to manage the db. It's going crazy with errors not being able to find tables (mainly .frm files).

    I think I made a serious mistake. Was I supposed to use some kind of export command before making it portable? Is there any way of even getting my tables into a normal view? At this point, I don't even mind manually entering everything as long as I can get it viewed!

    I guess what I'm asking... Am I screwed??????

    Source: http://www.livejournal.com/community/mysql/75091.html

  14. Another question...

    Date: 12/06/05 (MySQL Communtiy)    Keywords: php, mysql, sql, linux

    It's me again.

    Got this message through phpmyadmin:

    Warning: Your privilege table structure seems to be older than this MySQL version!
    Please run the script mysql_fix_privilege_tables that should be included in your MySQL server distribution to solve this problem!

    I'm on Linux (Ubuntu). where is this function/module and how do you call it? Through mysqladmin?

    Source: http://www.livejournal.com/community/mysql/75435.html

  15. When you think you know more than the code...

    Date: 12/07/05 (PHP Community)    Keywords: php, mysql, sql

    Some may find this amusing :)

    First, a little preface for those that keep up with this journal. I was running on RedHat 9.0, way outdated. And when I tried to update PHP, it was a mess. So I decided that it was time to just upgrade the entire OS. Went to Fedora 4... even worse nightmare. Then I found Ubuntu... redemption.

    After getting everything setup and modified: The core, PHP, http, postfix, MySQL, SSH, FTP (yeah, thank God for Ubuntu!), everything finally returned to normal Monday morning around 3:00 AM.

    The whole reason for updating was due to a bug I read about a long time ago in v 4.2.2. The bug was with the sort() function. I just remembered reading about it in my O'Reilly PHP Cookbook. Most of my sorting has always been done via MySQL. So I've never had a use for sort() until this one line of code. So I'm thinking after coding and it not working "ah, this is that bug".

    So I went back to that line. After all this headache, I just immediately had to know if it worked now:

    $options = ksort($this->allowable_commands());

    I almost got sick to my stomach. The right answer?

    $options = $this->allowable_commands();
    ksort($options);

    So only NOW do I go back to try to find what the bug actually was that PHP Cookbook talked about (page 98):

    The sort() function doesn't preserve the key/value association between elements. Instead, entries are reindexed starting at 0 and going upward. (The one exception to this rule is a one-element array; its lone element doesn't have its index reset to 0. This is fixed as of PHP 4.2.3)

    My usage wasn't even CLOSE to this bug! I thought sort() returned the re-sorted array.

    That's what I get for overthinking. Go ahead, you can laugh at me. I did.

    Source: http://www.livejournal.com/community/php/375336.html

  16. Problems creating tables with UTF8 for 5.0 INNOdb databases

    Date: 12/08/05 (MySQL Communtiy)    Keywords: mysql, rss, software, database, sql, linux

    Any ideas?

    CREATE TABLE `LAD_RSSDB_FEEDSTER_CORE` (
    `RSS_ID` int NOT NULL auto_increment,
    `SITE` varchar(64) DEFAULT 'rssdb' NOT NULL,
    `ACCOUNT_ID` int DEFAULT -2 NOT NULL,
    `URL` varchar(900) NOT NULL,
    `CHANGED` tinyint DEFAULT 1 NOT NULL,
    `STATUS` tinyint DEFAULT 0 NOT NULL,
    `LAST_PINGED` datetime DEFAULT '1970-01-01 00:00:00' NOT NULL,
    `LAST_DOWNLOADED` datetime DEFAULT '1970-01-01 00:00:00' NOT NULL,
    `TIMESTAMP` timestamp NOT NULL,
    `PING_INTERVAL` bigint DEFAULT 144000 NOT NULL,
    `CRC32` int DEFAULT 0 NOT NULL,
    `STRIKES` int DEFAULT 0 NOT NULL,
    `FIRST_CREATED` datetime NOT NULL,
    `CREATED_BY` varchar(50) DEFAULT 'unknown' NOT NULL,
    `NM_PROCESSED` int DEFAULT 0 NOT NULL,
    `NM_CUMUL` int DEFAULT 0 NOT NULL,
    UNIQUE KEY `RSSDB_FEEDSTER_CORE_IND1` USING BTREE (`RSS_ID`),
    KEY `RSSDB_FEEDSTER_CORE_IND2` USING BTREE (`URL`)
    ) ENGINE=INNODB DEFAULT CHARSET=utf8;

    and I got the following error message:

    #HY000Can't create table './rss/LAD_RSSDB_FEEDSTER_CORE.frm' (errno: 139)

    Machine is l00nix and build is:
    root@mosdef [6:43pm]:86:/data# mysqladmin version -p
    Enter password:
    mysqladmin Ver 8.41 Distrib 5.0.16, for pc-linux-gnu on i686
    Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
    This software comes with ABSOLUTELY NO WARRANTY. This is free software,
    and you are welcome to modify and redistribute it under the GPL license

    Server version 5.0.16-log
    Protocol version 10
    Connection Localhost via UNIX socket
    UNIX socket /tmp/mysql.sock
    Uptime: 5 days 1 hour 57 min 29 sec

    Threads: 7 Questions: 11430901 Slow queries: 0 Opens: 0 Flush tables: 1 Open tables: 34 Queries per second avg: 26.036

    The production version of this will be on FreeBSD - is this a locale issue? Do I need to recreate databases and/or recompile?

    Source: http://www.livejournal.com/community/mysql/75539.html

  17. PHP Email

    Date: 12/07/05 (PHP Community)    Keywords: php, mysql, sql, linux, google, apache

    Hello everyone
    I've got a little bit of a problem, @ work I run PHP on apache which then runs on Win2k Server. For email I have just edited the php.ini and changed

    SMTP =
    smtp_port = 25

    to point at our exchange server. Now here's the hard part @ home I run a linux server, well 2, 1 is my mailserver and various other stuff the other is my dev box, apache/mysql/php. How/what do I need to change to get my dev box to send mail to my mailserver ? I've had a look on google but drawn a blank.

    My dev box is called pm-sr02, mailserver called pm-sr01.

    Thanks for any answers

    Source: http://www.livejournal.com/community/php/375707.html

  18. I'm at a loss

    Date: 12/10/05 (PHP Community)    Keywords: php, mysql, sql, apache

    This may be because my brain is fried after a format and reinstallation of everything but I can't seem to see the resolution to this problem.

    I'm getting this: Fatal error: Call to undefined function mysql_connect() in...

    I'm running PHP 5.1.1 as an Apache 2.0 module using MySQL5 on WinXP. I've been over php.ini several times and everything appears in order, and all the .dll's exist in their correct place, but it continues to insist it does not know the function.

    Help is appreciated.

    Source: http://www.livejournal.com/community/php/377171.html

  19. Finding AVG of multiple columns

    Date: 12/10/05 (MySQL Communtiy)    Keywords: mysql, sql

    Say I have a row with three scores:

    taste=4
    price=3
    value=3

    Can mysql figure the average of these three columns with one query?

    Source: http://www.livejournal.com/community/mysql/75966.html

  20. SELECT TOP and LIMIT

    Date: 01/01/70 (Programming)    Keywords: programming, mysql, database, sql

    I was doing a little programming with a MySQL database today and I ran into a little snag. I am really familiar with using a MSSQL database and was trying to limit my results the same way I do in...

    Source: http://www.coreycollins.com/blog/archives/000075.php

Previous page  ||  Next page


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home