Jump to content

bastones

Members
  • Posts

    20
  • Joined

  • Last visited

    Never

Posts posted by bastones

  1. You could try backticking the table and fields as sometimes that causes the problem (it did cause me a problem once or twice) ...

     

    Was there something in my post about reserved words that was so unclear you needed to reiterate the advice?

     

    I am allowed to post my side of the problem and I actually did not reiterate your post, sometimes SQL queries will not work without backticking them. Please do not post such remarks to me!

     

    Time to set some things straight.

    1) He said that they could be backticked in his post, so you were reiterating. ;)

    2) The REASON for the backticks is because you're using a MySQL reserved word.

    3) Backticks are a MySQL-ONLY operator.

    4) Backticks should NEVER be used.

    5) You should not create tables or columns with the same names as reserved words, in order to not have to use backticks.

     

    Moral of the story: Don't use backticks and rename your tables.

     

    I did not realise that you need to backtick reserved-words only so that is why I stated that. It is a learning process so I cannot be perfect in my reply, except I am perfect in my reply based on my knowledge. That GM did not need to get on the defensive with his reply.

  2. You could try backticking the table and fields as sometimes that causes the problem (it did cause me a problem once or twice) ...

     

    Was there something in my post about reserved words that was so unclear you needed to reiterate the advice?

     

    I am allowed to post my side of the problem and I actually did not reiterate your post, sometimes SQL queries will not work without backticking them. Please do not post such remarks to me!

  3. Not sure what your question is but if you want to allow BBCode in your application but disallow other code, then you need to use either str_ireplace() or preg_replace() functions. Here's an example of both functions:

     

    <?php $strreplace=str_ireplace("find","replace","text to search"); ?>

     

    ...for preg_replace() you use something slightly different, something called regex, you should search Google for tutorials on preg_replace in PHP :). You can use str_ireplace() which stands for string incase-sensitive string, which means it would detect both and tags. To prevent other HTML tags you could use:

     

    <?php
    // arrays here
    if(str_ireplace($find,$replace,$search)) {
    // code to execute
    }
    else {
    $form=htmlspecialchars($_POST['form']);
    }
    ?>

     

    Now, when you are saying if(str_ireplace()) you're basically asking if it was executed and you'd get a yes or no answer. If no, it goes to else (just incase you didn't know).

     

    Hope this helps! :)

  4. $query = "INSERT INTO newpractice (eventid,poster,desc) " .
              " VALUES ('$eventid', '$poster', '$desc')";

     

    Why are you adding a concatenation operator your query? That isn't required; nevertheless it isn't the problem. You could try backticking the table and fields as sometimes that causes the problem (it did cause me a problem once or twice) so change your code like this:

     

    $query = "INSERT INTO `newpractice` (`eventid`,`poster`,`desc`) " .
              " VALUES ('$eventid', '$poster', '$desc')";

     

    ...see if that works :).

  5. You can have a business at any age in the UK but you need to be 16 (I believe) to register it as a company, etc. Anyway my name is Ben, 15 years of age and been programming fluently in PHP for about a year. My latest project is a PHP game (and it isn't like "the rest"). I have created many PHP apps before including a forum and some small projects for some friends.
  6. Not sure if Google are making as much revenue as they could or should be making for YouTube, therefore Google is added new video ads or something another to generate more revenue. I find it difficult to see how Google makes revenue out of YouTube really - maybe they need to start making subscription based services or something to bring in revenue they need. Google's shares are down recently too, so don't know what this means for Google.

  7. If it's 8 years old I presume it'd be using PHP3 or 4 which isn't good. Although PHP4 scripts will most probably run on PHP5 its best to create your applications from a PHP5 environment. Some tutorials, I agree are so not helpful they are practically there for copy/paste work, but learning PHP is really easy. Having small scripts and learning and modifying them is a good option but learning the fundamentals is really essential. I recommend searching Google for 'Basics on PHP' before proceeding looking at PHP applications. When you're ready to look at small apps, search some from Hotscripts.com.

  8. According to MySQL Docs: http://dev.mysql.com/doc/refman/5.1/en/comparison-operators.html#operator_is-not-null

     

    I believe it goes with SELECT, so:

     

    SELECT * IS NOT NULL

     

    for instance. Try that and let me know if it works :).

    I have no idea what you mean.

     

    Do you mean blank or null?

     

    SELECT * IS NOT NULL FROM `users` WHERE `username` = '$username'

     

    ...is an example, I'm unsure whether this is right or wrong but it probably is right as SELECT * means selecting all fields.

  9. The starting bit of the code is line 142:

     

    if(preg_match($match1,$profile) || preg_match($match2,$profile) || preg_match($match3,$profile) || preg_match($match4,$profile) || preg_match($match5,$profile) || preg_match($match6,$profile) || preg_match($match7,$profile) || preg_match($match8,$profile) || preg_match($match9,$profile) || preg_match($match10,$profile) || preg_match($match11,$profile) || preg_match($match12,$profile) || preg_match($match13,$profile) || preg_match($match14,$profile) || preg_match($match15,$profile) || preg_match($match16,$profile) || preg_match($match17,$profile) || preg_match($match18,$profile) || preg_match($match19,$profile) || preg_match($match20,$profile) || preg_match($match21,$profile) || preg_match($match22,$profile) || preg_match($match23,$profile) || preg_match($match24,$profile) || preg_match($match25,$profile) || preg_match($match26,$profile)) {
    		echo "<b><font color='red'>WARNING: Your profile contained material that was recognised by our filter! This includes (without limitation); offensive and/or discriminating language, posting personal information (including mobile phone numbers), swearing, linking to websites not approved by us, etc. Go back and rectify the problem.</font></b>";
    	}

     

    EDIT: I found out that this error occurs when you enter text not filtered by preg_match. :S

  10. Error: Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 0 in /home/ben/public_html/Bazaark/edit_profile.php on line 142

     


     

    I have a script that lets users edit their profile. The only thing I last did on it was add filters using the preg_match function; a few days a go it was working fine and since yesterday these compilation errors have been coming up. I have tried contacting my Web host about it but they are so inexperienced they say its to do with my script. I have checked my script over 100 times and the syntax and everything seems to be fine. Does anybody know what could be causing this error?

  11. its very functional if you learn how to use it.

     

    Exactly! I don't know much JavaScript but I suppose there's always time to give it a go... I'm not sure if there is an official resource for JS for an explanation on every part of JS (like there is for server-side scripting languages such as PHP, etc). There may be an official resource so do let me know if there is :P. JavaScript is a little complicated and it has some really weird code that just does little things, like document.write() - and there are 2 things into that bit of code, one for document and one for write - why can't they make it simple - like output() lol...

  12. Dreamweaver in Code View for me - best thing you can use, especially with it's in-built FTP facility. Before that I used Notepad++ and Programmers Notepad; Notepad++'s FTP section isn't really good at all - you have to refresh the connection and other times the FTP program won't save modified files of mine... at least it did the job?

  13. Yeah, I tried downloading Firefox 3 during the download day and the download speeds were appauling and it probably took around 5 minutes for the download to finish... it's not bad but a few sites don't render properly... not sure if they have been rectified in the final release of v3.

  14. Well I found out about PHP way back in 2005 just generally that you can create "cool stuff" with it, especially forums that were my main interest back then. Since about 2006 I have really known general PHP syntax but I really didn't get into heaps of programming in PHP until early 2008 when I took the plunge and made a small calculator - or something like that. I was pretty shocked how easy it was to create such stuff so easily, but I soon realised I needed to learn a few functions here and there for safety like preventing SQL injections, etc. Now I am creating my own text-based RPG game - about half complete now! Really, the best reference is the PHP's website, but that's probably for functions and the basics. Unless you have a ground know-how of complex stuff, you won't get anywhere with PHP's manual. They don't even explain about object oriented programming - they just go right into giving you full-blown examples. Nonetheless, Google & PHP.net are the only things you need to learn PHP. I did buy a book but I was a little impatient as it was always explaining the basics which I already knew time and time again, so I did it all online... PHP is a handy thing and more young people are starting to program with it which is a good side for a wide targeted audience. PHP is logical when you know how to use it :).

×
×
  • 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.