Jump to content

mikesta707

Staff Alumni
  • Posts

    2,965
  • Joined

  • Last visited

Everything posted by mikesta707

  1. Ok well if it is printing the cars, that means it got the Car category Id number correctly. That means that out of the following code while ($row = mysql_fetch_assoc($sql)){//this will loop through all entries in mysql result $id = $row['catid'];//this is right $name = $row['catname'];//this is wrong echo "<li>$name</li>"; make sure that $name is being set to the right value. Check to make sure catname is the exact column name. now for the bikes, as long as it is in the table, it should loop through it. Try adding the following echo "We have entered the main loop"; after the line with the first while() on it. that should echo two times. If it doesnt then there is a problem with the SQL
  2. Well, as it is an RSS feed, you can really just let people subscribe to it. Just make a link to the rss file, and most browsers will be able to handle letting people subscribe to it. There are also buttons you can get from google/yahoo etc. to let people put your feeds in their igoogle, my yahoo, msn accounts
  3. hmm that usually means that the SQL syntax is wrong, resulting in the. Try changing $sql = mysql_query("SELECT catid FROM category WHERE catname='Cars'");//This will get the cars catid for use in gettings cars out of the second to $sql = mysql_query("SELECT * FROM category WHERE catname='Cars'");//This will get the cars catid for use in gettings cars out of the second also, at the end of every query write or die('ERROR'.mysql_error()); that will give you what mysql errors are happening
  4. hmmm. Yeah this got me stumped. I've been looking at the rss2html.php page and that seems to want to take the rss feed and make it into html. Its kind of ridiculous but from what I can tell, the ?XMLFILE=http://www.comicnoobs.com/news/?feed=rss2" part of the include tells the page which rss feed to parse. this is a real real long shot, but on line 29 of rss2html.php, try changing this line $XMLfilename = "sample.xml"; to $XMLfilename = $_REQUEST['XMLFILE']; Remember to back up the original page that. That might just break everything horribly. Sorry if that doesn't help, this really got me stumped =(
  5. this is your incrementation code yes: while($myrow = mysql_fetch_array($result)) { print $myrow[1]."/".$myrow[0]."^"; print $myrow[2]."^"; print $count."^"; $count++; } to make a decremental, try something like $count--; or something like that. you may have to do a little more than that though. Post the entire code that goes through the menu if you can
  6. Hmm, well if your sure all the files are in the right place im not sure... however try this, On line 103 in the file you gave me change this: <?php include("rss2html.php?XMLFILE=http://www.comicnoobs.com/news/?feed=rss2"); ?> to the following <?php include("http://www.comicnoobs.com/news/?feed=rss2"); ?> OR <?php include("rss2html.php"); ?> and see what happens. It may also be helpful to see the page rss2html.php and news/index.php (if there is one) Hope that helps
  7. ok so I assume that the cars in your subcategory table have a catid thats the same as cars. Ok so first we do a simple query $sql = mysql_query("SELECT catid FROM category WHERE catname='Cars'");//This will get the cars catid for use in gettings cars out of the second data base $row = mysql_fetch_assoc($sql); $id = $row['catid']; Ok now we have the catid of the Cars entry in the table category. We want to use this catid to get all the cars in the other table named subcategory. So we do the following $sql2 = mysql_query("SELECT * FROM subcategory WHERE catid='$id'"); $row2 = mysql_fetch_assoc($sql2); $name = $row2['subname']; Ok cool so now we can get the first entry in the subcategory table that has the same catid as the Car entry. So now we want to loop through the entire table, and get all the categories, and subcategories in those categories. Well consider the following code $sql = mysql_query("SELECT catid FROM category WHERE catname='Cars'"); while ($row = mysql_fetch_assoc($sql)){//this will loop through all entries in mysql result $id = $row['catid']; $name = $row['catname']; echo "<li>$name</li>"; //now lets access the subcategory table $sql2 = mysql_query("SELECT * FROM subcategory WHERE catid='$id'"); //and we do another loop to go through all the results from the above query while ($row2 = mysql_fetch_assoc($sql2)){ $name2 = $row2['subname']; echo "<li>$name2</li>"; }//end subcategory loop }//end category loop There that should do what you want it to. Hope that helps!
  8. SQL injection prevention tutorial. I assume this is around what you want http://www.tizag.com/mysqlTutorial/mysql-php-sql-injection.php this is also a good guide that shows how to make a secure login script (both php4 and php5) http://www.phpeasystep.com/workshopview.php?id=6
  9. Or you can do what lil jerk says, but instead of putting it into a text area, output it to the screen. consider the following $filename = "CURRENT FILE HERE"; $h = fopen ($filename, "r"); $contents = fread ($h, filesize($filename)); fclose ($h); $contents = htmlentities($contents);//this function takes any < and > and converts them to their entities so instead of being executed by the browser, they are shown on the screen echo $contents; that will show the contents of a page
  10. That error means that the files you are including don't exist. Try to make sure that the includes you use are including the right files at the right URLs by the way, in the future, try posting some code if you want some good answers. You haven't given us anything to work with... at all
  11. EDIT: NVM read your post wrong
  12. there are multiple ways for you to do what you want. One put all the urls in a database, and have the php load those page urls every time a user accesses the page or create one master file which has all the urls in it as variables, and just change that variable on that page whenever the location changes create a text file that has all the urls in it. etc. Hope that helped!
  13. that needs to be: <?php if(!empty($checkbox) || $checkbox !== "")){} ?> (just forgot a parenthesis
  14. if($_GET[action] == "delete"){print "The selected messages were deleted.<br><a href=messages2.php>Go Back.</a>";} print " to if($_GET['action'] == "delete"){print "The selected messages were deleted.<br><a href=messages2.php>Go Back.</a>";} print " based on what I just corrected, you need to go through your entire code and fix your syntax errors, and stop posting that super long code snippet. Just post the PHP please. We dont need to see the CSS or Javascript, unless they change the PHP some how
  15. get rid of all the crap in that code. just post the PHP, there is like a bunch of lines of CSS and a bunch of Javascript and HTML that I can't reference back and forth between the PHP that talks to each other. Another error i see is if(massdelete){ for($i=0;$i<$msgs;$i++){ $deleteid = $checkbox[$i]; change it to if($massdelete){ for($i=0;$i<$msgs;$i++){ $deleteid = $checkbox[$i];
  16. all sleep does in this case is wait 10 seconds each time it loops through the entries to continue looping. How exactly are you changing the values? if it is in that script than having it sleep is entirely useless, because the PHP can't do anything while its "asleep" I really dont understand what you wish to accomplish here
  17. Building your own forum from scratch is a pretty advanced topic. Not to mention that there are so many good free forums out there, you probably dont even need to. What I would start with is Making, well, a simple website. Make registration and login scripts so that you understand how PHP works with Mysql. Make a simple guestbook/sign my website script make a news letter type thing, where you send a user email. Once you get a basic hold on PHP, take the scripts you created, and make them better. There is always room for improvement, especially if you are just starting out. Making your scripts cleaner, more secure, and faster is a great way to practice also!
  18. I didnt read it all but from the first few lines I saw an error change this if($_GET[action] == "deleteallmsgs"){ to if($_GET['action'] == "deleteallmsgs"){ I hope that helps! Sorry if it doesn't.
  19. No Problem! by the way instead of using code tags you may be interested in using the php tags. it just looks prettier =) instead of writing {code} write {php}. (with normal brackets instead of curly brackets of course)
  20. hmmm... maybe instead of adding the newline before the bcc code stuff (because since it loops it will add 2 new lines between all but the first one, which probably messed up the function to begin with) take the following line $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/alternative;\n" . " boundary=\"{$mime_boundary}\""; and change it to this $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/alternative;\n" . " boundary=\"{$mime_boundary}\"\n"; really, besides the newline that MIGHT be missing, I have no clue. It looks like it should work to me. Hope that helps.. sorry if it doesn't
  21. Well one thing comes to mind, take away the single quotes around newsletter also, for future reference, when you write queries do something like $query = mysql_query("STUFF") or die("ERROR ".mysql_error()); or something like that
  22. if you want to do this with PHP, and only want to show 1 entry at a time, and go through the entire database you are going to have to requery the server every time. However, with some javascript, you could probably do what you want fairly easily
  23. $sql = mysql_query("SELECT * FROM table_name WHERE Criteria");//if you just want to select every entry on the table, leave the WHERE part out. while ($row = mysql_fetch_assoc($sql)){//loop through the entries $month = $row['month'];//should be $row[month column name] $year = $row['year'];//should be $row[year column name] $link = $row['newsletter'];//should be $row[newsletter column name] echo "$month $year. <a href='$link'>Click here to view!</a>"; } Something like that should work. Just make sure to change this based on your table name, and your column names. You may also need to change the a href stuff based on if the filename is the absolute url, or just the local location. You may have to make it a href='my/folder/etc/$link' or something like that. Hope that helped
  24. It seems to me like you might need a newline character before the bcc stuff so try $headers .= "\nBcc: $email\n"; hope that helped
  25. This is a very good basic file upload tutorial http://www.tizag.com/phpT/fileupload.php below is a little snippet that would deny certain file extensions $tmpp = explode ( '.', $_FILES['file']['name']); $fileext = $tmpp[count($tmpp)-1]; $allowedexts = array("mp3", "jpg", "bmp", "wav", "gif", "png", "jpeg", "wma" ); $imgexts = array("jpg", "bmp", "gif", "png", "jpeg" ); $muext = array("mp3", "wav", "wma" ); if (in_array($fileext, $allowedexts)){ if (in_array($fileext, $imgexts)){ $filetype1 = "art"; } if (in_array($fileext, $muext)){ $filetype1 = "music"; } } else { print "File not trusted!"; exit(); } hope that helps!
×
×
  • 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.