Jump to content

cbolson

Members
  • Posts

    139
  • Joined

  • Last visited

    Never

Everything posted by cbolson

  1. Hi, Is it adding any data to the database (name, email etc.)? You should add some error checking to your code after a db query: mysql_query("INSERT INTO `employees` VALUES ('$name', '$email', '$phone', '$pic')") or die("Error with insert.<br>".mysql_error()); To be able to further debug your code you need to make a variable of the insert : $insert="INSERT INTO `employees` VALUES ('$name', '$email', '$phone', '$pic')"; mysql_query($insert) or die("Error with insert.<br>".mysql_error()); This way you can easily do echo $insert to check the insert data. Also, why do you have brackets in this line?: $pic=($_FILES['photo']['name']); They might be messing things up. Chris
  2. hmmm, I have followed through your post wshell and had a go at the code that you included.... and got nothing I sort of hoped that it would echo something out (yes, I did try echoing $animals ) I may have misunderstood it but I feel that it hasn't made anything any clearer for me I will read your blog entry now, thanks for sending me the url. Chris
  3. Doesn't look like a line from the code that you have pasted..... Is the error actually in connection.php??? Otherwise, have you echo'ed your query to see what is actually being used? $get_dog_count = "SELECT count(id) FROM $table_name"; if($breed!="all") $get_dog_count.=" WHERE dog_breed = '$breed'"; echo $query; Chris
  4. Shouldn't that be going on? Feel free to pm me with your blog, I would love to read it Chris
  5. If it works sometimes, the problem is not with that block of code (not that I would do it like that), it must be with something else. You say that it leaves the drop down menu blank - do you mean that it has various empty values or that it has no elements? Just for reference an incase you are interested, I would do this bit of code something like this: // get list of members from the database $sql = "SELECT user_name FROM members"; $res = mysql_query($sql) or die("Error getting members"); $list_members=""; while($row = mysql_fetch_assoc($res)){ $list_members.='<option value="'.$row["user_name"].'">'.$row["user_name"].'</option>'; } ?> <select name="members" id="members"> <?php echo $list_members; ?> </select>
  6. Thanks Crayon Violent, That was some pretty interesting reading (thanks to Nightslyr for bringing lego into it ). Understanding the *reason* behind OPP is (was?) one of the things that I could never get my head round. I know *how* to do it but have never fully understood why. After reading through your post, and understanding most of it, I feel that much closer to finally understanding the purpose of classes. Thanks for taking time to answer 5kyy8lu3's question. Do you have a blog? would definatley be worth reading Chris
  7. I can't see the error in the snippet that you sent, but bear in mind that pho errors are often actually in the line before the line that is indicated in the error message. Also, you should also check that $breeds has a value. Something like: if( ($breeds!="") AND ($breeds!="all") ) $sql.=" WHERE $dog='".$breed."'"; .... I have just realisd you have $dog='$breed' Where is the variable $dog set? Should this not just be "dog" (ie no $) ? (I should have spotted that before ) Chris
  8. The ORDER BY must go after the WHILE condition. You have this: $get_dogs = "SELECT id, bname, dog_breed FROM $table_name ORDER BY bname"; if($breed!="all") $get_dogs.=" WHERE $dog = '$breed' ORDER BY bname"; That should be: $get_dogs = "SELECT id, bname, dog_breed FROM $table_name "; if($breed!="all") $get_dogs.=" WHERE $dog = '$breed'"; $get_dogs.="ORDER BY bname"; Chris
  9. Hi, I would condition your query so that, if $breed=="all" you don't include the WHERE clause: eg. $get_dog_count = "SELECT count(id) FROM $table_name"; if($breed!="all") $get_dog_count.=" WHERE $dog = '$breed'"; Chris
  10. Nearly there.... Try this: <?php session_start(); $username = $_POST['username']; $password = $_POST['password']; $lines = file("users.txt",FILE_IGNORE_NEW_LINES); // read the lines into an array $find = "$username:$password"; // form a string like you expect it to be in the array if(in_array($find,$lines)){ $_SESSION['loginsuccessfull'] = true; # define session var header("location: loginsuccess.php"); # redirect to success page } else { header("location: loginunsuccess.php"); } ?> Then, as TheJoey says, don't forget to start every page with session_start(); Chris
  11. Hi, Your query is wrong - you have 2 WHERE statements in there. $query="SELECT * FROM genrelinkcd WHERE genrelinkcd.genre_id=genres.genre_id WHERE genres.moj_genre='$row'"; I can't quite work out what you are trying to do with that query so I can't actually suggest what it should lool like. Chris
  12. Hi, At first glance your query looks ok, you just need to add the fields that the user has selected. Something like this: $query = "SELECT * FROM tickets WHERE siteid = '$siteid'"; if($companyname!="") $query.=" AND companyname LIKE '".$company."'"; if($email!="") $query.=" AND email='".$email."'"; etc. $sql.=" ORDER BY created DESC"; Chris
  13. Hi, Well, as I say, I see no css-php related isssues here. So what page is this ? Is it the page after a login attempt? It is true that these lines: $username = $_POST['username']; $password = $_POST['password']; $lines = file("users.txt",FILE_IGNORE_NEW_LINES); // read the lines into an array $find = "$username:$password"; // form a string like you expect it to be in the array if(in_array($find,$lines)){ $_SESSION['loginsuccessfull'] = true; are setting a logged in $_SESSION. However, in the code that you have shown this only works if the values "username" and "password" are "posted" to the page. This normally only happens when the login form has been posted, not on every page. Ideally the login for would go to an "invisible" page that did nothing more than check the login values, if correct it would set the session variable as you have here, then redirect, using php header(), to the (eg) home page. If incorrect it would go somewhere else, cleary not defining the session. Then, on all pages that require the session variable you would check for that something like: session_start(); // check user is logged in - if not redirect if(!$_SESSION["loginsuccessfull"]) header("location: url_to_other_page"); // user logged in - show page..... Chris
  14. Hi, I'm not hot on php classes but have you missed out these lines from the Email class?: var $From; var $FromName; var $ToMail; var $ToName; var $Subject; var $Message; ie: class Email { var $From; var $FromName; var $ToMail; var $ToName; var $Subject; var $Message; etc. Also, I am not convinced that you want the ampersand (&) in this line: $mailer = &new Email; That should probably be this: $mailer = new Email; Chris
  15. Hi, when you say "it just doesnt show up the same as it does when i do it in html." what do you mean? I can't see any css in your code that is related to the php. Not sure if it is your problem, but this line has a double "echo": echo echo '<div id="wrapper"> Also, unlesss there is more code than you have posted here, you are not actually saving the valid users logged in session so I am not surprised that when you click on a link it says "login unsuccessful" Sorry to not be of more help, it is just that I can't see exactly what (which) your problem is. Chris
  16. Hi, Have you changed your code? I can't see the "location" link in that url that you posted Or are you refferring to the "our location" at the top? (I was looking for a property location map) Chris
  17. $_REQUEST is actually a bit more complicated than that as it also returns variables sent by the browser. Whilst it is true that you can *normally* use it to access $_GET and $_POST values, some servers have this desactivated so you shouldn't rely on it. Also, as $_POST and $_GET are different, theoretically both of them could be passed to the page which might result in confusing results (I can't remember right now which one takes priority). Anyway, more info can be found here: http://us2.php.net/manual/en/reserved.variables.request.php Chris
  18. Hi, I suspect that, as the user states that they have no idea about php, the problem is finding that bit of code to know where to add the code that you suggest. I have downloaded the script that you mention and I think have I have been able to identify the line that is showing the advert description. You need to open the file details.php and go to line 206 (assuming that it hasn't been modified) You should see this: ".$row[$key]." </td></tr> Following HektoR's advice, you need to modify this line so that it looks like this: ".nl2br($row[$key])." </td></tr> I hope this helps, bear in mond that I have never seen or used this code before so I might have got the wrong place Chris
  19. Have you tried getting it from the root like this: include($_SERVER["DOCUMENT_ROOT"]."/includes/footerlinks.php"); Chris
  20. can you send me one of those emails? I will send you a pm with my email. Chris
  21. opps, sorry, I copy&pasted too quickly Of course that should have been : $res=mysql_query("SELECT TopicName... Chris
  22. OK, let me know if you want me to upload the "new" database Still searching for anything suspicious. I will take a closer look at that "cron" aswell to see what it actually does and why it takes so long. I suspect that whatever it tries to do takes so long that it never finishes so the next time it has to start again. Chris
  23. The cron is what is sending the emails, it is doing varios bits of database checking and sending the emails according to what it finds (I hope it isn't sending them to your clients too ) The problem here is that this is not how a cron should be run, a cron should be run by the server at predefined times. Anyway, this is what was causing the index page to load slowley (a least for me). I wonder if your server (or previous one) had an automatic script that was resetting the permissions when this cron was being run - it was taking for ever (never finished). It is quite possible that the server has a built in script that disactivates webs when this kind og thing happens to avoid spam and hackers. Have you received any emails from your hosting company that mentions anything like this? Can you confirm that you can now see the web correctly? Chris
  24. Hi, you are not actually getting the data from the database with that, just execting the query. You need to fetch the results from the query something like this: $res=mysql_result("SELECT TopicName FROM ForumTopics WHERE TopicID = '{$_GET['TopicID']}'"); $row=mysql_fetch_assoc($res); echo '<h1 style="margin-bottom: 0px;">' . $row["TopicName"] . '</h1>'; Not as short but certainly easier to understand and therefore see why it isn't working Chris
×
×
  • 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.