|
-
php and xml
Date: 01/27/06
(PHP Community) Keywords: php, mysql, xml, sql
hi, i'm looking for any possible tips, i'd created some content which i've got in an xml file;
Welcome spew of test1 Contact spew of text2
and i'm wondering what's the best way of going about parsing it? my current method only returns the whole file, where as i'll only need of the two at any one time.
any tips, links, suggestions, tutorials?
x-posted to php and php_mysql
Source: http://community.livejournal.com/php/402765.html
-
PHP5/Apache2/MySQL - Undefined Function mysql_connect
Date: 02/02/06
(PHP Community) Keywords: php, mysql, sql, apache
Hi,
I'm trying to set up WAMP. I've got Apache and MySQL running. PHP installed into Apache.
PHPInfo() renders correctly, but there are no MySQL modules installed.
Apache's httpd.conf contains:
LoadModule php5_module /development/php/php5apache2.dll addtype application/x-httpd-php .php .php4 .php5 .php3 .htm .inc addtype application/x-httpd-php-source .phps PHPIniDir "/development/php/php.ini"
Php.ini contains:
extension_dir = "./ext" extension=php_mysql.dll
It's on windows, but on a USB key, so I'm using relative paths (/development is in the root of the USB drive and appears to correctly point to the right location whenever the usb key is mounted in any machine)
Any suggestions?
Source: http://community.livejournal.com/php/406456.html
-
Help needed with login script..
Date: 02/03/06
(PHP Community) Keywords: php, mysql, html, database, sql
I have the following login script when it logs in it just goes straight to back to the login page. Now I've worked out it's something to do with the else or if ( $num != 0) statement as when commented out it goes thru ish but it doesn't print the $msg variable which I have an echo statement calling on it in the html body..The session start/auth isn't being worked on atm hence why it's been commented out.
#set variables $usr = $_POST['username']; $pass = $_POST['password']; $self = $_SERVER['PHP_SELF']; /*#Start session and auth it if (isset( $usr ) and isset( $pass ) ) { session_start(); $_SESSION['authorized'] = 'ok'; $url = (isset($_GET['url'])) ? $_GET['url'] : 'index.php'; header("Location: $url"); }*/ #check form not empty if ( (!$usr) or (!$pass) ) { header ("Location:{$_SERVER['HTTP_REFERER']}"); exit(); } #connect to sql db $conn = @mysql_connect( "localhost", "xxx", "xxx" ) or die( "Could not connect to SQL" ); $rs = @mysql_select_db ( "xxx", $conn ) or die ( "Could not select database" ); #select db $sql = 'select * from users where \'user_name\'=\'$username\' and \'password\'= password(\'$password\')'; #execute the query $rs = mysql_query($sql, $conn) or die ( 'Could not execute query' ); #get no. of matching rows $num = mysql_num_rows ( $rs ); #check for match if ($num != 0 ) { $msg = 'Welcome $usr - you are now logged in'; } else { header ("Location:{$_SERVER['HTTP_REFERER']}"); exit (); }
Source: http://community.livejournal.com/php/406868.html
-
Web Host Recommendation?
Date: 02/03/06
(Asp Dot Net) Keywords: php, mysql, database, asp, sql, web, google, apache
Hey guys,
This is not an asp.net technical question, but I thought maybe someone here could help me out.
I need to switch web hosts. The one I have now has terrible customer service and thinks that it is normal to take the web server down for several hours every day, and not bother to tell their customers that they do so. I found them through Google and I don't want to try that again.
I've tried looking for recommendations elsewhere, but all the ones I've found have been for Apache web servers. I need an IIS web server that has: ASP.NET/ADO.NET and PHP4/5 supported, MySQL or SQL Server databases, along with the standard mail accounts, web statistics, ftp access, etc. It's just for a couple personal sites, so I don't need a lot of bandwith or space, just need reliable servers with little downtime and good customer service.
Any recommendations?
Source: http://community.livejournal.com/aspdotnet/57938.html
-
Variable gets overwritten somewhere?
Date: 02/05/06
(PHP Community) Keywords: php, mysql, database, sql, apache
FIXED. Thanks to hipmaestro -- I downloaded PHP 4.3.11 and upgraded my installation, and it's fixed. :)
I've been working at this since last night -- and I'm quite clueless about what's happening. I was thinking that it could possibly be that my system has been working too long and there are weird memory leaks (yes, I have no more good ideas) so I thought I'd just go back in the morning... but now it's morning and the error is still there. The error is-- at some point of the script, a certain variable gets overwritten with the text of the next variable.
This is how the script is set up: there is a config file that's included all over the place -- in all the visible pages and in each function (I'm toying with the idea of using constants instead, but for now this is what I'm using). The config file has the database variables, and along the top I define the connection stuff:
$db_server = 'localhost'; $db_user = 'username'; $db_password = 'password'; $db_database = 'databasename'; So I include it in almost everywhere. The script's functions is included in a mod_modulename.php file, such as get_this_stuff(); and add_something(); and so on and so forth. For the script I'm using, some user settings are stored in the database, and I have a mod_settings.php file with the following functions:
- get_setting( $settingshortname );
- get_setting_title( $settingshortname );
- get_setting_desc( $settingshortname );
- update_setting( $settingshortname, $newvalue );
- ...
There are a few other functions but those are the ones needed to, er, get the gist of the way they're set up.
So now I'm working pretty well, until I come to one page and at the bottom of the page, I get a MySQL error about not being able to connect to the test database. See this (before?) screenshot. I fiddle around, check config, etc etc. Nothing. I look for where the database connect is failing, and it's in get_setting( ... ); so I go there and take a look. I add a few echoes in there, to check my config values and look what happens to the page: whatthehell?
I've searched the whole script directory and the ONLY place where I assign a value to $db_user is in config.php; nowhere else. I don't have register_globals turned on, and I don't plan to ever turn it on; and I've checked the $_* arrays, and there is no index of that name. I ended up going to config.php and doing a series of echoes, and did this:
echo '$db_user is now: ' . $db_user . ''; $db_server = 'localhost'; $db_user = 'username'; $db_password = 'password'; $db_database = 'databasename'; echo '$db_user is now: ' . $db_user . ' '; And that results to this:
Notice: Undefined variable: db_user in D:\Site\devt\Enth3\enth3\config.php on line 11 $db_user is now:
$db_user is now: password *tears hair out!* It's right before the line and it assigns $db_password. I have no idea what's going on. I commented out the $db_server line and the $db_user line got 'username' as its value. I repeated $db_user twice consecutively, still 'password'. I repeated $db_user twice, the next one after $db_password, and it works. Here's another: I switched the $db_password and $db_database variables, which means $db_database now goes before $db_password. The value of $db_user? It's 'database'. NOT 'databasename', but 'database'. WHAT THE HELL IS GOING ON.
I suppose I could make a fix where $db_user goes after $db_password or something, but just the fact that this is happening means that there's just plain something wrong with what's happening, either with the interpreter or my code or... whatever. I don't see what's wrong, and I've exhausted all possible ideas in my head as to what's wrong... can anyone help me?
If it might be useful -- the PHP interpreter died on me twice yesterday. I'm not sure why. It just did. Windows XP (SP2) just told me that the PHP interpreter got some errors or something (I forgot what it said) and needs to close. I let it close, I rebooted the computer, and went on. I'm working with Apache 2.0 and PHP 4.3.0 and MySQL 4.0.15 on this machine, which is on Pentium4 2.4 GHz and 480MB memory (512, but the rest is being eaten up by the video card).
Any ideas? Help? Suggestions?
Source: http://community.livejournal.com/php/407728.html
-
mySQL/PHP question
Date: 02/06/06
(MySQL Communtiy) Keywords: php, mysql, sql, web
Howdy,
Suppose I want a way to easily backup a SQL table. (I use MySQL but that shouldn't matter.) I would like to be able to have a link on my website that, when I click on it, lets me download a TXT file with all of the data in tab separated values, so I can easily load it into excel.
Somebody suggested using select into outfile 'filename', but I must admit that the mySQL manual baffles me and I have a hard time getting any help from it. So, how would I use it in this regard?
Thanks much!
(crossposted to php community)
Source: http://community.livejournal.com/mysql/84826.html
-
SQL/PHP question
Date: 02/06/06
(PHP Community) Keywords: mysql, sql, web
Howdy,
Suppose I want a way to easily backup a SQL table. (I use MySQL but that shouldn't matter.) I would like to be able to have a link on my website that, when I click on it, lets me download a TXT file with all of the data in tab separated values, so I can easily load it into excel.
Is this possible, and, if so, how do can I do it?
Thanks much!
Source: http://community.livejournal.com/php/408180.html
-
Dead function
Date: 02/06/06
(PHP Community) Keywords: php, mysql, sql, web
Ok, I have the following function that until the other day worked fine. It has now stopped and i have no idea why. The only think i know of that has been done on my web server recently is MYSQL have been upgraded.
function img_resize($path,$w,$h,$quality,$save){
$image_data=@getimagesize($path);
$image_type=$image_data[2]; $gd_ext=array('','jpg','gif'); if($image_type!=1&&$image_type!=2) return false; if($save=='') header('Content-type: '.$image_data['mime']); else $save=eregi_replace('%ext',$gd_ext[$image_type],$save);
if($w!=0){ $rapporto=$image_data[0]/$w; if($h!=0){ if($image_data[1]/$rapporto>$h) $rapporto=$image_data[1]/$h; } }elseif($h!=0){ $tmp_h=$image_data[1]/$h; }else{ return false; }
$thumb_w=$image_data[0]/$rapporto; $thumb_h=$image_data[1]/$rapporto;
if($image_type==1) $img_src=@imagecreatefromgif($path); elseif($image_type==2) $img_src=@imagecreatefromjpeg($path);
$img_thumb=@imagecreatetruecolor($thumb_w,$thumb_h); $result=@imagecopyresampled($img_thumb,$img_src, 0,0,0,0,$thumb_w,$thumb_h,$image_data[0],$image_data[1]); if(!$img_src||!$img_thumb||!$result) return false;
if($image_type==1) $result=@imagegif($img_thumb,$save); elseif($image_type==2) $result=@imagejpeg($img_thumb,$save,$quality);
return $result; }
Now this code is meant to take an image (full path including filename as $path) and make it the size set when called and then save it to the name and path set as $save.
When it makes this file, it is a copy, so nothing is done to the original. Now this function is part of the admin section to my gallery which is there just to make and store the thumbnails. I have no idea why this isn’t working, but I have tried a few of the scripts in the php docs with no luck. Php is working, so it isn’t that, so does anyone know how I could do this function in the most compataible way possible? Bear in mind I’m still a bit of a n00b, well with image manipulation at least.
Thanks for any help.
Source: http://community.livejournal.com/php/408971.html
-
problems with SELECT * INTO OUTFILE
Date: 02/08/06
(MySQL Communtiy) Keywords: mysql, sql
Hello,
I am having problems with the SELECT * INTO OUTFILE
I have already ensured that: 1) I have file access 2) the folder is chmod 777 3) the file does not already exist
My code looks like this: $query="SELECT * INTO OUTFILE 'backup/$date.txt' FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n' FROM journal"; $result=mysql_query($query) or die(mysql_error()); if ($result) { echo "Backup file was created successfully!"; }
This is what I get when I run the script: Can't create/write to file 'backup/07022006.txt' (Errcode: 2)
Any help would be greatly appreciated. Thanks!
Source: http://community.livejournal.com/mysql/85179.html
-
Eclipse
Date: 02/09/06
(PHP Community) Keywords: php, mysql, browser, sql, apache
Hi all, I recently landed a new job. The people that work there use Eclipse. I have been playing around with it to try and get a feel for it before I start next week and I am running into a couple of problems. I was hoping one of you would not mind giving me some pointers.
I have:
Eclipse Version: 3.1.2 XAMPP very 2.1
I installed Eclipse into the XAMPP directory as instructed.
To my understanding XAMPP will run Apache, MySql, PHP and PERL when the computer starts as I think I set them up as services.
I wrote a little test program using a set of functions that I have been using for a while now. The test program includes a config file that has the full include list in it. For some reason none of my files are being included. I do a require instead of an include, it does not fail but the functions are still not available. I can see the files are the in Eclipse's browser so I am not sure why they are not being found.
There are buttons in Eclipse for starting and stopping XAMPP. These seem to have no effect on XAMPP at all.
Any clues suggestions would be helpful. I have looked on the net all day but have not found anything I can really seem to understand. I have read the help files for Eclipse but they only pertain to Eclipse itself and not the add ons.
cross posted*
Thanks
Source: http://community.livejournal.com/php/411528.html
-
function only working on some servers
Date: 02/09/06
(PHP Community) Keywords: php, mysql, sql
i've written this function (below), it takes
{TEXT1} dfhdfkldfds;hdsfjsdfsdkfsdjkfhdsfsdjkfhdfjkdsfdsjkhd
{TEXT2} fdkfdhfsldkfhdsfjlkhfdkjlfhdjkfldslkjfhsdhfldsfjhdsf
and converts the swirly brackets to lists, however it works perfectly on my localhost and on my test site, but on server for the production site, it refuses to work. any suggestions?
x-posted between php and php_mysql
Source: http://community.livejournal.com/php/411031.html
-
Eclipse
Date: 02/09/06
(PHP Development) Keywords: php, mysql, browser, sql, apache
Hi all, I recently landed a new job. The people that work there use Eclipse. I have been playing around with it to try and get a feel for it before I start next week and I am running into a couple of problems. I was hoping one of you would not mind giving me some pointers.
I have:
Eclipse Version: 3.1.2 XAMPP very 2.1
I installed Eclipse into the XAMPP directory as instructed.
To my understanding XAMPP will run Apache, MySql, PHP and PERL when the computer starts as I think I set them up as services.
I wrote a little test program using a set of functions that I have been using for a while now. The test program includes a config file that has the full include list in it. For some reason none of my files are being included. I do a require instead of an include, it does not fail but the functions are still not available. I can see the files are the in Eclipse's browser so I am not sure why they are not being found.
There are buttons in Eclipse for starting and stopping XAMPP. These seem to have no effect on XAMPP at all.
Any clues suggestions would be helpful. I have looked on the net all day but have not found anything I can really seem to understand. I have read the help files for Eclipse but they only pertain to Eclipse itself and not the add ons.
cross posted*
Thanks
Source: http://community.livejournal.com/php_dev/65019.html
-
MySQL Version issue with Timestamp
Date: 02/10/06
(MySQL Communtiy) Keywords: mysql, software, sql, web, google
Hi...
I have googled, dev.mysql.com'ed, RTFM and stuff, and I'm a little frustrated, I hope someone here knows the definitive answer.
We developed our web-based software on version 3.23.41 where the timestamp format is YYYYMMDDHHMMSS, I'm sure you know the drill.
Now, we're migrating to a new server, with 4.1.12 and the timstamp default format is %Y-%m-%d %H:%i:%s
The big question: Can I change this version of MySQL (I do have root access) to use the old type of timestamp format?
If so, How? Or, can you point me to a resource that explains it?
Again, I have tried google, dev.mysql.com, etc. I apologize if this is a dumb question, but so far all sources point to it just being the format and nothing I can do. I kinda don't believe that, as it sounds like an inflexibility that would cause other developers to run into problems upgrading....unless of course, I am doing it all wrong!
Any help is appreciated.
Source: http://community.livejournal.com/mysql/85482.html
-
February Boston MySQL Meetup on Mon. Feb. 13th, 7-9 pm. FREE!
Date: 02/12/06
(MySQL Communtiy) Keywords: mysql, sql
The Boston-area MySQL Meetup group is going strong with over 150 members! (20-50 show up each meeting) This month features a change in location, so now we have close subway access AND FREE PARKING. We are supported by MySQL AB, who provides pizza and soda.
This meetup group is totally free. There are benefits including discounts on O'Reilly books (30% off!) and prizes. The topic for the meeting on Monday, February 13th is "So You've Inherited a MySQL Instance". It will be useful for beginners, and experience MySQL users will refresh their memory on what needs to be secured.
It has a unix focus, but most of the ideas can be applied to Windows users as well.
Afterwards, we'll head to the Cambridge Brewing Company for more discussion and chatting.
More details, including the event location, directions and parking, are at: http://mysql.meetup.com/137/events/
I encourage you to sign up for the meetup group, as I may not post here every month.
Previous Boston MySQL meetup presentations can be found under the "Presentations" link at http://www.sheeri.com
Any questions, comments, etc should be sent to me.
You may forward this announcement to other groups, lists, blogs, whatever.
Source: http://community.livejournal.com/mysql/85740.html
-
Beginning with ASP
Date: 02/14/06
(Web Development) Keywords: mysql, database, asp, sql
Hey all,
I'm an idiot when it comes to ASP, just just starting, and don't know VBScript either (which is what this developer used). I'm trying to use some of his code for some other database functions to grab different data (which I've tried to modify it to get) but I don't know where I'm going wrong. It's in SQL, not MySQL, too. Any clues? I need to display a list of Transcripts, where the url is TranscriptURL and the Event Title is sEventTitle. Am I collecting the data wrong? Are the loops/connections messed up?
|
")
end with
'* End the table now.
Response.write ("