Jump to content

JD*

Members
  • Posts

    230
  • Joined

  • Last visited

Everything posted by JD*

  1. You can also try a round(), which will accept the number and a digit limit.
  2. I'm trying to set up a page that will use the prototype ajax.updater to update table cells. This is for an election, so I have a gird that has the candidate names across the top and the polling district along the side. What I'd like is for this page to watch another page, which will query my db every x seconds and pull the results. Then, if there is a change, have the first page see that change and update the appropriate table cell (possibly with the effect.highlight). I have the table set up, and every cell has an id of the location_candidate (numerical ids) and I was following a tutorial on making a digg spy clone, but I got a little lost, so if anyone can help me on the way, I would much appreciate it.
  3. Try this: <?php print "<table width=\"800\">"; print "<tr>"; for($i = 0;$i < mysql_num_fields($data);$i++) { print "<th>" . mysql_field_name($data, $i) . "</th>"; } print "</tr>"; for ($i = 0; $i < mysql_num_rows($data); $i++) { print "<tr>"; $row = mysql_fetch_row($data); for($j = 0;$j < mysql_num_fields($data);$j++) { if(mysql_field_name($row[$j]) == "your_field_name_here") { if($row[$j] >= 2.9999) { $class=" class=\"red\""; } } echo("<td $class>" . $row[$j] . "</td>"); } print "</tr>"; } print "</table>"; ?>
  4. Depends on what is in your PHP.ini. The <? are called "short tags" and in some cases are switched off for added security, thus you must use <?PHP.
  5. It prints information to the screen
  6. $qry = "UPDATE table SET address='$address', phone='$phone', lat='$lat', $lng='$lng' WHERE id = $id"; Reason it's messed up is because you have $lng=$lng. Change it to lng=$lng
  7. It's call lightbox, and it's a javascript effect http://www.huddletogether.com/projects/lightbox2/
  8. I'm not sure, but try changing $_POST[submit] to $_POST['submit']
  9. Hello everyone, I'm looking for a simple example of a digg-like comment fetcher to use on my site. I have a bunch of news articles that I want to make editable when you click on the title...right now, it looks like a list: Article 1 Article 2 Article 3 And when you click on any of those, it does a slidedown to reveal: Article1 Edit Delete Article 2 Article 3 So what I'd like to do is replace the "Edit" part with my tinymce instance, do a DB query to grab the entry for the supplied ID, and then present it, along with the delete button. If someone can point me in a direction for this, I'd be very grateful...just having trouble figuring out a way to start.
  10. Where are you pulling "time" from? It could be as simple as: $result = mysql_query("SELECT * FROM database WHERE date > '2007-11-10' AND date < '2008-01-07'"); But it all depends on how you are getting your ranges
  11. change this line: $result=mysql_query($sql); to this $result=mysql_query($sql) or die(mysql_error()); To see if you're receiving an error
  12. if((($error == 0)&&($error2 >0)) || ($error == 0) || ($error2 > 0))
  13. Check out this reply: http://www.phpfreaks.com/forums/index.php/topic,187150.msg839078.html#msg839078
  14. O.k., in that case, I would say you need a second page (call it image.php), that will accept an ID and do this: [code]<?PHP if(isset($_GET['id'])) { include ("condb.php"); $query="select * from subject WHERE ID = '".$_GET['id']."'"; $result=@mysql_query($query,$con) or die(mysql_error()); header("Content-type: image/jpeg"); echo $result['Image']; } else { echo ''; } ?> And then, on your main page, do: //view all subjects with the images. <?php include ("condb.php"); $query="select * from subject "; $result=@mysql_query($query,$con); $result = mysql_query($query) or die('Error, query failed'); while ($result2 = mysql_fetch_array($result)) { echo $result2['ImageTitle']."<br />".$result2['ImageSubject']."<br /><img src=\"image.php?id=".$result2['ID']."\" /><hr />"; } mysql_close(); ?> That (or something very similar) should work for you.[/code]
  15. Try this: $hex1 = "\x8"; socket_write($socket, $hex1); //this works! $hex = "8"; $hex2 = "\x".$hex; socket_write($socket, $hex2); //this one doesn't, but I need to be able to do this.
  16. what are your seasons that you want to change it on? You can use the date command to find out the current date,time, month, etc and then compare it to your pre-made selection, ie: <?php if(date("m") >=11 && date("m") <=04) { //winter } elseif(date("m") >=05 && date("m") <=06) { //spring } elseif(date("m") >=07 && date("m") <=10) { //summer } else { //fall } ?>
  17. depending on how you are formatting it, why not just include the same navigation twice, but wrap it in a different div tag and use css to style it differently?
  18. You can always add this to the top of your page: <?php error_reporting(E_ALL ^ E_NOTICE); ?> This will report any errors (I'm guessing error reporting is shut off if you're only seeing a blank page right now), and then you can remove it when you're done developing your site.
  19. Are you storing any information about the pictures into a database?
  20. As far as I know, you cannot use the "header" function after you have already sent data. What you want to do is this: //view all subjects with the images. <?php include ("condb.php"); $query="select * from subject "; $result=@mysql_query($query,$con); $result = mysql_query($query) or die('Error, query failed'); while ($result2 = mysql_fetch_array($result)) { echo $result2['ImageTitle']."<br />".$result2['ImageSubject']."<br /><img src=\"".$result2['Image']."\" /><hr />"; } mysql_close(); ?>
  21. The major problem I see is that welcome.php does not have a <? session_start(); ?> at the very top....every page that will reference a session needs to have that as the first thing on the page.
  22. You would put in a link to your profile page along with a url variable with the submission id and then, on your profile page, it would use that ID to get and display your info from the database while($info = mysql_fetch_array( $data )) { Print "<p><a href='profile.php?id=".$info['submission_id']."'>".$info['col_2'] ." <img src='/imgs/bg/boats.jpg' width='73px' />".$info['submission_id'] . "</p>";
  23. Please see my last post, it has a newer query build in it and it shows how to wrap the code in an if statement so that is shows the result only when your form has been submitted
  24. I think ORDER BY has to be the last thing in the query, even with a join
  25. O.k, so here is how I would do it: Have a page with a form on it that will accept the video ID. When they submit, have it submit to the same page and it should do the following: Check to see that the youtube video exists. Figure out the URL to the flv file on youtube (check the source) Use popen() to wget the file, do the ffmpeg conversion. popen is useful because it will launch a process in the background, which means that the page doesn't need to stay open for this to keep working. I'd suggest writing a perl script to do the wget and ffmpeg commands, and have PHP to a popen on the perl script. (this is how I've gotten it to work in the past). Finally, when done, have it put the URL into a database, or move it to a new folder, or whatever you need so that it can be displayed on your website. The page itself should follow a form like this: <?php if(isset($_POST['Submit']) && $_POST['Submit'] == "Get It") { // Do your popen on the perl script here, along with anything else } else { //Put your form code here, along with a Submit button with a "value" of "Get It" } ?> This will allow you to do everything on one page.
×
×
  • 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.