|
-
INI handling functions... They were nonexistent as far as I knew...
Date: 10/11/05
(PHP Community) Keywords: php, mysql, database, sql, web
This has irked me for some time: The lack of INI handlers in PHP.
I was moving my website around from host to host, until I settled, and needed a universal standard that I could write on and rely on that would work anywhere as I really wouldn't have a MySQL database everywhere I went. So I wrote this up after not finding a shred of a command for userlevel INI file handling. INI.Lib (Last Built Oct. 3rd, 2004)
I hope some other people can make some use out of it as well I was able to. If you see any major errors or when you use it you can't for the life of you get past a certain bug, let me know and I will see if this one is any real difference from my current build (Apr. 3rd 2005). I may have just patched up a few commands here and there with my build that I caught in the original code and done a few optimizations. If anyone wants the current build, go ahead and drop me a line to cynagen at cynagen dot com, and I'll be more than happy to send you a copy of the current copy on my server; if enough of you report problems, I'll just repackage my current build and post that instead.
(X-Posted on October 10th 19:54)
Source: http://www.livejournal.com/community/php/353909.html
-
INI handling functions... They were nonexistent as far as I knew...
Date: 10/11/05
(PHP Development) Keywords: php, mysql, database, sql, web
This has irked me for some time: The lack of INI handlers in PHP.
I was moving my website around from host to host, until I settled, and needed a universal standard that I could write on and rely on that would work anywhere as I really wouldn't have a MySQL database everywhere I went. So I wrote this up after not finding a shred of a command for userlevel INI file handling. INI.Lib (Last Built Oct. 3rd, 2004)
I hope some other people can make some use out of it as well I was able to. If you see any major errors or when you use it you can't for the life of you get past a certain bug, let me know and I will see if this one is any real difference from my current build (Apr. 3rd 2005). I may have just patched up a few commands here and there with my build that I caught in the original code and done a few optimizations. If anyone wants the current build, go ahead and drop me a line to cynagen at cynagen dot com, and I'll be more than happy to send you a copy of the current copy on my server; if enough of you report problems, I'll just repackage my current build and post that instead.
(X-Posted on October 10th 19:54)
Source: http://www.livejournal.com/community/php_dev/61141.html
-
favorite benchmark utility?
Date: 10/12/05
(MySQL Communtiy) Keywords: php, mysql, sql, apache
I'd like to hear what (if any) you all use for benchmarking.
I'm currently doing some benchmarks for dynamic content on a php/mysql setup between Apache and LightTPD. I'm currently using "siege" but it's not working out as well as I hoped. Any application suggestions are welcome. :D
thanks!
Source: http://www.livejournal.com/community/mysql/70392.html
-
verification
Date: 10/14/05
(PHP Community) Keywords: mysql, sql
I'm trying to do something like:
//Part of code
$data = mysql_fetch_array($result);
if($data['userName']==$userName) {
echo "This user name already exists!
Go back and try another one.";
exit;
So, as you may guess, I need the script to verify if the user with such userName already exists. If not - proceed with the registration. Unfortunately, it seems to say that there's already one such account even if some part of the inputted user name coincide, and I need the rejection of newly entered name only if it's the same as existing one on 100%, not partially. Does someone know how could this be managed?
Source: http://www.livejournal.com/community/php/355113.html
-
Web 2.0 and open source
Date: 10/14/05
(Open Source) Keywords: mysql, sql
Cut through the PR-speak and it reads to me like concern, caution, watch it. Oracle could always buy mySQL, too.
Source: http://blogs.zdnet.com/open-source/?p=470&part=rss&tag=feed&subj=zdblog
-
A quick way to update a lot of rows
Date: 10/15/05
(PHP Community) Keywords: mysql, sql
I've got a list of files in a mysql table. One of the fields is the full path to the file (minus the drive letter). I would like to change the data in that field to just the top level folder rather than full path. Basically I want to get rid of everything after (and including) the first \.
The trouble is I have nearly 18000 records.
What's the quickest & easiest way to go about this?
Source: http://www.livejournal.com/community/php/355676.html
-
JOIN, JOIN LEFT
Date: 10/18/05
(MySQL Communtiy) Keywords: mysql, sql
Hello, I've never used JOIN before and I am having some problems.
I have two tables invoice_main, clients
Invoice Main does not have the client's name in it, only their ID number. My project manager is asking to sort the names alphabetically. I thought I could grab the last name out of clients and append it on to invoice_main .
This is my query:
SELECT invoice_number, invoice_date, due_date, clientid, subtotal, paid_amounts, payment_status, ClientLast FROM invoice_main LEFT JOIN clients ON invoice_main.clientid=clients.ClientID WHERE office_id='1' ORDER BY ClientLast
This is the MySQL error
Column: 'clientid' in field list is ambiguous
SOLVED
Corrected query:
SELECT invoice_number, invoice_date, due_date, invoice_main.clientid, subtotal, paid_amounts, payment_status, ClientLast FROM invoice_main LEFT JOIN clients ON invoice_main.clientid=clients.ClientID WHERE invoice_main.office_id='1' ORDER BY ClientLast
By the way, yes its clientid in one table and ClientID in the other. I didn't create the tables and we are way too far into the project, near the end, to fix it.
Source: http://www.livejournal.com/community/mysql/70503.html
-
moving the database.
Date: 10/19/05
(MySQL Communtiy) Keywords: mysql, sql
I have the RDBMS installed in the "C:\mysql" drive of my server, is there a way to "move" the data to say the "E:\mysql" without having to reinstall the whole RDBMS and reimport the data?
Source: http://www.livejournal.com/community/mysql/70860.html
-
mysql_connect() not connecting, everything's right though.
Date: 10/27/05
(PHP Community) Keywords: php, mysql, database, sql, web
Well guys, I'm truly stumped, and I don't know if you guys can even help me. I've exhausted everything so far, though, so I'm going to try it anyway.
Basically I have this:
which should work just fine as all my other statements are written exactly like that (to interface with my web database) and they work just fine.
I get this error, instead:
Warning: mysql_connect(): Lost connection to MySQL server during query in /data/htdocs/world/RegularSites/iop/events_forum_search.php on line 258 Could not connect
The only thing I can think of that would matter would be that it's a SQL database I'm trying to connect to, and not a MySQL, but there is not sql_connect function or anything like that, only ms sql and m sql... can someone give me some advice on this matter? I'm desperate and under a deadline!
Thanks in adddddddvance!
Source: http://www.livejournal.com/community/php/359304.html
-
Dreamweaver...PHP..MYSQL...LJ ICONS
Date: 10/29/05
(WebDesign) Keywords: php, mysql, database, sql
I want to enter in the locations of each of the LJ Icons I make in a MYSQL database...then have them displayed in rows using PHP....and just a note...I have Dreamweaver MX 2004 but can only get them going down in a column.
Any ideas?
Source: http://www.livejournal.com/community/webdesign/1005594.html
-
Executing code twice
Date: 10/30/05
(PHP Community) Keywords: cms, php, mysql, html, database, sql
I have come across a problem that is driving me mad. I have a php and MySQL CMS and I have a page that extracts the age content (html) out and plops it into the template file and all is sent back to the user. I have now come to the point when I would like to stop some php amongst the body html that is stored for each id in the database. The problem is how to have it recognised as php and then run.
So at the moment, I just extract the in from the database and copy it into a field: $body=$row['body'];
This is then in turn put in the template. I would however like to have this code run and then the result (so the html, plus whatever else has been generated in the middle) is then copied into a field ready for insertion into the template.
Does anyone know of a way to do this? I have seen ways that are meant to have worked, but as yet have not, but I don’t want to note them down as they may cloud people’s ideas.
Thanks for any help.
Source: http://www.livejournal.com/community/php/360920.html
-
Now I'm really screwed.
Date: 11/02/05
(Web Development) Keywords: php, mysql, software, html, technology, database, sql, security, apache
This is a follow up to the post I made before regarding this database connection problem I'm having. (http://www.livejournal.com/community/php/359304.html)
After receiving responses from people that suggested I install the MS SQL PHP functions, I inquired with my IT contact (we are a large institution and therefore have ridiculous amounts of red tape to deal with) as to whether or not they could be installed.
This is what I was told:
We do not support MSSQL odbc connection on our Sun Solaris server running Apache. mssql_connect would require a staff member who knows the technology, purchase of licensed software (which we do not have), and recompiling of Apache that may potentially break other users code. Also, there would be MSSQL security issues if we were to open up or authorize connections to it from our Sun Server, we host a variety of departmental databases on that SQL server, that could be a potentially serious problem if any of our other databases we to be compromised. Sorry for the inconvenience, but that is the story.
If I can't connect to that database, the entire project that I'm working on is going to be fucked and I have a 11/21 deadline. I need to know two things, if any of you can discern from all of this:
1. Is it EVER going to be possible for me to connect to that database? Or should I just stop wasting my time and create another for my personal use?
2. If it is possible, can someone tell me how? :(
Thanks everyone.
Cross posted to PHP/MySQL communities.
Source: http://www.livejournal.com/community/webdev/263959.html
-
user input
Date: 11/02/05
(PHP Community) Keywords: mysql, database, sql, security, spam
for the last few days someone has been testing my various forms to see if they can send 'extra' email headers. stupid spammers...
This got me thinking about ways of 'cleaning up' user input, and I was wondering how other people go about it. I know input validation depends on what exactly the input is (ie guestbook comment would be treated differently to a query string), but in general terms
my current method involves stripping newline characters (\r\n), stripslashes (and then mysql_real_escape_string anything that's going into a database), trim, and strip_tags if need be. I also have some things that use regular expressions to check/remove any unwanted characters etc. I'm probably missing lots of important things, but I seem to be picking stuff up as I go along, and I'm getting quite paranoid about security, which can't be a bad thing. heh.
Anyone else got a different approach, or any general tips/links?
Source: http://www.livejournal.com/community/php/363396.html
-
Now I'm really screwed.
Date: 11/02/05
(PHP Community) Keywords: php, mysql, software, html, technology, database, sql, security, apache
Edit: Thank you all for your help and suggestions. I had a meeting with my server administrators and have found that it would just be easier to dump and import the data into my own little MySQL database. But I learned a lot in this process thanks to you all!
This is a follow up to the post I made before regarding this database connection problem I'm having. (http://www.livejournal.com/community/php/359304.html)
After receiving responses from people that suggested I install the MS SQL PHP functions, I inquired with my IT contact (we are a large institution and therefore have ridiculous amounts of red tape to deal with) as to whether or not they could be installed.
This is what I was told:
We do not support MSSQL odbc connection on our Sun Solaris server running Apache. mssql_connect would require a staff member who knows the technology, purchase of licensed software (which we do not have), and recompiling of Apache that may potentially break other users code. Also, there would be MSSQL security issues if we were to open up or authorize connections to it from our Sun Server, we host a variety of departmental databases on that SQL server, that could be a potentially serious problem if any of our other databases we to be compromised. Sorry for the inconvenience, but that is the story.
If I can't connect to that database, the entire project that I'm working on is going to be fucked and I have a 11/21 deadline. I need to know two things, if any of you can discern from all of this:
1. Is it EVER going to be possible for me to connect to that database? Or should I just stop wasting my time and create another for my personal use?
2. If it is possible, can someone tell me how? :(
Thanks everyone.
Cross posted to PHP/MySQL communities.
Source: http://www.livejournal.com/community/php/363248.html
-
Two questions
Date: 11/03/05
(PHP Community) Keywords: php, mysql, sql
Hello! I am making an online MMORPG using PHP and MySQL. I have two questions.
First off, how would I make a turn system? As in, for example, I can have up to 100 turns at a time. When I use a turn, stuff happens; I get one turn every 10 seconds or so.
For example... I have 100 turns. I use 5. (The stuff the turns do happens.) I now have 95 turns. 20 seconds pass. I now have 97 turns. 40 seconds pass. I now have 100 turns. (Not 101, because 100 is max.)
How could I do something like that using PHP and MySQL?
Secondly, is there a way using PHP (or MySQL) to automatically empty out a certain table at a certain time, even if a page isn't accessed? Like an auto-refresh if you will. I'm thinking that would be on the server, not in a particular script however...because scripts are only run when they're opened.
*Shrugs*
Insight would be helpful. Thank you!
Source: http://www.livejournal.com/community/php/363690.html
-
The Mysterious Case of the Unwilling Variables??
Date: 11/04/05
(PHP Community) Keywords: php, mysql, database, sql
Hi, I'm completely stumped over this. I'm probably missing something quite obvious, and I figure it's to do with using global variables.
There is a file, PostDisplay.php. It loops through an array of posts from the database and prints them out. It is independent of the posts themselves and is called by scripts that specify the posts to be printed. Before the loop are the queries to put the posts into an array and count the number of rows (used in the loop).
$array_post = mysql_query($query_post); $num_post = mysql_num_rows($array_post);
There are two files so far to specify what posts to print. This one, LatestPost.php, works perfectly.
$latest_post = "SELECT * FROM posts ORDER BY id DESC LIMIT 1"; $query_post = $latest_post;
include('PostDisplay.php');
?>
This one, MonthsPost.php, doesn't.
$year = $_GET['year']; # sets the year of the desired posts as a global variable $month = $_GET['month']; # sets the month of the desired posts as a global variable
$month_post = "SELECT * FROM posts WHERE month=$month && year=$year"; $query_post = $month_post;
include('PostDisplay.php');
?>
The global variables $year and $month are set in the script months.inc.php. Excerpt:
November
The error given upon loading MonthsPost.php is: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\phpdev5\www\new\PostDisplay.php on line 4 (Line 4 is "$num_post = mysql_num_rows($array_post);".)
If anyone is brave/bored enough to read all that and help, thank you. ^_^
Edit: Using mysql_select_db in PostDisplay.php has fixed it, and so I've done something silly with the includes elsewhere. Thanks for all the help ^_^
Source: http://www.livejournal.com/community/php/364431.html
-
select question
Date: 11/05/05
(MySQL Communtiy) Keywords: mysql, sql
I have a few tables, one is a collection of test_plans, the other a collection of test_procedures, and a third that joins them. Given the third contains foreign keys to link back to the primary key of a single test plan, and an collection of procedures, how do I select from mysql to determine which procedures have *not* been linked currently to a plan already in the join table?
TIA!
Updated - problem solved!
Source: http://www.livejournal.com/community/mysql/72572.html
-
MySQL query funkiness
Date: 11/05/05
(PHP Community) Keywords: mysql, sql
I've always had trouble with mysql queries and using variables in them (such as, SELECT * FROM table WHERE id=$x). My current weirdness involves several queries--I have the main query. If certain pieces of information pulled from that query are not null, then it goes into a subquery and processes it. The code looks like this:
while ($a_row = mysql_fetch_array($result)) { print "< img src=".$a_row['url']." border=0>< br />"; print "< font size=\"-1\">".$a_row['blurb']."< br />"; print "This photo was taken on .".$a_row['dateofpic']; if ($a_row['event'] != '') { $a_row['event'] = $picevent; $subquery1 = 'SELECT * FROM events WHERE id=$picevent'; $subresult1 = mysql_query($subquery1) or die('Query failed: please try again ' . mysql_error()); while ($suba_row = mysql_fetch_array($subresult1)) { print " during ".$suba_row['eventname']; } }
I've bolded the query that's the problem. I've tried it where:
$subquery 1 = 'SELECT * FROM events WHERE id=$a_row['event']';
but that doesn't work--nothing shows up then. With the current query I have, it at least executes the above previous stuff before giving me an error. Any thoughts?
Source: http://www.livejournal.com/community/php/364998.html
-
ZEROFILL + PHP octal notation
Date: 11/11/05
(PHP Community) Keywords: php, mysql, sql
Does PHP think numbers stored in MySQL tables with ZEROFILL are octal numbers?
For example, suppose I have a column INT(4) ZEROFILL and I insert the number 346 using PHP. MySQL turns that into 0346 - which is octal notation in PHP. Is it now going to treat 0346 as an octal number in math calculations?
Source: http://www.livejournal.com/community/php/366491.html
-
Calculate Time Difference
Date: 11/11/05
(PHP Community) Keywords: php, mysql, sql
I am using this code to calculate hours:
$hoursITEM = (strtotime($end_time) - strtotime($start_time))/3600;
We want to use "24:00" midnight (military time)at the end of a shift. Unfortunately this results in an error.
Whats the best way to handle this?
*** Whatever I decide to do it's going to effect this MySQL query
$Query = "SELECT invoice_number, sum(((TIME_TO_SEC(end_time) - TIME_TO_SEC(start_time))/3600) * rate) AS subtotal FROM invoice_items WHERE office_id='$office_id' AND service_type!='225' GROUP BY invoice_number ORDER BY invoice_number";
Thanks for your help...
[More thoughts]
I guess we could use 00:00 and then absolute value to get rid of the negative... As long as I can do that with the Query too.
Shoot - 00:00 is interpreted as 0... 00:00 - 06:00 = -6. For the PHP I can juggle it to work. "if "24:00" yada yada
[After doing some test with MySQL] I guess I dont have to worry about MySQL, its computing:
sum( ( TIME_TO_SEC(24:00) - TIME_TO_SEC(06:00) )/3600 )
as 18 hours.
I guess I can accomodate for the PHP because that part is for display on one page.
After we can wipe out a series of bugs we are going to go back and add an end date. We just need to get this functional for the time being.
Source: http://www.livejournal.com/community/php/366221.html
|