Jump to content

GingerRobot

Staff Alumni
  • Posts

    4,082
  • Joined

  • Last visited

Everything posted by GingerRobot

  1. Fair enough. I thought that was the case, but i thought i'd check. Wrote some php to do what i needed, but thanks for the suggestion for anything in the future.
  2. Err, well then what the hell do you call a regular single quote? : '
  3. Backticks are what you called back quotes. Never heard them called back quotes -- not sure if its a language thing?
  4. cleary1981, i would assume you didn't name your connection $conn. Either way, mysql_close is pretty unnecessary -- php will close the link at the end of the script for you. danny, i do agree that it makes things clear. It's something i used to do, but am beginning to drop. I usually find that correct capitalisation is sufficient for me to follow the query. That said, if things start getting more complex, i do tend to add the backticks back in.
  5. And therein lies your problem: lack of planning means you've over-complicated the script. Try to take more time to plan what you're trying to do and plan your logic.
  6. Your problem is this line: $where = ' WHERE type = \'' . $model' . '''; You'd make your life much easier if you were to enclose your query string in double quotes; you then wont have to worry about escaping the single quotes around values in the query: $sql = "SELECT mod_desc FROM module WHERE type='$model'"; $result = mysql_query($sql) or trigger_error(mysql_error()); I agree with danny with regard to the fact that using 3 variables is pointless. Apart from anything else, it makes it harder to follow.
  7. There are lots of different ways you can do it. For example, you could wrap your registration form in a function and call that, or you could set a variable and check it's value prior to the showing the form. I'm going to direct you to a tutorial on form handling. It really is very good, and i suggest you read it: http://www.rbredlau.com/drupal/node/10
  8. I wish people would stop staying that AJAX is a language. It's not. It's javascript.
  9. 1.) I'm not really sure what you're asking. 2.) I suggest you do this so you can debug your query: $sql = "SELECT * FROM table 1, table 2 WHERE user_privacy_search = '0' AND " . implode(' AND ', $whereClauses) . "LIMIT $from, $max_results"; $res = mysql_query($sql) or trigger_error(mysql_error()); echo 'Query was: '.$sql;
  10. Perhaps it's just me, but im not sure what the question/problem is. I'd also have serious concerns about your data structure if you're making new tables all over the place. Perhaps if you were to tell us what information you need to store and your current structure, we might be able to suggest a more appropriate method.
  11. How about because you've not posted the code you are using? Do you seriously expect us to find an error in your code if you post something you 'made up in your head'?
  12. That occurs because you're trying to set a session after data has been sent to the browser. Move the call to session_start() to the top of the script, above any output -- including whitespace.
  13. No; that's the whole point of sessions. Perhaps reading this tutorial might help your understanding there. As for non-working code; it generally helps if you post your actual code
  14. You'll find lots of examples if you google: http://www.google.co.uk/search?q=javascript+link+confirmation
  15. How about on the grounds that it looks retarded? Performance effects would be fairly minimal. The browser would be loading a larger file, so naturally there is some performance loss. As i say though, this is small. On the otherhand; I would find it a complete pain to work with that -- it's horrible on the eyes.
  16. So the user has to login to view the ebook? Can't you just check the user is logged in and has bought the ebook on default.php?
  17. Glad you got it solved. But have you tried selected the empty rows and seeing what's returned? $sql = "SELECT * FROM mytable WHERE description=''"; $result = mysql_query($sql); while($row = mysql_fetch_assoc($result)){ print_r($row); }
  18. Hmm...well it doesn't look like there's anything before the output from the database does it? I know you said you'd checked for empty fields, but are you 100% sure? It seems the most likely cause. Also, the above code cannot be the code with the line break issue, since there are no line breaks in that code. You should really post the exact code with the problem. Have you checked the source of the relevant bit? And finally, I really don't get what's going on with your loop. Perhaps if you explained what you're trying to do, we might be able to provide a solution to that and fix the odd line break problem in the process.
  19. Just wondered if it is possible to retrieve the actual matching part of a regular expression in MySQL? I know that you can use REGEXP in the WHERE clause to find rows matching a particular pattern, but i've been unable to find anything showing that you can use a regular expression in the SELECT clause to be able to show the part of the string which matches the regular expression. If that's still not clear, perhaps explaining what i'm trying to do would help better. Basically, i'm trying to update my Amarok music library. Though it provides support for .wma tracks, it seems it doesn't read the track data correctly, so doesn't know the track number. However, the track number is stored in the filename so i'm trying to update the track number from that. The path to track might be: ./home/ben/Music/The Killers/Hot Fuss [uK]/10 Midnight Show.wma -- i'm trying to grab the 10 in this case. If anyone has any suggestions, i'd be glad to hear them.
  20. Without seeing the code you are using, its a bit difficult to help you there. Double check that you've not made a mistake with your variable, and note that it is case sensitive. You could have something like: $userName = $_POST['userName']; If you're still stuck, we need to see your code. Dont forget to place tags around it. p.s. Welcome to the forum
  21. I can only assume you have something else prior to the loop causing the problem. Any chance of you posting more of the code you're using?
  22. I agree. The previous method relies on the the extension being just four letters.
  23. I think the problem is that you are using 'or' in your if statement within your function, rather than 'and'. I assume you wanted to check to make sure the extension was one of those 3, in which case you need and. If you think about your if statement, it will always be true. You might find it easier to use an array and use the in_array() function, however.
  24. You want htmlentities(). I guess i should elaborate -- you need to convert special characters to their relevant html entity. If the value of something contained a double quote, the browser would assume that the value ends at the first double quote found. Converting that double to it's enties (can't remember what it is off the top of my head) prevents this.
  25. You'll need some form of loop: $images = ''; for($x=1;$x<5;$x++){//adjust to fit your needs $images .= '<PictureUrl'.$x.'>'.$image.'</PictureUrl>'.$NewLine; } echo $images; You'll find a good tutorial on loops here: http://www.phpfreaks.com/tutorial/php-loops
×
×
  • 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.