
bqallover
Members-
Posts
111 -
Joined
-
Last visited
Never
Everything posted by bqallover
-
Strange. I've ran this again, using the query that didn't work for you. The only difference is the table name (missing an 's') and I named the field 'date' instead of 'day', as in the field definitions in your first post. I've included some version information to help, but it worked for me. [pre] Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 to server version: 4.1.11-nt Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> use datetest Database changed mysql> show create table torder; ... snip ... CREATE TABLE `torder` ( `date` int(11) default NULL, `month` varchar(11) default NULL, `year` int(11) default NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ... snip ... 1 row in set (0.00 sec) mysql> SELECT STR_TO_DATE(CONCAT(date,' ',month,' ',year), '%e %M %Y') as modate FROM torder ORDER BY modate; +------------+ | modate | +------------+ | 2004-04-01 | | 2006-11-07 | +------------+ 2 rows in set (0.00 sec) [/pre] Are your field types the same as the ones I've used? It's a long shot, but apart from having an old server version, which you don't seem to have, that's all I can think of. [edit] Misread your FreeBSD version as MySQL version. As fenway suggests, that may be the problem [/edit]
-
sir william is right, you should add a new field, but the above script will work. ;D
-
This query should work, had to double up on the str_to_date function as it wouldn't recognize 'modate' as a column in the select... fair enough!... SELECT STR_TO_DATE(CONCAT(date,' ',month,' ',year), '%e %M %Y') as modate, DATE_FORMAT( STR_TO_DATE(CONCAT(date,' ',month,' ',year), '%e %M %Y'), '%W, %M %e, %Y') as datestring FROM torder ORDER BY modate; ...will give you something like this... [pre] +------------+---------------------------+ | modate | datestring | +------------+---------------------------+ | 2004-04-01 | Thursday, April 1, 2004 | | 2006-11-07 | Tuesday, November 7, 2006 | +------------+---------------------------+ 2 rows in set (0.00 sec)[/pre] Phew! That was a slog. :)
-
What you want is something like this in your HTML... [code] <img src="imagecreator.php"> [/code] ...where imagecreator.php is the script that actually outputs the image. You can of course pass in GET variables on a quiery string like... [code] <img src="imagecreator.php?bgcol=white&fgcol=green"> [/code] ...which is nice! :)
-
Correct way to get mysql results into an array in a class
bqallover replied to littlened's topic in PHP Coding Help
Have a look at using [url=http://uk.php.net/manual/en/function.mysql-fetch-assoc.php]mysql_fetch_assoc[/url] instead of mysql_fetch_array. -
Had a look around about this problem and I might have found a solution at [url=http://www.issociate.de/board/post/219822/PHP_MSSQL_connection_problem..html]http://www.issociate.de/board/post/219822/PHP_MSSQL_connection_problem..html[/url]. Particularly this bit... [quote] So ... for anyone easy that is have the same problem, I made the follow registry entry on my local server: HKEY_LOCAL_MACHINE\SOFTWARE\M=ADicrosoft\ MSSQLServer\Client\ConnectTo] DSQUERY=3DDBNETLIB and then in my php.ini in the MSSQL area I set: mssql.secure_connection =3D Off [/quote] Not sure if you'll have authority to make those changes on the server - and DEFINITELY can't vouch for their security (not a Windows guru), but it seemed to work for that guy. BTW, I don't know if that's your real DB username and password, but it's generally good policy not to post it - even if the chances of someone knowing your server address are unlikely! :)
-
How to insert things into a MySQL database with an ' in?
bqallover replied to oskare100's topic in PHP Coding Help
There are a few ways to fix this. One way is to run addslashes on each variable you pass to the query... [code] addslashes( $row->address_street ) [/code] Then run stripslashes on them when you retrieve them -
I tend to use heredoc syntax when a fair bit of HTML is being used. It cuts out headaches about double and single quotes. [code] echo<<< END <a href="#" class="red_bold_none" onClick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://dynamicdrive.com');">Homepage</a> END; [/code]
-
That shouldn't be a problem. It all depends on how you are parsing the xml. If you are using $counter as some kind of index into the xml, then you can just do [code] for ($counter = 51; $counter <= 1000; $counter++) [/code] On the other hand, if $counter is just loop-counter, you'd might need to rethink a little bit. What are you using to parse the rss? Using a library such as [url=http://magpierss.sourceforge.net/]MagpieRSS[/url] would probably make this quite trivial.
-
Image creation: create text from included file
bqallover replied to poorman's topic in PHP Coding Help
Instead of [code] $foo = include($incFile); [/code] use [code] $lines = file($incFile); // Read file into an array of lines $foo = $lines[0]; // Get first line [/code] -
Interesting notion - one I was thinking about recently too. As the previous posters say, I don't think it's possible [i]per se[/i] However, one approach might be to make your flash object/stage larger than it's contents, large enough to contain a dropped-down menu. Then give it a transparent background. Then use CSS to place HTML on top of the transparent flash area. I don't know if this works and even if it did there are overheads from having transparency, but it's certainly how I'd go about it...
-
A quick search on Google turned up [url=http://webstyleguide.com/index.html]Web Style Guide[/url], which has a good section on general planning and where to start.
-
I generally use the second form, and have header.php, footer.php and maybe other "output includes" if the project requires them. There's no [i]real[/i] problem with first form, though as you say it can be a little overkill sometimes. Unless you're using a database to store the content (and hence bordering on the CMS/blog scale of things), you'll probably have separate files anyway for each page so there's no [i]real[/i] advantage to my mind. In practice, I've done a number of sites where I use [url=http://www.pivotlog.net]Pivot[/url] as either a blog or news engine (i.e. the second form) and embed that on one page of a more traditional site (i.e. the first form). So as in most things, combining the two is often a good approach. ;)
-
The default path is set as "language/" in the function parameter on the line below. [code] function SetLanguage($lang_type, $lang_path = "language/") { [/code] Bear in mind though that this will be relative to the directory containing class.phpmailer.php, so if your language files are in the same directory as class.phpmailer.php, you should set this to "./". Another suggestion might be to reinstall the latest phpmailer files on your site. As before though, I'm not sure how much help this will be, but if the problems discussed on the mantis site have been resolved and patched then it *might* help.
-
Good luck - and thanks for getting me over the 100 mark! ;) <----
-
OK, I've been looking at the class.phpmailer.php code and all I can suggest is checking the location of your "phpmailer.lang-*.php" files. It appears to look for them in the 'language/' subdirectory, though mine are in the PHPMailer root directory. You could try manually changing the line at class.phpmailer.php (596, in my file) giving it a correct $lang_path. Still, if you haven't changed anything, I have to shrug my shoulders and suggest contacting your host, to see if they have. Sorry!
-
Ok, one last throw of the dice. This is even WORSE than the above suggestion, but it might just work. :) Replace your form code with this... [code] $query = mysql_query("SELECT item_id, name, descr, qty, price FROM tbl_items"); while($r = mysql_fetch_array($query)) { $id = $r['item_id']; echo' <tr> <td><input type="checkbox" name="id[]" value="'.$id.'"></td> <td>'.$name = $r['name'].'<input type="hidden" name="hid_name_'.$id.'" value="'.$r['name'].'" /></td> <td>'.$descr = $r['descr'].'<input type="hidden" name="hid_descr_'.$id.'" value="'.$r['descr'].'" /></td> <td>'.$qty = $r['qty'].'<input type="hidden" name="hid_qty_'.$id.'" value="'.$r['qty'].'" /></td> <td>'.$price = $r['price'].'<input type="hidden" name="hid_price_'.$id.'" value="'.$r['price'].'" /></td> </tr>'; } [/code] Then replace your foreach with this... [code] for( $x = 0; $x < count( $_POST['id'] ); $x++ ) { $id = $_POST['id'][$x]; echo $id . '<br />'; echo $_POST['hid_name_'.$id] . '<br />'; echo $_POST['hid_descr_'.$id] . '<br />'; echo $_POST['hid_qty_'.$id] . '<br />'; echo $_POST['hid_price_'.$id] . '<br />'; } [/code]
-
It seems this has come up before, just as enigmatically. See [url=http://mantis.tincan.co.uk/view.php?id=5385]http://mantis.tincan.co.uk/view.php?id=5385[/url] for more information, and view the related bug [url=http://mantis.tincan.co.uk/view.php?id=4756]http://mantis.tincan.co.uk/view.php?id=4756[/url] for a possible fix.
-
LOL. This is going to be so ugly it's unreal... [code] for( $x = 0; $x < count( $_POST['id'] ); $x++ ) { $id = $_POST['id'][$x]; echo $id . '<br />'; echo $_POST['hid_name'][$id] . '<br />'; } [/code] I'm going to have a red face if someone points out an obvious way of doing this. The DB way REALLY is the best as all these other solutions assume I know exactly what you're doing, which I don't. :) Try it anyway.
-
[quote author=dwest link=topic=123624.msg511199#msg511199 date=1169543362] For the sake of myself and other neophytes, could you explain what is going on with your solution? I'd like to learn how to arrive at these answers on my own :) [/quote] Which one? :) Actually can you post the fixed version that worked for you?
-
Sorry, this is the right way to do this! <slaps own head> [code] foreach( $_POST['id'] as $id ) { $query = mysql_query("SELECT name FROM tbl_items WHERE item_id='$id'"); while($r = mysql_fetch_array($query)) { echo $id . '<br />'; echo $r['name'] . '<br />'; } } [/code]
-
I see. Try this instead of the double-foreach block you posted. Not 100% sure if it'll work but hey... :) It's a bit of a kludge. [code] for( $x = 0; $x < count( $_POST['id'] ); $x++ ) { echo $_POST['id'][$x] . '<br />'; echo $_POST['hid_name'][$x] . '<br />'; } [/code] edit: Actually sorry, I don't think that'll work at all. Let me think...
-
I need a bandwidth monitor and access controller php server tool.
bqallover replied to PP-Stuart's topic in PHP Coding Help
I think the best way to go about this is with a database table, containing either a running total for each user based on a time-period of your choosing, or an entry for every download (which might get quite big depending on your traffic :) ). When a user is about to download (or preferrably afterwards) you would update that table with the size of the download, either adding it to the running total or making a new entry. With such a system in place, you could easily write some SQL-based reporting scripts, perhaps even with GD-generated graphs? As ShogunWarrior says though, some kind of server extension might be more appropriate, but if your application isn't massive-scale the benefits of databased logging might outweight the overhead. -
Keep track of users logged into the system: PHP
bqallover replied to 9911782's topic in PHP Coding Help
The usual way to do this if you're using a database is to create a table called something like 'active_users', with columns like 'user_id' and 'login_time'. When a user logs in, you INSERT them on to the table with a current timestamp and when they log out you DELETE them from that table. You can then do a query on the most recent timestamp to get the most recently logged in user id, or just do a "SELECT user_id FROM active_users ... ", doing a join on your 'users' table for names, to get all currently logged in users. There are probably other ways, but that's the what I've seen most often. -
Your code is working logically as one would expect. The inner foreach will run exactly the same each time, giving you the same results. Can you post the corresponding HTML form section so we can get a better picture of what you're trying to do?