Home Page   #c  #ruby-lang  #cisco  #mysql  #apache  #javascript  #java  #perl  #php  #openmoko   Wallpapers Girl
Reliable $1 Web Hosting by 3iX

Channels


#mysql

02 October 2007


Total 26 pages. You are browsing page 3/26.

First :: Prev :: [1] [2] [3] [4] [5] [...] :: Next :: Last

01:31 <****> week-ends days I mean (sat / sun)
01:31 <****> progzy: If you know the number of days, you know for every 7 days there is one weekend (+ or - 1, depending on what you need).
01:32 <****> 2 days yes
01:32 <****> +/-
01:33 <****> Hello?
01:33 <****> progzy: there is a function to get the day of the week as an integer. that's all you need to solve the problem.
01:33 <****> progzy: So without storing any data, you know it's roughly N - ((N*2)/7)... where N is the number of days.
01:34 <****> progzy: and as chadmaynard mentions, days of week and WEEK() can also be used.
01:34 <****> am i doing something wrong? $query = "SELECT image FROM wikinewsies where id=$id"; $result = mysql_query($query) or die("Can't perform Query");
01:35 <****> progzy: Lots of functions are avaialble to pull data you need.
01:35 <****> Grrrrrr...
01:35 <****> Xgc : yes .. roughly .. :\
01:35 <****> Terinjokes: assuming $id is an int no
01:36 <****> progzy: I said roughly, because I didn't want to guess your exact requirement. That calculation can be exact.
01:36 <****> chadmaynard: $id = $_GET['id']; (and ?id=4)
01:36 <****> chadmaynard: see http://www.wikinewsie.org/images.php?id=4
01:36 <****> chadmaynard: and http://www.wikinewsie.org/source.php?url=images.php
01:36 <****> Terinjokes: use or die("Can't Perform Query: ".mysql_error());
01:37 <****> chadmaynard: no error
01:38 <****> Terinjokes: comment out the header temporarily
01:38 <****> how many days differences (taking weekd ends days away and holidays which are in a table)
01:38 <****> chadmaynard: ok
01:39 <****> chadmaynard: still nothing
01:39 <****> Terinjokes: looks like $row['image'] is empty. var_dump($row);
01:39 <****> Xgc : I ve understood I could solve it with one unic table (week ends day and holidays)
01:40 <****> progzy: For every whole number of weeks (7 days) we have 2 work days. For that last partial week (more than 0 days), you can calculate which of those days are in a weekend easily.
01:40 <****> chadmaynard: i got data
01:40 <****> hi all...i'm having trouble using the UNION command: ((SELECT Price FROM Venders) UNION (SELECT Price FROM Locations)); wont work, even though I can select Price from each individual table...is something wrong with my syntax?
01:40 <****> Terinjokes: change mysql_fetch_obect to mysql_fetch_array and put the header back and remove the var_dum
01:40 <****> progzy: The logic is pretty trivial. You might do that in SQL or you might do that in the application. The holiday days can be subtracted easily, as you already know.
01:41 <****> chadmaynard: THANK YOU
01:41 * Terinjokes gives chadmaynard a big cake
01:41 <****> Terinjokes: i take this opportunity to show you this link:
01:41 <****> !tell Terinjokes about images
01:41 <****> Terinjokes http://hashmysql.org/index.php?title=Storing_files_in_the_database
01:42 <****> chadmaynard: i understand the downfalls, but since not everyone editing it is going to be FTP-friendly... figure this was the best way
01:43 <****> Xgc : I must do that in SQL ... that is the problem .. I already do it in PHP but here I need SQL query ... I gonna think of what you said .. thansk
01:43 <****> Terinjokes: as long as you are informed
01:43 <****> chadmaynard: thanks for your concern, if it becomes a problem, i'll change it :D
01:44 <****> Xgc : in PHP I can use loop .. I can note use a loop in a simple SQL query ... (or I don't know)
01:44 <****> *can not
01:44 <****> progzy: For that last part of the algorithm, think about how many weekend days are between monday+0 to monday+4? Well, your SQL can know your start date is a monday and know your remaining days (after dealing with the whole weeks) is some n.
01:45 <****> progzy: The algorithm can be written to handle that start day+remainder in a general way.
01:45 <****> Cannot do prepared statements in triggers. ugh.
01:46 <****> erstazi: Can you call a stored procedure or function from your trigger?
01:46 <****> Xgc: not dynamic sql
01:46 <****> erstazi: Sorry. I don't understand. What's not dynamic?
01:47 <****> Xgc: do you know aoirthoir?
01:47 <****> Not personally.
01:47 <****> hi all...i'm having trouble using the UNION command: ((SELECT Price FROM Venders) UNION (SELECT Price FROM Locations)); wont work, even though I can select Price from each individual table...is something wrong with my syntax?
01:47 <****> Xgc: know of him?
01:47 <****> erstazi: No.
01:48 <****> jbu311: The ()'s are bogus. Other than that looks OK. You might want UNION ALL
01:48 <****> hi all...i'm having trouble using the UNION command: ((SELECT Price FROM Venders) UNION (SELECT Price FROM Locations)); wont work, even though I can select Price from each individual table...is something wrong with my syntax?
01:48 <****> Xgc: either way, we cannot do prepared statements in a trigger or any function or procedure that is called from a trigger
01:48 <****> hmm
01:48 <****> jbu311: The ()'s are bogus (as in optional). Other than that looks OK. You might want UNION ALL
01:48 <****> its just a limitation of mysql
01:49 <****> erstazi: Just asking. That's fine.
01:49 <****> Xgc: I appreciate it
01:49 <****> Xgc: if it would be possible, then this code would be a lot more efficient
01:49 <****> chadmaynard: thanks, i'll try it
01:49 <****> jbu311: are you getting an error?
01:50 <****> chadmaynard: UNION ALL still gives an error...error 1064
01:50 <****> jbu311: the entire error
01:50 <****> chadmaynard: You have an error in your SQL syntax near '((SELECT Price FROM Venders) UNION ALL (SELECT Price FROM Locations))' at line 1
01:50 <****> :-/
01:51 <****> jbu311: oh the outside ()'s cannot be there
01:51 <****> chadmaynard: still no luck
01:51 <****> (SELECT Price FROM Venders) UNION ALL (SELECT Price FROM Locations)
01:52 <****> jbu311: try it without the ()'s
01:52 <****> SELECT Price FROM Venders; works, and so does SELECT Price FROM Locations;
01:52 <****> chadmaynard: i got rid of all parens, still no luck
01:52 <****> chadmaynard: is there some kind of compatibility issue i'm not aware of?
01:52 <****> chadmaynard: I'm not sure how old this version of mysql is
01:52 <****> select version, show current query
01:53 <****> select version(); that is
01:53 <****> ERROR 1064: You have an error in your SQL syntax near 'selction version()' at line 1
01:53 <****> oops
01:53 <****> typo
01:53 <****> ERROR 1064: You have an error in your SQL syntax near 'selction version()' at line 1
01:53 <****> who said selection?
01:53 <****> select version();
01:53 <****> we said select version();
01:53 <****> right, sorry!
01:54 * chadmaynard goes to eat
01:54 <****> 3.23.54
01:54 <****> is that bad?
01:54 <****> kinda.
01:54 <****> MySQL 4.1 or later
01:54 <****> you need at least
01:54 <****> that's an ancient version.
01:54 <****> would UNION not work?
01:54 <****> it might not.
01:55 <****> jbu311: you need 4.1 or later
01:55 <****> erstazi: fark.
01:55 <****> ok thanks guys
01:55 <****> stupid school...
01:55 <****> jbu311: are you a 311 fan?
01:55 <****> used to be


Total 26 pages. You are browsing page 3/26.

First :: Prev :: [1] [2] [3] [4] [5] [...] :: Next :: Last


Tutti i nuovi CAP Italiani. Come ottenere il database completo