
artacus
Members-
Posts
737 -
Joined
-
Last visited
Never
Everything posted by artacus
-
LOL. I wasn't serious. That's funny though. So how come you can't edit the db structure? If its not YOUR database, then I would create another mysql database and import the data into that one. When you do that, change is so you have both the start_time and end_time for each stop. That way you will only have 1 row for each stop. It will make your life easier.
-
[SOLVED] php and postgres help, real easy for vets
artacus replied to Diceman's topic in PHP Coding Help
Well shit man, we apologize for being so inquisitive. Next time if you can't answer simple questions w/o the attitude, then just take you arse to another forum. -
We don't know every detail about your environment and such. We'll give you the big picture "fix" and some details but its up to you to meld that knowledge into your particular situation.
-
Then tell your drivers not to park in the same spot. I don't know then. You may have to pull it back into PHP and calc it there. But I really hate doing that. Let me think about this some more.
-
Ok, I found a resource for you. http://dev.mysql.com/tech-resources/articles/hierarchical-data.html The top 1/3 of the page describes the adjacent model, which is what you are doing right now. But take a look at the bottom 2/3 of the page, The Nested Set Model. That's really what you should be using in your situation. And since the page is mysql specific, all your queries are practically written for you if that's what you're using.
-
Ok, first you should use parent_id instead of parent_name. Its much easier to join that way. (Oops, I see that Barand already mentioned that.) His recursive function will work pretty well for the display page... once you get it working. But for heavier lifting you might need a better data structure. I don't know what your categories are about, but consider a query that might be like "Show all items on the same trunk as the leaf 'fur parka'" So you'd have to find the ultimate parent of 'fur parka' which might be 'coats' and then proceed back down that branch. Its really hard to do w/ a single db query when you don't know how many levels you are going to be nested. There used to be a great tutorial over a phpriot but I don't think they are around any more. You can read more about how to handle nested trees on wikipedia. http://en.wikipedia.org/wiki/Tree_data_structure
-
<?php $array = ("hello","to","you","there"); echo implode(', ', $array);
-
Yeah, were you the same one that asked about this last week? If so I told you it would be a problem then. I'm just shooting from the hip here, but the first thing that comes to mind is to add a stop_number field. So for each vehicle, each day the first stop would be #1. If it is stopped in the same position the next time it is checked then it would be recorded still at stop #1, if it had moved that would be stop #2.
-
Check $_SERVER['SCRIPT_NAME'] it will be different when called directly and when included.
-
[SOLVED] Cropping pictures with GD stretching problem
artacus replied to skyer2000's topic in PHP Coding Help
I see what you're doing, we're just grabbing different parts of the image. The code I pasted (which is why I was faster than you) was for thumbnailing portraits (head shots) so I always had to pull from the center of the image, so I didn't just grab the top of someone's head. -
Heh, you think its godforsaken now, just wait 'till you start running queries against it. Its SLOWWWW. Especially if you are used to counting your query time in milliseconds in mysql.
-
[SOLVED] Cropping pictures with GD stretching problem
artacus replied to skyer2000's topic in PHP Coding Help
Barand... first of all, you're too slow (and I type with my tail BTW) And secondly you're still going to stretch his image because you are not "cropping" it to make it fit that his aspect ratio. -
[SOLVED] Cropping pictures with GD stretching problem
artacus replied to skyer2000's topic in PHP Coding Help
Sure, you're just going to have to figure out if you need to crop from top and bottom or from left and right. $lg_x = 200; $lg_y = 150; $src_img = imagecreatefromjpeg($ph_link); $s_x = imagesx($src_img); $s_y = imagesy($src_img); $temp = imagecreatetruecolor($lg_x, $lg_y); if($s_x / $s_y > $lg_x / $lg_y) { //trim x $x = round(($s_x - ($lg_x * $s_y / $lg_y)) / 2); $y = 0; } else if ($s_x / $s_y > $lg_x / $lg_y) { //trim y $x = 0; $y = round(($s_y - ($lg_y * $s_x / $lg_x)) / 2); } else { $x = 0; $y = 0; } //create large image imagecopyresampled($temp, $src_img, 0, 0, $x, $y, $lg_x, $lg_y, $s_x, $s_y); imagejpeg($temp, $filename); -
Are you using the Merant ODBC driver? Its quirky at best. I don't think I ever found a PROGRESS ODBC driver for *nix. Mine is set up on a Windows box, but it works. 1) Set up a system DSN. Set the isolation level to "READ UNCOMMITED" or it will lock other users out when you are querying tables. 2) In php try something like this $dsn = 'PROGRESS'; $user = 'odbcuser'; $pw = 'password'; $odbc_con = odbc_connect($dsn,$user,$pw,SQL_CUR_USE_ODBC) or die(odbc_error());
-
yep, you need help alright. More than we can give you. I'd suggest trying to use an already developed CMS. Check out Drupal and see if that will work for you.
-
Check that your indexes are being created and updated on the backup. Easiest way is to check that the indexes are "there" and then check all the tables and run optimize using phpmyadmin.
-
Wouldn't you have a separate 'referrals' table with a 1 to many relationship to users?
-
Yeah, I checked it out too. I never made it past the Windows only part.
-
So lets see if I understand... a single voter is going to vote for (up to) 25 teams? It looks like shoz has a pretty good handle on it. But I'd recommend you fill table two with your teams, 0 points and 0 first place votes and then after every vote, run what shoz gave you as an update query.
-
[SOLVED] Need help with displaying subcategories on a webpage using PHP
artacus replied to ycoleman's topic in MySQL Help
LOL. You can't run the query before you build it. $result = @mysql_query($sql,$db) or die(mysql_error()); $sql ="SELECT * FROM tblSubCategory WHERE CatID = `".$thisCatID."`"; change to $sql ="SELECT * FROM tblSubCategory WHERE CatID = `".$thisCatID."`"; $result = @mysql_query($sql,$db) or die(mysql_error()); -
Actually, a more efficient way is: SELECT COUNT(*) FROM yourtable
-
Yet another brilliantly asked vague question. I think what you are trying to ask is, "when a user selects an option from a list, I want a second option list to be populated based on what was selected in the first." If that's the question you just asked, then the answer is, "you do it with AJAX." If that's not the question you asked, then restate it.
-
This really should be done client side in Javascript.
-
[SOLVED] Retrieving database records with next and previous buttons
artacus replied to magga's topic in MySQL Help
I'm a little late for the party, but I use a custom function I wrote for this purpose. Someone may find it useful. [code] function walk($table,$location,$where,$dir=1) { //Walks through a table and returns either the next item or the previous one //$dir 1 = walk forward / $dir -1 = walk backwards //set where_clause for ($i=0; $i < count($where); $i++) { if (current($where) == 'IS NOT NULL' || current($where) == 'IS NULL') { $where_clause .= " AND ".key($where).' '.current($where); } else { $where_clause .= " AND ".key($where)."='".current($where)."'"; } next($where); } //set direction if ($dir > 0) { $gtlt = '>'; $order = ''; } else { $gtlt = '<'; $order = 'DESC'; } $column = key($location); $position = current($location); if (!$position) { $position = 0; } $query = "SELECT $column FROM $table WHERE $column $gtlt $position $where_clause ORDER BY $column $order LIMIT 1"; $result = mysql_query($query); if (mysql_num_rows($result)) { return mysql_result($result, 0); } else { return 0; } } [/code] -
[SOLVED] Need query to return results that start with a specified letter
artacus replied to mhoram's topic in PostgreSQL
SELECT * FROM thing WHERE myfield LIKE 'A%'