Jump to content

spiderwell

Members
  • Posts

    1,008
  • Joined

  • Last visited

Everything posted by spiderwell

  1. search spiders are probably better these days but they like friendly urls over querystrings, my last job included taking sites from the querystring style to friendly urls as exampled above, the purpose being to improve seo ranking.
  2. Have added a simple quiz to site! see how good your chemistry is!
  3. oh relax, all posts die of their own accord eventually No one is making you come back here, and it is marked solved so why even read it if it bothers you that much! there is some irony in your post as you are doing exactly what you are protesting about!
  4. I am pretty sure that there isnt a way to collectively 'show all sessions' in php, but I might be wrong. The alternative would be to have another table in the database that you update with users when the login and logout (or timeout) so you keep a tally of who is online, and do it that way. Back in the day of classic asp you could use application level variables that were great for keeping track of things like this, I am not sure if php has such things.
  5. No reason for the advice if they are doing proper backups (onsite AND offsite) I hear what you are saying but this is usually advice to friends, not professional environments, and not many home users do backups, they see 2TB drive only £70, think I'll have some of that, fill it with data, and when(if) it fails lose everything in 1 shot.
  6. this is why i often advise people to never have such large drives, i personally never have a drive over 500gb good luck with your recovery! it sounds quite painful
  7. I have often seen previews displayed in a popup too, so it doesnt actually post the form, but it does grab the comment and display it in this popup preview window
  8. i have 4 vehiclesales entries, and vehicleimages has like 4 images with the same vehicleID, so when i run the statement i get like 16rows back which repeat the vehiclesales each time with a different image in the row, so the same vechiclesale appears 4times when i just want 1 so im trying to pull out each vehiclesale with an image but i dont want the sql to repeat the vehiclesales with each image that has a matching vehicleid i hope that makes sense
  9. change this line: $result = mysql_query($sql_query); to this: $result = mysql_query($sql_query) or die(mysql_error()); this will tell you whats going wrong with your sql, $result should be a resource that mysql_fetch_array() can work on, but it isn't so this should spit out the sql error that you are getting
  10. the error is saying that $result isnt a recordset, what is the code just before the while statement?
  11. you still need the while statement to loop through the record set: <table class="Main" width="65%" cellpadding="0" cellspacing="0"> <tr><td class="Tableheading">Newspaper</td></tr> <tr><td class="subtableheader"><img src="images/newspaper.jpg" alt="paper"/></td></tr> </table> <table width=100% class=table> <? $select = mysql_query("SELECT * FROM paper WHERE edition=1 ORDER by id ASC"); while($the=mysql_fetch_object($select_paper)){ ?> <tr> <td> <td width=50% style=border: none; background-color: transparent; valign=top> <table border=1 cellpadding=0 cellspacing=0 bordercolor=#000000 class='main' align=center> <tr> <td width=500 class='tableheading'><?php echo "$the->title"; ?><center> </center></td> </tr> <tr > <td class="profilerow" align=left><center><?php echo "$the->news"; ?> </td> </tr> <tr > <td class="subtableheader" align=left><center><?php echo "Article By $the->by - $the->date"; ?> </td> </tr> </table> </td> </tr> <? } ?> </table> </html>
  12. try changing the sql $select_paper=mysql_query("SELECT * FROM paper WHERE edition=1 ORDER by id ASC LIMIT 15");
  13. well i think because it has a half finished table in the html part try this: <? $select_paper=mysql_query("SELECT * FROM paper WHERE id=1"); while($the=mysql_fetch_object($select_paper)){ ?> <table border=1 cellpadding=0 cellspacing=0 bordercolor=#000000 class='main' align=center> <tr> <td width=500 class='tableheading'><?php echo "$the->title"; ?><center> </center></td> </tr> <tr > <td class="profilerow" align=left><center><?php echo "$the->news"; ?> </td> </tr> <tr > <td class="subtableheader" align=left><center><?php echo "Article By $the->by - $the->date"; ?> </td> </tr> </table> <br> <? } ?>
  14. have you tried putting the sql you want in place of the current sql, that should do it really, perhaps with LIMIT 15 tacked on the end of the sql so only 15 records return. $select_paper=mysql_query("SELECT * FROM paper WHERE edition=1 ORDER by id ASC LIMIT 15");
  15. if its the sql line then its probably the extra ' i put in, i did say i wasn't sure about that one. however the undefined index at that line for class is appearing for the reason mentioned previously it would be better off being re written completely. I havent checked this code for syntax errors but it is probably ok: $username = (isset($_POST['username'])) ? $_POST['username'] : false; // if its set, grab it otherwise false $password= (isset($_POST['password'])) ? $_POST['password'] : false; $class= (isset($_POST['class'])) ? $_POST['class'] : false; if (!$username|| !$password || !$class ) // if any are false { //some code to prevent non entered fields perhaps } else { //some other code here perhaps to santize the data, maybe also use md5 or sha1 to not store password in text format $sql="INSERT INTO register (username, password, class) VALUES ('$username','$password','$class')"; }
  16. it is saying that $_POST['register'] does not exist. use isset($_POST['register']) to check if it exists, then pass it to a variable, the same occurs on class if none of the radio options are selected this line: $sql="INSERT INTO register (username, password, class) VALUES ('$_POST[username]','$_POST[password]','$_POST[class]')"; has a few errors, the biggest one is putting unsantized data into an sql statement, this is not advised, it allows the possiblity of sql injections, the other part is that your ' are missing from the $_POST: $sql="INSERT INTO register (username, password, class) VALUES ('$_POST['username']','$_POST['password']','$_POST['class']')"; but you say it is working so maybe that bit isnt wrong? I am not 100% sure on that bit
  17. are the options hard coded or in an array? the code you have posted doesnt show dropdown values from a database.
  18. API isnt a language, what you have posted looks like XML learn more
  19. Which is why it is blocked from my search results did the same myself
  20. ok here is the structure of the 4 tables with also teh mysql version -- phpMyAdmin SQL Dump -- version 3.3.9 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Feb 22, 2012 at 07:34 PM -- Server version: 5.1.53 -- PHP Version: 5.3.4 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -- -- Database: `hoagysouthwest` -- -- -------------------------------------------------------- -- -- Table structure for table `vehicleimages` -- CREATE TABLE IF NOT EXISTS `vehicleimages` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `salesid` int(11) DEFAULT NULL, `image` text, `order` int(11) DEFAULT '0', PRIMARY KEY (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=41 ; -- -------------------------------------------------------- -- -- Table structure for table `vehiclemake` -- CREATE TABLE IF NOT EXISTS `vehiclemake` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `make` text NOT NULL, PRIMARY KEY (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ; -- -------------------------------------------------------- -- -- Table structure for table `vehiclemodel` -- CREATE TABLE IF NOT EXISTS `vehiclemodel` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `makeid` int(11) DEFAULT NULL, `model` text NOT NULL, PRIMARY KEY (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=14 ; -- -------------------------------------------------------- -- -- Table structure for table `vehiclesales` -- CREATE TABLE IF NOT EXISTS `vehiclesales` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `makeid` int(11) NOT NULL, `modelid` int(11) NOT NULL, `title` text, `year` int(11) DEFAULT NULL, `date` date DEFAULT NULL, `price` int(11) DEFAULT NULL, `mot` text, `tax` text, `logbook` int(11) DEFAULT NULL, `mileage` int(255) DEFAULT NULL, `fuel` text, `transmission` text, `drive` int(11) DEFAULT NULL, `details` text, `forsale` int(11) NOT NULL DEFAULT '0', `ebay` bigint(200) DEFAULT '0', PRIMARY KEY (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=12 ; What I am trying to achieve is a recordset of the vehiclesales, with vehiclemake, vehiclemodel and vehicleimages all joined on to give me a list of all the vehicle sales with just 1 row from the images. as it stands vehiclemodel and vehiclemake are 1 to 1 against vehiclesales, but vehiclesales to vehicleimages can be 1 to many, I just want it to return 1 image. I hope this is enough information for you
  21. you can call the input field anything you like in the html, just use the same name to retrieve it in the php when submited. <input type="text" name="record"> <? $record = $_POST['record']; "SELECT * FROM mytable WHERE id = " . $record ?> of course you need to add security to this to prevent sql injection, but hopefully that gives you the idea
  22. well i did know that was the right answer, using 3 = instead of 2 means EXACT comparison, i just wasnt sure of the correct terminology! EDIT: i am just reading that link to type conversions in php
  23. good reply! I think i was trying a little bit to get the answer in first, but like you pointed out, quality is better than quantity. roll on the tipping point
×
×
  • 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.