-
Posts
2,965 -
Joined
-
Last visited
Everything posted by mikesta707
-
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
-
[SOLVED] Include errors on my new website
mikesta707 replied to tyrant001's topic in PHP Coding Help
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 -
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
-
[SOLVED] Include errors on my new website
mikesta707 replied to tyrant001's topic in PHP Coding Help
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 =( -
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
-
[SOLVED] Include errors on my new website
mikesta707 replied to tyrant001's topic in PHP Coding Help
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 -
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!
-
Theory behind a very secure authentication system
mikesta707 replied to forumnz's topic in PHP Coding Help
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 -
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
-
[SOLVED] Include errors on my new website
mikesta707 replied to tyrant001's topic in PHP Coding Help
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 -
EDIT: NVM read your post wrong
-
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!
-
php conflict with browsers on message box
mikesta707 replied to kendallkamikaze's topic in PHP Coding Help
that needs to be: <?php if(!empty($checkbox) || $checkbox !== "")){} ?> (just forgot a parenthesis -
php conflict with browsers on message box
mikesta707 replied to kendallkamikaze's topic in PHP Coding Help
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 -
php conflict with browsers on message box
mikesta707 replied to kendallkamikaze's topic in PHP Coding Help
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]; -
[SOLVED] sleep()...hm (sorry for being vague! hard to explain)
mikesta707 replied to Rohlan's topic in PHP Coding Help
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 -
What projects do I need to program to learn PHP.
mikesta707 replied to Redlightpacket's topic in PHP Coding Help
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! -
php conflict with browsers on message box
mikesta707 replied to kendallkamikaze's topic in PHP Coding Help
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. -
[SOLVED] Another newbie question- selecting data from sql
mikesta707 replied to unitedintruth's topic in PHP Coding Help
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) -
[SOLVED] Mass Email w/graphics works but.....
mikesta707 replied to echromes's topic in PHP Coding Help
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 -
[SOLVED] Another newbie question- selecting data from sql
mikesta707 replied to unitedintruth's topic in PHP Coding Help
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 -
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
-
[SOLVED] Another newbie question- selecting data from sql
mikesta707 replied to unitedintruth's topic in PHP Coding Help
$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 -
[SOLVED] Mass Email w/graphics works but.....
mikesta707 replied to echromes's topic in PHP Coding Help
It seems to me like you might need a newline character before the bcc stuff so try $headers .= "\nBcc: $email\n"; hope that helped -
In Need of Advice on user image management!!!!
mikesta707 replied to TGWSE_GY's topic in PHP Coding Help
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!