Jump to content

TapeGun007

Members
  • Posts

    307
  • Joined

  • Last visited

Everything posted by TapeGun007

  1. I need an SQL command, well, like this: SELECT * FROM Calendar WHERE Cal_Date='$temp_date' Cal_Date is equal to xx/xx/2010, but I only want the 2010 to be compared to $temp_date, how can I do that?
  2. Hey, this is great info, thank you. I may end up writing my own gallery with all this info, it's very helpful.
  3. I'm not asking anyone to code this for me, but I don't know where to start looking. Any URL's would be appreciated. What I want to do, is have a php page where I can upload an image. PHP will automatically resize the image, create a thumbnail image AND upload both of those. Then I would want a photo gallery to view the pictures. Can someone just steer me in the right direction? Thanks!
  4. I don't know if this will help you at all, as it appears you are looking really for an SQL solution, not a php solution. Which, if that is the case, you may wish to post in that section of the forum instead. Here is a piece of code I used on a website to put New Members (30 days old or less) into a different listing: /* Set a date back 30 days ago */ $date = date("m/d/Y"); $newdate = strtotime ( '-30 day' , strtotime ( $date ) ) ; $newdate = date ( 'm/d/Y' , $newdate ); echo $newdate; /* $newdate is now 30 days in the past, new accounts cannot be more than 30 days old */ Then you could do something like WHERE promotions.expiry > $newdate
  5. <? while ($row = mysql_fetch_array($result)) { ?> echo "<option value=\"".$row['name']."\">" .$row['name']."</option>"; //<option value="<? echo $row['name']; ?>"><?php echo $row['name']; ?></option> <? } ?> Should be: (take spaces out between single quotes and double quotes, I put them there only so you could see better) <? while ($row = mysql_fetch_array($result)) { echo "<option value=' ".$row['name']." '>".$row['name']."</option>"; } ?>
  6. I did change one line of code actually to streamline the size of the file, just an FYI for noobs like me. $All_Files[$y]['FileSize']=$File_Size; To this: $All_Files[$y]['FileSize']=number_format($File_Size,2)." MB"; Now I get this on the output: It just looks nicer.
  7. glob() wasn't the answer, it was far from it actually. I read up that, and it didn't apply to what I was trying to accomplish really. My question was really that of syntax in storing to the array, and nothing seemed to spell out exactly what I needed. I finally figured it out, and thought I'd post it here in the event someone ever needed this. <?php if ($handle = opendir('Music_Library')) { $y==0; /* Read the files in the directory, then store it in an array to sort it alphabetically */ $All_Files = array(); while (false !== ($file = readdir($handle))) { /* Weed out the . and .. for going up one directory, so this keeps those from showing */ if ( $file != '.' && $file != '..' ) { $y++; $File_Size=filesize('Music_Library/'.$file); $File_Size=$File_Size/1048576; $All_Files[$y]['FileName']=$file; $All_Files[$y]['FileSize']=$File_Size; } } closedir($handle); sort($All_Files); print_r($All_Files); } ?> My output shows just as I wanted it to: Now if there is a better way to accomplish this, then by all means enlighten me! :-)
  8. Yes, there is a folder called "Music_Library". There are many .mp3 files and such in there. I want to capture the filenames AND file sizes into a multidimensional array For example: $All_Files [Filename1]="Tigger.mp3" [Fillesize1]="10 MB" $All_Files [Filename2]="PooBear.mp3" [Filesize2]="5 MB" $All_Files [Filename3]="Christopher.mp3" [Filesize3]="15 MB" If I can simply store this type of information into an array as listed above, I can figure out the rest. The problem is, my code doesn't work, it doesn't store anything into the array. My code does spit out the filenames and sizes because I tested that already.
  9. Yes, I know... that's the easy part. My code above does NOT work. I'm asking how to store those variable file names into an array, THEN sort it. The code above is not storing the values into the array, because my syntax is incorrect. That is what I'm asking for help on.
  10. Yeah, that's not really the issue. I'm not storing the filenames and filesize correctly in the array...well... at all actually. I suppose (after further reading) I could create two arrays one for the filename and filesize, then merge them, sort, and then spit out the results....
  11. Here is my code, and I have no clue what I'm doing with this array because I cannot seem to find an article that displays what I'm trying to do. $All_Files = array("Dir_Files" => array(FileName,FileSize)); while (false !== ($file = readdir($handle))) { $File_Size=filesize('Music_Library/'.$file); $File_Size=$File_Size/1048576; $Dir_Files['$File_Name']['$File_Size']; } My problem is that I don't understand the syntax that I need here. What I want to do is 1) Dump the file names of a directory into an array, and store the filesize 2) Sort the filename alphabetically.
  12. Collation is utf8_general_ci Using MyPHPAdmin, I checked the data and cut and pasted right out of the db: So... the data in there is fine.
  13. In .asp (classic) I used this code: sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("\db\Choir.mdb") Set recordset = Server.CreateObject("ADODB.Recordset") IF Request.QueryString("NewsID") <> "" THEN intID = Request.QueryString("NewsID") Recordset.Open "News", sConnString, 1,2,2 Recordset.Filter = "NewsID = '" & intID & "'" Recordset("NewsDate") = Request.Form("fNewsDate") Recordset("NewsTitle") = Request.Form("fNewsTitle") Recordset("News") = Request.Form("fNews") Recordset("NewsWriter") = Request.Form("fNewsWriter") Recordset("ShowNews") = Request.Form("fShowNews") sMessage = "News Article Succesfully Updated!"
  14. Can you post the snippets of code?
  15. ARG, I should've posted what I already have: $result = mysql_query("SELECT * FROM News WHERE ShowNews='Yes' ORDER BY News.NewsDate DESC , News.NewsID DESC"); while($row = mysql_fetch_array($result)) { echo "<tr><td background='images/news_header.gif' class='ContentWhite'> <b>".$row['NewsTitle']."<b></td><td background='images/news_date.gif'>".$row['NewsDate']."</td></tr>"; echo "<tr><td background='images/news_main.gif' colspan='2'>".$row['News']."</td></tr>"; echo "<tr><td colspan='2'><b>-".$row['NewsWriter']."</b></td></tr>"; } This is the output that I get: �The breath isn�t that important.� �are you still reading? Good. Now let me explain my reasoning for saying such a blasphemous thing. See those funny characters? They are quotes and apostrophies stored in $row['News']. This is why in .asp I used recordsets instead of SQL to pull that information from the memo field.
  16. I need help converting something very simple from ASP (classic). Here is the ASP code: <% DO While NOT recordset.EOF %> <tr><td colspan="3">Posted On: <%=recordset("NewsDate") %></td></tr> (Populate a table from Access Database here) <% Recordset.MoveNext Loop %> Basically, instead of using SQL to access the db, I used a recordset. Why? Because this is a memo field that stores news information. In the news memo field, it stores apostrophies, and quotation marks. Thus, using SQL to retrieve that information causes a problem on output. What is the PHP equivalent? As a recap, I have a memo field that stores lots of text with apostrophies and quotes. I need to be able to pull the information out of the memo field without using SQL. How can I do this?
  17. I don't want to order by the Group Name though, I want it to order by the group name alphabetically, but if there's a sub group, put that under the main group in alphabetical order. The "Output" listed above is what I want it to do.
  18. And maybe sub queries aren't the answer. I'm just trying to figure out if I can just take care of this in mySQL rather than manipulating an array of strings or something. Table: Groups Group_ID | Group_Name | Parent_Group_ID --------------------------------------------------------- 1 Science Null 2 Math Null 3 History Null 4 Algebra 2 5 Geometry 2 6 Calculus 2 7 Art Null There are two groups here in this table, Parent Groups, and Sub Groups. Math is a parent group. Alegebra, Geometry, and Calculus are sub groups of the parent group Math. I want to create a table that would look like this, but I need the SQL (if possible) to make it come in this order. Output: Art History Math Algebra Calculus Geometry Science
  19. Thank you mjdamato, I learned a lot from looking up your SQL commands and reading about them. It was a great guide in helping learn SQL syntax than just FROM, WHERE, and ORDER BY. Hehehe.
  20. As far as I can tell, I actually did it in 3 tables, and I'm not replicating any information, thus wasting space.
  21. To answer your question: 1) Some users are not assigned to any departments 2) Some users are assigned to a Department but not a sub department 3) Some users are assigned to a Department that has no sub departments. 4) Sub Departments can be assigned to a Department before a user is assigned to it. Now, because I'm no expert, I came up with, I *think* a better way of doing this whole thing. Check out this table idea I have. What if I just simplified the Departments table to include actual sub-departments and add a Parent_Dept_ID instead? Now you can see that Bob is a part of Department Music, and "Sub Department" Chorale which is under the Music Department. He is also a part of the History Department which has no sub departments. Alex is a part of the Business Department and the Accounting sub department. I think this table will actually suite my needs better and would be easier to manage with mySQL, don't you think?
  22. Ok, just to recap, and just to make sure (for my sake) there is a one to many relationship between Table:Users -> Table:Departments and then a one to many relationship between Table:Departments -> Table:Sub_Departments. I see what your are saying here, and it makes sense. However, because I've never used a "3rd table", I'm not certain how to go from your example here to adding in that 3rd table. How does the 3rd table tie into your example, mjdamato?
  23. No, some users will not belong to any department at all. Some departments will not have sub-departments either. Does this change anything in your example to me?
  24. Forgot to mention, it's mySQL Version: 5.0.45, and I use phpAdmin. I'm used to using Access, not mySQL and phpAdmin, so I'm a bit new to this as well.
  25. I had a similar experience, but I ended up using a different output method on Bullzip. I think it was outputting to a comma delimited file, and was able to import that way. Worth a try anyway?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.