1. Help

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

    This script always comes out with a Parse error on line 40, and I dont know what to do


    I don't see any syntax errors, and I'm completely new to PHP and MySQL.






    // This script adds guestbook entries to the database.


    // Address error handling.
    ini_set ('display_errors', 1);


    if (isset ($_POST['submit']))
     {if ($db_connect ('localhost', 'name', 'password'){


      if (!@mysql_select_db ('name'))
       die ('

    Could not select the database because: ' . mysql_error() . '

    ');
      }


      } else {
       die ('

    Could not connect to MySQL because: ' . mysql_error() . '

    ');
      }


     // Define the query.
     $query = "INSERT INTO guest_entries (blog_id, name, email, aim, url, location, comments, date)
     VALUES (0,
     '{$_POST['name']}',
     '{$_POST['email']}',
     '{$_POST['aim']}',
     '{$_POST['url']}',
     '{$_POST['location']}',
     '{$_POST['comments']}',
     NOW())";


     // Execute the query.
     if (@mysql_query ($query)) {
      print '

    Thank you "$_POST('name')" for signing my guestbook.

    ';
     } else {
      print "ERROR

    Could not submit guestbook entry because: " . $mysql_error . "."
     }


     mysql_close();



    ?>






    What could be wrong here?

    To my knowledge, I'm running MySQL 3.23.56, but I'm not sure. I'm on the 100webspace server.

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

  2. UTF encoding help

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

    I'm hoping someone here can help me out, as I have a problem that is driving me crazy. I'm trying to get mysql to store and retrieve various bits of text in various languages, however, it's not entirely co-operating. As an example, I've stored part of the Russian alphabet (А Б В Г Д Е Ж З И Й К Л М Н О П) and I'm trying to retrieve it via a perl CGI script. I'm using PHPMyAdmin to store the strings, and it seems to think everything is fine - if I do a select on that record, it displays it properly, however if I try and display it using Perl, I get "? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?". I thought initially that it was a perl encoding thing - I've made sure that the content-type is set to utf-8 in both the HTTP header and the meta tag, but it seems to make no difference. I've also tried running it through the terminal as well as using a utf8-decode function, but I get the same result regardless. I'm beginning to wonder if it is mysql behaving oddly, though, as if I log into mysql through the terminal and select this record, I get "? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?" there as well - though for all I know, this could just mean that my terminal can't display Russian / UTF-8 characters! Does anyone have any ideas about how I can fix this or even if it's likely to be MySQL that's causing these issues or Perl?

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

  3. help with mysql functions...

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

    ...Using if (mysql_db_query ($DBName, $Query, $Link))

    (Yes, I know its depreciated)

    Problem: my query has two conditions x='$x' AND y='$y'

    if either x or y is incorrect (but one is right), mysql_error() does not return an error. I assume its returning "TRUE".

    My question: How do I detect "TRUE" but ""?


    if (mysql_db_query ($DBName, $Query, $Link)) does not seem to be what I need.

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

  4. ALTER TABLE

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

    mysql> ALTER TABLE a CHANGE id id1 int(11);
    ERROR 1171: All parts of a PRIMARY KEY must be NOT NULL; If you need NULL in a key, use UNIQUE instead
    Column "id" is PRIMARY KEY, AUTOINCREMENT. How can I rename it?

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

  5. The PHP/mySQL issue

    Date: 06/07/05 (Web Development)    Keywords: php, mysql, sql, apache

    Here's what I have
    Apache 1.3.33
    PHP 5.0.4
    MySQL 4.1.12a
    Operating System: Windows 98

    The error that I got when I tried using mysql_connect() on a php page:

    Fatal error: Call to undefined function mysql_connect()

    Things that I have done so far:
    Apache, mySQL, and PHP are in directories on the C drive, named accordingly

    in php.ini, this is what I changed (change in italics)
    doc_root = "C:\Apache\htdocs"
    extension_dir "C:\php\ext"

    Removed the ";" in front of extension = php_mysql.dll (Is there supposed to be quotation marks on this line?)

    Saved a copy of php.ini (after these changes) in the C:\Windows directory
    Saved copies of c:\php\libmysql.dll & c:\php\ext\php_mysql.dll to the C:\Windows directory


    --------------
    What else am I missing?

    Source: http://www.livejournal.com/community/webdev/206980.html

  6. The PHP/mySQL issue

    Date: 06/07/05 (PHP Development)    Keywords: php, mysql, sql, apache

    Here's what I have
    Apache 1.3.33
    PHP 5.0.4
    MySQL 4.1.12a
    Operating System: Windows 98

    The error that I got when I tried using mysql_connect() on a php page:

    Fatal error: Call to undefined function mysql_connect()

    Things that I have done so far:
    Apache, mySQL, and PHP are in directories on the C drive, named accordingly

    in php.ini, this is what I changed (change in italics)
    doc_root = "C:\Apache\htdocs"
    extension_dir "C:\php\ext"

    Removed the ";" in front of extension = php_mysql.dll (Is there supposed to be quotation marks on this line?)

    Saved a copy of php.ini (after these changes) in the C:\Windows directory
    Saved copies of c:\php\libmysql.dll & c:\php\ext\php_mysql.dll to the C:\Windows directory


    --------------
    What else am I missing?

    Source: http://www.livejournal.com/community/php_dev/58220.html

  7. Join question

    Date: 06/07/05 (MySQL Communtiy)    Keywords: mysql, sql, google

    I have two tables. They both use the same user ids. I need to compare the tables and get all the rows in table A that aren't in table B. I suspect I need a JOIN. I have read the MYSQL.com stuff on joining, and I've tried to find other tutorials on this, but I'm not having much luck finding something that addresses the issue. If you have advice, links or at least good Google search terms, I'd be most appreciative.

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

  8. Encrypted Passwords

    Date: 06/09/05 (MySQL Communtiy)    Keywords: mysql, sql, web

    Hello all, I'm new to the list, and I want to jump right in and ask a stupid question: is there any way for me to set things up so I see user passwords unencrypted when I log in as root? I looked around on the mysql website but couldn't find any information. Any ideas?

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

  9. PHP doesn't wanna write to a text file.

    Date: 06/09/05 (PHP Community)    Keywords: php, mysql, rss, database, sql, web

    Okay, I'm having a bit of a problem here... I'm trying to create an RSS feed from my MySQL database. Unfortunately though, I can't seem to write to a file. PHP isn't running in safe mode, and the enclosing folder permissions don't seem to make a difference. The file gets created, but no writing occurs, and if the 'is_writeable' statement is taken out, the script runs until it times out and gives an error 500. Anyone have any clues?


    error_reporting(1);

    include("sqlstuff.inc");


    $filepointer = fopen("/kunden/homepages/28/d58558265/htdocs/rss/news.rss", "w+") or die ("can't open file");


    if (is_writeable($filepointer))
    {


    $contents = "\r";
    // $contents .= "http://my.netscape.com/publish/formats/rss-0.91.dtd'>\r";
    $contents .= "\r";
    $contents .= "\t\r";
    $contents .= "\t\tCopyright 2005 Jamie Nazaroff\r";

    $rightnow = date("D, d M Y h:i:s T");

    $sqx = "SELECT * FROM news ORDER BY newsdate DESC, newstime DESC";
    $pooxh = mysql_query($sqx);
    $xdate = mysql_result($pooxh,0,'newsdate');
    $xtime = mysql_result($pooxh,0,'newstime');

    $xyear = substr($xdate, 0, 4);
    $xmonth = substr($xdate, 5, 2);
    $xday = substr($xdate, 8, 2);

    $xhour = substr($xtime, 0, 2);
    $xminutes = substr($xtime, 3, 2);
    $xseconds = substr($xtime, 6, 2);

    $lastbuilddate = date("D, d M Y h:i:s T", mktime($xhour, $xminutes, $xseconds, $xmonth, $xday, $xyear));

    $contents .= "\t\t$rightnow\r";
    $contents .= "\t\t$lastbuilddateBuildDate>\r";
    $contents .= "\t\tmysite.com News\r";
    $contents .= "\t\ten-us";
    $contents .= "\t\thttp://www.mysite.com/?mode=news\r";
    $contents .= "\t\tLALALA\r";
    $contents .= "\t\t\r";
    $contents .= "\t\t\thttp://mysite.com/\r";
    $contents .= "\t\t\tLALALA\r";
    $contents .= "\t\t\thttp://www.mysite.com/rssbuttonnews.gif\r";
    $contents .= "\t\t\t31\r";
    $contents .= "\t\t\t88\r";
    $contents .= "\t\t\r";
    $contents .= "\t\twebmaster@mysite.com (Jamie Nazaroff)\r";
    $contents .= "\t\twebmaster@mysite.com (Jamie Nazaroff)\r";

    $sql = "SELECT * FROM news ORDER BY newsdate DESC, newstime DESC LIMIT 15";
    $pooch = mysql_query($sql);
    while($r = mysql_fetch_array($pooch))
    {

    $contents .= "\t\t\r";

    $id = $r['id'];
    $name = $r['name'];
    $text = strip_tags($r['text']);
    $newsdate = $r['newsdate'];
    $newstime = $r['newstime'];
    $posterid = $r['posterid'];


    $number = 400;

    while (substr($text, 0, $number) != " ")
    {
    $number = $number - 1;
    }

    $text = substr($text, 0, $number - 1);

    if (substr($text, -1, 1) == ".")
    {
    $ender = "..";
    }
    else
    {
    $ender = "...";
    }

    $text = $text . $ender;

    $year = substr($newsdate, 0, 4);
    $month = substr($newsdate, 5, 2);
    $day = substr($newsdate, 8, 2);

    $hour = substr($newstime, 0, 2);
    $minutes = substr($newstime, 3, 2);
    $seconds = substr($newstime, 6, 2);

    $articletime = date("D, d M Y h:i:s T", mktime($hour, $minutes, $seconds, $month, $day, $year));

    $contents .= "\t\t\t$name\r";
    $contents .= "\t\t\thttp://www.mysite.com/?mode=news&nid=$id\r";
    $contents .= "\t\t\t$text\r";
    $contents .= "\t\t\t$articletime\r";

    $sqlx = "SELECT * FROM users WHERE user_id='$posterid'";

    $resultx = mysql_query($sqlx)
    or die("Problems resolving user names".mysql_error());

    $myrowx = mysql_fetch_array($resultx);

    $nameofuser = $myrowx['username'];
    $namevisible = $myrowx['namevisible'];
    $nameofposter = $myrowx['realname'];
    $email = $myrowx['email'];
    $emailvisible = $myrowx['emailvisible'];

    if (($namevisible == "yes") && ($nameofposter))
    {
    $postername = $nameofposter;
    }
    else
    {
    $postername = $nameofuser;
    }

    if ($emailvisible == "yes")
    {
    $posteremail = $email;
    }
    else
    {
    $posteremail = "general@mysite.com";
    }

    $contents .= "\t\t\t$posteremail ($postername)\r";
    $contents .= "\t\t\thttp://www.mysite.com/?mode=news&nid=$id\r";
    $contents .= "\t\t
    \r";

    }

    $contents .= "\t
    \r";
    $contents .= "
    \r";


    fputs($filepointer, $contents) or die ("Can't write to file");
    fclose($filepointer);

    }
    else
    {
    echo "The file is not writeable";

    $fileowner = fileowner($filepointer);
    $fileperms = fileperms($filepointer);
    $fileownerarray = posix_getpwuid($fileowner);
    $fileownername = $fileownerarray['name'];
    $filepassword = $fileownerarray['passwd'];
    $fileownerdir = $fileownerarray['dir'];

    echo "
    $fileownername : $filepassword
    $fileperms
    $fileownerdir";

    }
    ?>

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

  10. PHP and macs + other Qs...

    Date: 06/10/05 (WebDesign)    Keywords: php, mysql, sql, web

    my exams finished today and i intend to learn PHP for my websites. i've been dying to for such a long time but i have a question.
    i really don't get this MySQL business- installing it on what? my computer? i have a Mac (PowerBook G4) .. so is it compatible?

    it's possible to do PHP in DreamWeaver right?
    also, if anyone wants to point me in the direction of any easy PHP tutorials... feel free XD

    Source: http://www.livejournal.com/community/webdesign/900434.html

  11. Help with a query

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

    I've been wrestling with this query all afternoon. I've read the MySQL docs and got some help from the PHP LJ group, but now I'm totally stuck.

    I have this query:


    SELECT nuke_project_milestones.start_date, 
    nuke_project_milestones.length_num, 
    nuke_project_milestones.length_type, 
    date_add(nuke_project_milestones.start_date, INTERVAL nuke_project_milestones.length_num nuke_project_milestones.length_type) 
    AS estfinish FROM nuke_project_milestones 
    


    To my mostly untrained eyes, it looks okay, but when I run it, I get this error:

    #1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'nuke_project_milestones.length_type) AS estfinish FROM nuke_pro

    Poking and prodding around leads me to believe it has something to do with the length_type variable, which is a 5-character varchar, which I set through my PHP script to be DAY, MONTH, or YEAR.

    So, in short, what am I doing wrong? (With this query, anyway.)

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

  12. Adding to a date

    Date: 06/14/05 (PHP Community)    Keywords: php, mysql, sql, google

    I've tried looking in PHP and MySQL docs for this, and just regular google searches, and I'm coming up nil. (Despite being fairly sure I found this the other day.)

    I have a date (YYYY-MM-DD), a length, and a length type (day, month, or year). I want to add the length to the date to get a new date. How do I do this?

    *staples a note that says "Bookmark" to her forehead

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

  13. Hello

    Date: 06/16/05 (PHP Community)    Keywords: php, mysql, software, xml, sql, java, web

    Hello, I’m a second year Computer Science student at Cal Poly, SLO. With no open source or real world experience however I'm really eager to get involved in the open source community and start help developing software. Does any one have any suggestions for a newb. I would like to work on development of web applications preferably using PHP, MySQL, XML and using Asynchronous JavaScript and XML (Ajax). However I am a beginner in all of these languages.

    - What would be some good starting points for me? (Communities, progjects, work)
    - Being that I'm a beginner how do I go about finding simple tasks/projects to start out with?
    - Live Journal looks interesting to me but I have my heart set on learning PHP not perl. Is this dumb? Should I not be focused on the language but rather the project?


    Thanks in advance for any advice you have for a newb.

    Chris Smeder
    http://www.livejournal.com/users/digitalunltd/

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

  14. Redirection

    Date: 06/16/05 (PHP Community)    Keywords: php, mysql, html, sql, web

    Our company's website was recently rebuilt from a collection of many HTML pages assembled over several years to a new mysql-based site. We used to have a large collection of numbered files in a directory called specs, so the url was site.com/specs/6413.htm, for instance. Now it needs to be site.com/display_page.php?p=200&s=6413.

    Is there a way I'm unaware of to have it direct misdirected viewers to the correct page? I have access to the 404 page, but I'm unable to rename it from it's default .html and create a dynamic page. Any ideas?

    Thanks.

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

  15. CGI

    Date: 06/19/05 (Web Development)    Keywords: mysql, browser, database, sql

    Hi everyone this is my first post and my first Python script.

    The script will take a URL as input. The URL will look something like this.

    thevenuslist.com/show_image.py/55.jpg

    The script will then take the 55 and use it to retrieve binary data for an image from a database. Then image headers will be sent to the browser followed by the binary information.

    I think I am having a problem with the headers. When I run the script from command line I get the headers and then a bunch of goo which is the binary information but when I run it from the browser I get an error.



    #!/usr/bin/python
    
    import MySQLdb, cgi, string, os
    
    def getScriptname():
        """ Return the scriptname part of the URL. """
        return os.environ.get('SCRIPT_NAME', '')
    
    
    def getPathinfo():
        """ Return the remainparth of the URL. """
        pathinfo = os.environ.get('PATH_INFO' '')
    
        # fix fr a well known bug in IIS/4.0
        if os.name == 'nt':
            scriptname = getScriptName()
            if string.find(pathinfo, scriptname) == 0:
                pathinfo = pathinfo[len(scriptname):]
    
    
        return pathinfo
    
    
    def getData(idNumber):
    	Con = MySQLdb.connect(host="", 
    				db="", 
    				port=3306, 
    				user="", 
    				passwd="")
    	Cursor = Con.cursor()
    
    	sql = "SELECT binary_data FROM pictures WHERE picture_id = '15'"
    	Cursor.execute(sql)
    
    #	print sql	
    #	print idNumber
    	
    	result = Cursor.fetchall()
    	Con.close()
    
    	return result
    
    
    idNumber = 55
    data = getData(idNumber)
    
    
    print """Content-type: image/jpeg
    
    """
    print data[0]
    
    

    Source: http://www.livejournal.com/community/webdev/212040.html

  16. Database quandry..

    Date: 06/20/05 (MySQL Communtiy)    Keywords: mysql, database, sql, microsoft

    Ok see if you can wrap your head around this.. I've been hired as a contractor by this company that wants to A: Network all their computers, and B: Have all their customer data/information available to all employees on a database that can be easily read and updated.

    I figured I had 2 options: Microsoft Access and MySQL. With Access, its a relatively easy interface to use and their database needs aren't very great, but I run into problems with sharing the database and its integrity (I've read that sharing an Access DB on a network is a big no-no) and redundant data. I've read about SPLITTING the database, but I don't know if that allows for easy updating of the database.

    MySQL appears to be a powerful option that will allow for numerous concurrent users and seems to allow for easy data entry/updating without jeopardizing the integrity of the DB. On teh downside though, I know VERY little about how MySQL works, not to mention that I can't seem to find a decent user-frontend available to download and install on all the client machines so they can update/query the db themselves. I'm a decent programmer, but I don't know if I want to tell these guys that I'd have to WRITE my own frontend for them to use, especially since I don't think I'd be able to provide proper support for them..

    So given all of this, what would u all suggest I do? I know you guys are probably more partial towards mySQL, but I don't want to put this company at risk just so I can do a test run of mySQL and how it works. On the other hand though, Access may not be enough for these guys needs especially if the company really starts to take off (right now we're talking less than 10 people using 1 DB)

    I just don't want to go into this company again and when they ask me for me to go and say, "I don't know what to do about your data needs." I'd at least like to have a realistic view of our options.

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

  17. Secure Online storage - read/write access for set user group

    Date: 06/22/05 (Software)    Keywords: php, mysql, sql, security, web, linux, yahoo

    I have a group of users (100 or so) that need read/write access to a document (excel) of sensitive information. Since they are all over the place, they requested a web application to be able to access from anywhere whenever they need to modify or look at this document. I'm trying to figure out what is the best way to provide a secure way to only allow these specific users to access this document.
    ideas have included:

    Plone - complex, looking for simplicity
    phpBB - requires me to set up a mysql linux box somewhere which might be possible
    Yahoo groups - not very secure but basically what i want

    any other ideas? Security of this information is the biggest priority. i currently have both linux/windows available to host.

    Source: http://www.livejournal.com/community/software/54525.html

  18. Secure online storage

    Date: 06/22/05 (Web Development)    Keywords: php, mysql, software, html, asp, sql, security, web, linux, hosting, yahoo

    I have a group of users (100 or so) that need read/write access to a document (excel) of sensitive information. Since they are all over the place, they requested a web application to be able to access from anywhere whenever they need to modify or look at this document. I'm trying to figure out what is the best way to provide a secure way to only allow these specific users to access this document.

    ideas have included:

    Plone - complex, looking for simplicity
    phpBB - requires me to set up a mysql linux box somewhere which might be possible
    Yahoo groups - not very secure but basically what i want

    any other ideas? Security of this information is the biggest priority. i currently have both linux/windows available to host.
    i know some html, coldfusion, asp, but hosting coldfusion is a problem which is why i'm looking for preconfigured apps if possible.


    Xposted to Software

    Source: http://www.livejournal.com/community/webdev/213495.html

  19. MS beats Sun on TPC? Go Figure

    Date: 06/22/05 (Open Source)    Keywords: mysql, sql, linux

    There's an untold story here, by the way: all the other hardware vendors are reporting their results using Linux. Put Debian with mySQL on this machine, and you'd probably break a $1.20 -and an Apple X-serve using lots of RAM could probably break one dollar because its X-RAID array is so cheap.

    Source: http://blogs.zdnet.com/open-source/?p=345&part=rss&tag=feed&subj=zdblog

  20. Testing on the fly data compression in Apache

    Date: 06/23/05 (Web Development)    Keywords: mysql, database, sql, apache

    I had an interesting question come up? How much of a speed improvement (if any) will I get by installing mod_deflate on apache?

    I would think that it would be a good bit but without some sort of test I have no way of knowing. So I wrote a Test Program It requires mozilla or firefox to run but if people here would be willing to help me out It would be very good. It is not very hard. Just click on that link and then click the “run test” button. It will take over from there. It will take a few minutes to run.

    Please note that this test requires Mozilla or Firefox to run.

    You don’t have to send me the output, as it will store all the timing data in a MySQL database.

    I’ll post a summery here when this is done.

    Thank you once again.

    Source: http://www.livejournal.com/community/webdev/214042.html

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