mattster 195 Practically a Master Poster Featured Poster

It also uses font awesome for the icons, not images @gentlemedia, so:

add <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css"> to the <head>

and replace <img src="icon-2.gif" alt="Icon 2" /> with <h1><i class="fa fa-globe"></i></h1>

Hope this helpes :)

mattster 195 Practically a Master Poster Featured Poster

Hi All,

I've just tried to get going with Django using MySQL, but linking them has been a nasty headache. I am using Python v3.5, Django v1.9 and MySQL 5.6.

I've definately got MySQL/Python talking, but Django always has the problem:

 File "X:\Program Files\Python\lib\site-packages\django-1.9-py3.5.egg\django\db\backends\mysql\base.py", line 25, in <module>
 import MySQLdb as Database
ImportError: No module named 'MySQLdb'

Any ideas much appreciated!

Matt

mattster 195 Practically a Master Poster Featured Poster

I think that would be of interest to an awful lot of people RJ.

mattster 195 Practically a Master Poster Featured Poster

@UK-1991 that's fine, no hard feelings from me. No need to not post again aha, we're not that tight here. It was really the way you put your point across that might offend the people trying to help, and I'm sure you can appreciate most of us are very busy and checking DaniWeb often falls after many other things in our lives, so responces may well take a couple of days.

Moving on to a lighter note, did that help solve your problem?

diafol commented: Well put +rep +15
mattster 195 Practically a Master Poster Featured Poster

Copy - I've used it for a little while now and can't fault it.

It's an excellent site 15GB of FREE space, plus another 5GB for refferals! Includes sync, no file limits and 30 day history & recovery. As with dropbox, two users can share data between two accounts.

Tcll commented: I saw this thread and was just about to suggest this, Copy is an awesome! +0
mattster 195 Practically a Master Poster Featured Poster

I think your DB is pretty much there (indiviual opinions may differ), but you know your application best.

You can do a PHP/SQL loop like:

$date = time(); // today
$days = 10;

while($days > 0) {
    // SQL-> "SELECT COUNT(*) FROM tblbreakups WHERE breakondate='".date('Y-m-d', $date)."'"
    if($result_count == 0) {
        // Not break day
        // SQL-> "SELECT * FROM tbldaysetups WHERE daynumber='".date('N',$date)."'"
    }
    // Next Day
    $date = $date + 86400; 
    $days--;
}
mattster 195 Practically a Master Poster Featured Poster

You users table is fine. (Make sure you're using the right datatypes - varchar(X)/int() - and A_I/PRIMARY_KEY for the ID)

Item Desc: ID,NAME,TYPE,ATTACK (again with correct datatypes)

Inventory: ID, USER_ID, ITEM_ID, [.. anything else you might need] (all int() datatypes, with A_I/PRIMARY_KEY for the ID)

Use a new row for each item in a users inventory. Otherwise 20 columns is uneccisarily bulky. This also makes time for a LEVEL column, for instance.

Hopefully that makes sense?

mattster 195 Practically a Master Poster Featured Poster

In the nicest possible way, &nbsp; characters were never going to display correctly.

Yes tables are bad practice, but the correct alternative involves a CSS grid system. By all means give this a go and see how you get on. The beauty of grids is that, once you get going you can easily sort out your site for mobile/tablet viewing.

On a side note, your code involves extensive use of the style="" attribute, which is bad practice. You should really try to keep ALL CSS in external CSS files - it makes it far easier to organise.

mattster 195 Practically a Master Poster Featured Poster

Any one there to help no one is helping me I am stuck up please some one help me out

Since you're not paying me (and everyone else here), we will respond when we can. Demanding help to just come isn't going to work, I'm afraid.

If only one file is moving, then clearly only one file is getting handled correctly into that array. Try a good ol' print_r($imggall) and print_r($imgtemp) just before the foreach so we can take a closer look.

If $imggall is being used as a key for $imgtemp, theres a risk that they may be different, so won't find each other or the desired file. (Basically dont count on that).

Using a loop and using the key is probably the most efficient way to work:

$i = 0;
foreach($imggall as $imgname) {
    $path = "./img/gallery/".$imgname;
    move_uploaded_file($imgtemp[$i], $path);
    $confirm = mysqli_query($connect, "INSERT INTO gallery (image) VALUES ('$imgname')");
    $i++;
}
mattster 195 Practically a Master Poster Featured Poster

I think what you're doing here is either weird on unclear.

So my understanding is, you add a row (ID = 1, TIER = 1, PARENT = 0) then when you add another row the TIER should increment (ID = 2, TIER = 2, PARENT = 1). This should happen again (ID = 3, TIER = 3, PARENT = 2), and then reset and start again? (ID = 4, TIER = 1, PARENT = 3)

Either way, it's difficult to see why you aren't just forever incrementing the TIER.

it will incrementing previous tier_id.

Thats because you're passing the previous tier_id into the update? Just use $node_id.

Hopefully that clears things up.

mattster 195 Practically a Master Poster Featured Poster

Remove the &nbsp; in your HTML, and set your margins in css:

@media screen and (max-width: 320px) {
  .menubar1 > a {
    box-sizing: border-box;
    display: block;
    font-family: arial, helvetica, sans-serif;
    padding: 0;
    margin: 10px 0;
  }
}

Notes:

  • There is no need to repeat your code in the @media query. @media takes your existing rules (for big screens) and overwrites them - so no need for excess stuff.
  • Are you only texting this on your desktop? 320px isn't really mobile resolution - few mobiles will have a screen this small. Aim for more 768px (taken from the Bootstrap project).
mattster 195 Practically a Master Poster Featured Poster

I have been using phpStorm for a little while now, and it has grown on me enough to invest in other JetBrains tools for other projects.

The thing I like, is that it seems JetBrains have crafted the IDE to fit a "by developers for developers" concept. Project handling and navigation is lightyears ahead of Dreamweaver and more 'lightweight' things that closer resemble text editors.

Code completion and suchlike are standard nowadays, but writing with phpStorm just seems to flow fast - I really do feel that writing flows very quickly. Maybe this is due to wrapping blocks within XYZ and little things, change all variable names and multiple cusors with the alt key. It's the only program I've ever used where I look forward to the startup tips every time I load it.

I am a massive fan of CSS preprocessors, and it's standard in anything I do. Having an IDE that even recognises that preprocessors exist is a plus, let alone understanding the syntax. I'm sure a sililar thing applies to PHP frameworks as well.

Finally, theres no 'I' in team and phpStorm's collaboration tools, cool widgets (like todos) and plugins (for version control) just make the process soooo much more efficient.

Overall, a very pleasant IDE. Maybe @diafol should go into sales - JetBrains have probably taken a fortune from everyone giving it a go! ;)

mattster 195 Practically a Master Poster Featured Poster

Well if you have a two week deadline and a pressing client you should not have taken on the work without telling your employer you have no idea what you're doing. Simple as.

It all depends on the clients specifications and wireframes, to the point where generic plugins may not solve this. Personally, especially for a client like this, 3rd party tools are nothing but a liability that you cannot control. If your employer has given you over two weeks, I'm sure they'll be expecting you to do a lot more than download and install something free of the internet. Maybe look into wordpress plugin development, and you can solve this with custom post types, which essentially work like any default page (including content and a featured image) and maybe custom taxonomies if you need additional settings/search parameters.

mattster 195 Practically a Master Poster Featured Poster

Agreed that maybe the if block needs sorting, and please PLEASE put a real escape on those variables: (line 5) $pkgname = mysqli_real_escape_string ( $connection , $_POST["pkgname"] ). Additional validation would be a good idea, but isn't necessarily essential.

After line 16, add a new line with print_r($_POST["pkg_detail"]);, so we can see exactly what that loop is working with (assuming you're right in thinking that it's that loop not working).

Also, my fancy tip of the day: no need for the PHP closing tag (?>) in files where there is only PHP output (i.e. no HTML afterwards).

mattster 195 Practically a Master Poster Featured Poster

But javascript does compute the colour change in the browser? Because you're calling the JS function from two places and it doesn't really make sense. Just before clicking submit, has everything changed in the form (particularly the value of #T11) so that everything should work? (Use Chrome's developer tools to check if you need)

What I'm really getting to, is that apart from the outdated mysql_*, I can't see anything that would cause problems in your PHP. $Picid is being taken from the $_GET, as opposed to $_POST like everything else. Just check that your form is dealing with that correctly.

mattster 195 Practically a Master Poster Featured Poster

Firstly, mysql_* is dead now - mysqli_* should really be used. Also, there's no housekeeping here!! Your query is a lovely advert for SQL injection! session_start() should be the very first thing on your page: before output of any kind. You also have several messy <option> tags: only one can be selected and you should really output them as a loop.

The Selfrating1 can be save .. but the textbox color .. doesn't save

Well what exactly is being saved and what isn't? All of the columns except that one?

From what I can see, there is nothing calling the javascript function to process the data, which would explain why there isn't any colour changes. For speed, add onbeforesubmit="ocalculateText()" to make sure the JS is called, and then see what happens.

Clearly that function needs cleaning up, as I can't really see why you've done some things - but thats another matter aha.

Hope this is helpful :)

mattster 195 Practically a Master Poster Featured Poster

Please tell me that you have a <head> and that you've just randomly decided to show the end of the page and not the start.

Also, please, PLEASE, indent your code properly and only put a neccessary amount of gap lines in to keep it readable. Frankly, your code is making my eyes bleed.

In regards to your problem: "results wont come" isn't best helpful and doesn't really match your title. Provide an accuracte description of what you have got, including error messages, and what you're not getting that you need. Screenshots always useful as well.

mattster 195 Practically a Master Poster Featured Poster

If it's that good, why sacrifice it for Blogger? Why not invest in some cheap hosting that would allow Wordpress?

Personally, I don't find many Blogger templates that exciting, because most decent designers/developers have realised the power and versatility of Wordpress, so don't bother looking at Blogger.

If I were you, keep your lovely theme the way it is and use Wordpress.

mattster 195 Practically a Master Poster Featured Poster

3D in photoshop to create an animated GIF would probably be easiest - I can't think of any other way without using CSS transformations, but to be fair, if your users are still using IE8 than they're already doomed.

Maybe suggest they upgrade, or have a static IE8 fallback alternative?

mattster 195 Practically a Master Poster Featured Poster

Sorry @diafol you just beat me to it ;)

mattster 195 Practically a Master Poster Featured Poster

Note: read http://php.net/manual/en/faq.passwords.php#faq.passwords.fasthash

sha1 is not safe, do not use it! Have a read through this and at the very least use the crypt() function.

Lau has sort of narrowed down how to do the login system: hash the corrct password when saving the user, hash the entered login password in the same way, if they're the same it's all good - otherwise it's an imposter.

mattster 195 Practically a Master Poster Featured Poster

Sorry I've just accidently half-mentioned this here. I haven't got any other windows open, and with every new page I have to do the same again to close it.

mattster 195 Practically a Master Poster Featured Poster

you could use prepared statements and bind parameters/values.

Apologies, forgot to mention those - point being that some form of housekeeping needed to be done.

mattster 195 Practically a Master Poster Featured Poster

https://www.daniweb.com/web-development/php/threads/435023/read-this-before-posting-a-question

How many times that has to be quoted to people around here incapable of common sense.

mattster 195 Practically a Master Poster Featured Poster

To adapt to mobiles you need to be using CSS media queries, and not changing the ids of elements (the only way you can do that is through JS).

You can change the order by using z-index, but I'm still failing to see what that would achieve. Have one element, .marketing, and use a second class on the marketing page (.marketing-home) to change the background ONLY, and use a media query to adjust for mobiles.

So normally: <div class="marketing">...</div> and then on the home: <div class="marketing marketing-home">...</div>.

style.css: (NB you shouldnt need the !important but i've put it there to be sure.)

.marketing {
    /* Normal pages */
    background: #0CF ;
    ...
}
.marketing-home {
    /* Marketing page */
    background: #CFC !important;
}
mattster 195 Practically a Master Poster Featured Poster

So you are having problems overruling css rules to change the background image on the odd few pages?

If so, have that code in your style.css file or whatever, and then on the pages that need a different background image use the <style> tag in the <head> or embedded CSS (not so friendly) <div style="">. There's no need to have divs sat on top as an overlay if you can overwrite the css.

mattster 195 Practically a Master Poster Featured Poster

The php.ini is just the PHP config file, and will definitely be present in all versions of PHP. In your root PHP directory (where all of the PHP system/core files are stored - i.e. C:\wamp\bin\php\ or C:\wamp\bin\php\php5.5.12 for example) there will be a file called php.ini, and in that massive file will be those settings.

mattster 195 Practically a Master Poster Featured Poster

No no, my apologies for how that may have come across, I'm not accusing you for encouraging anything bad, just making sure he clearly knows the difference in using mysqli_*.

Personally, having done nothing but OOP, I think that he is more than capable of using bits of OOP in his code (even if he doesn't understand it all), because small steps are better than none at all. Granted, it would be unfair to write the whole thing as a class, but by learning the fundamentals of procedural is still learning the fundamentals of inefficiency and poor, mucky code.

Most people would hardly even notice that this is object based and not procedural, so for what little bit extra it is to realise the function looks different, but provides far more efficient database handling - is surely worth it?

mattster 195 Practically a Master Poster Featured Poster

Personally I would use XAMPP, as the binaries are that much more complicated to get sorted. As well as building and actually installing PHP, getting it to communicate with Apache and MySQL can be an absolute nightmare.

But as @jstfsklh211 correctly says, do check your ini file first. These will be the settings to look for.

mattster 195 Practically a Master Poster Featured Poster

I would highly recommend the object orientated.

It's a far more efficient way to work, but granted it's slightly more to learn. I think it also neatens your code if you are using objects rather than tons of functions and variables: procedural is famously a 'cheap and cheerful' quick fix.

If ever given the choice, go the OOP way!

mattster 195 Practically a Master Poster Featured Poster

Going on what @Gideon_1 first said, here is the mysqli_* version of his example (I haven't had a chance to test it at all yet, but I think it should work). Hope this helps:

<?php
    session_start();

    // database connection
    $mysqli = new mysqli('host','username','password','database_name');
    ... Check connection ...

    //if form is submitted
    if (isset($_POST['submit'])) {

        //validating that input fields are not empty (also escaping them).
        if (!empty($_POST['username']) && !empty($_POST['passwordname'])) {

            //setting variables
            $email = $mysqli->real_escape_string($_POST['username']);
            $password = $mysqli->real_escape_string($_POST['passwordname']);

            $results = $mysqli->query("SELECT COUNT(*) FROM users WHERE email='' AND xx=''");
            $get_total_rows = $results->fetch_row(); //hold total records in variable

            if($get_total_rows == 1) {
                // valid, so you can set your session in the same way as we've queried data above.
                $data = $results->fetch_assoc();
                $_SESSION['user'] = $data['id'];
            }
            $mysqli->close();
        }
    }
?>
mattster 195 Practically a Master Poster Featured Poster

You should always make a habit of keeping up with newer versions, mainly because these versions are released for a reasib (security patches, bugs etc.)

I think PHP v5.3+ should cover it, but we are currently on v5.6, so you really should've upgraded a long time ago. MySQLi is a component of PHP, not the MySQL database engine, so it shouldn't matter which version you have. Again, I do reccomend v5.6 ish for efficiency/security reasons.

mattster 195 Practically a Master Poster Featured Poster

Start by building some simple queries, most of which can be done by replacing functions (like L21 mysql_query() with $insert_row = $mysqli->query();). You should slowly see the transformation as not too difficult as soon as you're used to the mysqli_* functions.

Take a look at these to get going:

http://www.sanwebe.com/2013/03/basic-php-mysqli-usage
http://codular.com/php-mysqli

Also note, you should use validation and must use $mysqli->real_escape_string() to clean data, otherwise you're vunerable to SQL injection.

mattster 195 Practically a Master Poster Featured Poster

My rates are $5,000 per hour.

Show some effort, Google it, try some code, then stop spamming us with your email address - why would any one email you when we can collectively help here?

mattster 195 Practically a Master Poster Featured Poster

Have you even Googled it? Where did you get? Because I googled it and the top result (here) is an amazing tutorial.

I assume you already understand OOP in PHP, as that would be very helpful. There are loads of tutorials availible should you need.

mattster 195 Practically a Master Poster Featured Poster

So basically there aren't any real pros and cons other than how the people needing to use the languages find them. As @rubberman says, PHP is far more neutral. If you use ASP.Net, you are committing to using Windows servers to run your site, which can be more costly.

If on the other hand you have experiance with C# or suchlike, then it would probably be a good idea to look into ASP.Net. This has been a long-running debate on DaniWeb, and the answer is always something along the lines of, all languages have their subtle pros and cons, so you should try both and see which one you take to.

mattster 195 Practically a Master Poster Featured Poster

We need to see the array in $row, and how you are placing this into your $data['graph'] variable. How can we show you how to manipulate an array if we don't even know what we're starting with aha?

mattster 195 Practically a Master Poster Featured Poster

30% of people would prefer to buy something via the internet on a tablet, and nearly that again would prefer mobiles. The age of desktop browsing has long been replaced by that of the mobile world, where 57% of people use their phones to regularly browse the internet. Yes, you should definitely have a responsive website. (Source Ofcom, UK)

For the future, 'E-commerce Hosting' as a title has nothing to do with responsive websites. Please choose your title more carefully.

mattster 195 Practically a Master Poster Featured Poster

bootstrap.min.css, line 9: .navbar-inverse .navbar-inner is the one to change.

Or a quick fix would be to overwrite it with this:

.navbar-inverse .navbar-inner {
    background:#00ccff !important;
}
mattster 195 Practically a Master Poster Featured Poster

My copyright thief alarm is screaming.

Why would we help you write something that is going to crawl around other peoples websites and nick all of their content? Sounds very dodgy indeed.

I think it is fair to say, lets not carry on with this thread until a very good reason is given for this program.

mattster 195 Practically a Master Poster Featured Poster

For the last month (and the preperation weeks before that) it's been tough getting 19 exams out of the way, my worst being four 1hr 30min exams on one day! Revision has been tough, leaving no time for DaniWeb :(

Now we've got until september to relax, before starting 6th Form - so pleanty of time to get back on to DaniWeb! Between running my own business and working for a software firm that is...

Hope everyone has been keeping well and I haven't missed much!

mattster 195 Practically a Master Poster Featured Poster

Is the span tag even likely to change CSS class? Because if not, why are you storing the whole tag? Why not just the time (and class)?

Good practice not to store unnecissary stuff in your DB when it can be done later.

mattster 195 Practically a Master Poster Featured Poster

I was looking for something similar myself a few days ago, and found the odd example of a CSS based monopoly-type game board. To be honest, they were all shabby examples made with code that left my eyes bleeding.

I decided to make my own board and get it right (hopefully). So here is my attempt at a monopoly board using minimal CSS and HTML.

Usage:

Use <div class='board'>...</div> to contain your board. Then for each tile, use <section class='{direction} {features}'>...</section>

You can use left, right and up as directions (assuming your players work up the board...) and the following feature classes: start; end; danger; active.

I've set it up to use the Font Awesome library, but this can be adapted into something else.

Here is a demo on Codepen. Hope you like it.

cereal commented: great! +13
mattster 195 Practically a Master Poster Featured Poster

Which elements are you talking about specifically, as some have overrides and stuff to cause problems. Maybe worth posting a browser screenshot so we can see what you're seeing.

BTW: it says in your signature "Never allow just anyone access to your database", but your code is soo vunerable to SQL injection you've practically given the world your front door key. Use an escape function, and maybe think about mysqli_*, since normal MySQL functions have been scrapped by PHP for a long time.

mattster 195 Practically a Master Poster Featured Poster

Remember you need an ORDER BY to get them in date order, and a LIMIT to get the specified amount as well.

Nearly there on the foreach, change it to this:

foreach($result as $row) {
    echo $row['Title'];
    echo "by: " . $row['Author'];
    echo "<br>";
    echo $row['Content'];
    echo "<br><br>";
}

<!-- // Or Even Better // -->
foreach($result as $row) {
    echo "<div class='post'>";
    echo "<h2>" . $row['Title'] . "</h2>";
    echo "<p>by: " . $row['Author'] . "</p>";
    echo "<p>" . $row['Content'] . "</p>";
    echo "</div>";
}

All I've done in the second one is neatened up your HTML. Instead of <br> tags, use CSS and put a bottom margin on div.post.

To get the last post (like in your little model), you would need a second query.

mattster 195 Practically a Master Poster Featured Poster

I think I can sort of see what you're asking, you mean do something like this? (ref)

$type = '123';
$name_123 = 'hello';

echo ${"name_$type"} . "\n";

// prints "hello"

When @MDUK says "quite messy", he really wasn't joking. Thats a complete mangled mush, and very awkward to work with. I cannot stress enough how important it is to look into basic OOP for PHP - just because it's optional does NOT mean it should be forgotten/omitted. It's a great way to neaten your code and speed up your app, especially since you'll have hungry gamers really testing it's performance using it hard on your Mincraft server.

At least that way you can get rid of the massive (and completely unnecessary) while loops. Also note, lines 125-135 can seriously be cleaned up - and don't forget to close attributes (i.e. line 126 echo "<span style='width:" . $pb . "%>"; should be echo "<span style='width:" . $pb . "%'>";).

mattster 195 Practically a Master Poster Featured Poster

Important to note:

You've got $result containing the query results for an entire row that matches the username, not the password.

Also, avoid md5() at all costs, you need to be using another encryption method (since md5 is old, outdated and insecure). Loot at the PHP hash() function.

mattster 195 Practically a Master Poster Featured Poster

Add this somewhere in your stylesheet, or find it in the bootstrap CSS file (usually line 5 of bootstrap.min.css) and change it there.

.navbar-default {
    background-color: #f8f8f8 !important;
    border-color: #e7e7e7 !important;
}
mattster 195 Practically a Master Poster Featured Poster

In addition to Laravel, since it seems to be having a few "teething problems" with version 5, consider other frameworks.

IMHO, CakePHP is the leading PHP framework for novices. It has amazing docs, and is a very constrictive framework. While this may be a tad awkward for some experienced developers, it forces good habits. As long as you follow the docs, you cannot possibly produce anything other than efficient, secure code. They provide a few tutorials and tons of code examples to help you out.

Another member, @iamthwee, tried a similar project a few weeks back - see it here. You just have to remember it's a massive task and you've got some serious competition out there.

I would suggest approaching it simply, build a blog (from the CakePHP docs even ;p). Then add to it, so you can edit pages etc. Don't try and bite wayy more than you can chew and get bored of it - cos hey - thats no fun.

Hope this helps, and good luck!

mattster 195 Practically a Master Poster Featured Poster

Dont forget to take a look at the font awesome library!

To use it, shove this in your <head> section:

<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">

Then do this wherever you want to use an icon:

<!-- Instead of this -->
<span class="icon-home"></span>

<!-- Use this -->
<i class='fa fa-home'></i>

Then you can chage the colour of the icon so its the same as your text etc., loads of tutorials online and great to play around with. See here.

Elvi commented: THANK U SO MUCH! +0