mmcdonald 28 Posting Pro

Get you output some errors please and tell us exactly what isn't working clearly.

Do you have a table called members? Do you have a column called email? Do you have a collumn called password? Are you sure you're meant to be checking the email column as the value 'wareez' isn't an email but a username.

Something I personally stick to.. instead of this:

(fname, lname, address, city, contact, email, password, gender, bday, profilepic, coverphoto)

this:

(`fname`, `lname`, `address`, `city`, `contact`, `email`, `password`, `gender`, `bday`,  `profilepic`, `coverphoto`)

You should focus on outputting error messages.

mmcdonald 28 Posting Pro

We need to see some code. I'd also add some spaces to your query... Please add your form processing code and your actual form code. It would also be good if you get a PHP or SQL error to us. Just for easy reading and to avoid syntax issues:

"SELECT * FROM `members` WHERE `email` = 'wareez' AND `password` = 'lord'"

Also instead of SELECT * just select one field such as the SELECT username or even better the rows id.

mmcdonald 28 Posting Pro

Into your loop or any theme template file on that note:

the_post_thumbnail();                  // without parameter -> Thumbnail

the_post_thumbnail('thumbnail');       // Thumbnail (default 150px x 150px max)
the_post_thumbnail('medium');          // Medium resolution (default 300px x 300px max)
the_post_thumbnail('large');           // Large resolution (default 640px x 640px max)
the_post_thumbnail('full');            // Original image resolution (unmodified)

the_post_thumbnail( array(100,100) );  // Other resolutions

The last one will probably help you. Also, nothing on DaniWeb is urgent :)

G'day

mmcdonald 28 Posting Pro

How many monitors are plugged in?

mmcdonald 28 Posting Pro

I've never come across a coverage map but this a linux WiFi scanner: http://kuthulu.com/iwscanner/index.php

I did just come acorss this sexy looking script though, could possible help someone: http://code.google.com/p/wifisigmap/

mmcdonald 28 Posting Pro

Is this not viable?

public:
   void theFunction()
   {
      MessageBox::Show("This is a sexy message", MessageBoxButtons::OKCancel,
         MessageBoxIcon::Asterisk);
   }

Or am I well off... I could be (I'm a total C++ novice)

mmcdonald 28 Posting Pro

Plug the monitor into another PC if you have one to test. Try a new cable incase the current one is faulty. Triple check that the video card the port is on is actually enabled. Make sure the cable is snug in both the monitor and the video port. Try another video port if you have one. Connect the external monitor to a laptop if you don't have another desktop? Try lots of different scenarios to troubleshoot.

mmcdonald 28 Posting Pro

This is so very concerning - especially when the value of most companies lies in one asset: their data! I've always taken security very seriously and for that reason wouldn't open a single office without having a dedicated security professional. A 2nd/3rd line support technician jst doesn't cut it (and neither does a firewall for all you lazy individuals out there!).

I wouldn't actually be surprised if the majority of data leaks are physical and were the fault of arrogant employees who fail to see the sensetivity of most documents.

mmcdonald 28 Posting Pro

I've used this one before and it was dead easy to use. It was quite a clean and tidy addition to one of my major forms.

mmcdonald 28 Posting Pro

@KingGold

You've ignored the two posts above yours - the reserved keyword use was entered into his SQL query; you've also done the same thing in your response therefore it still wouldn't work..?

KingGold171 commented: The 2 above comments weren't there when I orignally posted. +0
mmcdonald 28 Posting Pro

I've recently used many of the Nokia Lumias and they're really great devices. Easy to use, configure and very strong! (I'm clumbsy and they survived).

I would also recommend the HTC One X+ it's a great phone and my current device, android OS too which is the cherry on top. I'm kind of gutten to be honest, I got the X+ and then found out about the One. HTC One is a beautiful device - it's a full metal body lasered out of a single block; so stong! Great OS, durable and easy to use.

Here's a good review: http://www.anandtech.com/show/6747/htc-one-review

mmcdonald 28 Posting Pro

Ignore this topic people - multiple post. The issue was the use of the reserved keyword use in his query. See here: http://www.php.net/manual/en/reserved.keywords.php

mmcdonald 28 Posting Pro

Cereal is spot on - use is a reserved keyword for PHP. For all reserved keywords check here: http://www.php.net/manual/en/reserved.keywords.php

mmcdonald 28 Posting Pro

You're spot in diafol but WP has all of these functions built in and it's better to use them as then your WP site will work with any plugin or theme. When you start going beskope you get grey hairs :)

mmcdonald 28 Posting Pro

Change

($wp_query->current_post + 1) < ($wp_query->post_count)

to

($wp_query->current_post) < ($wp_query->post_count)

see if that works.

mmcdonald 28 Posting Pro

Your question isn't amazingly clear; but if I'm understanding it correctly you'd like your recent posts?

<?php wp_get_recent_posts( $args, $output ) ?>

Example below will show 10 recent posts:

<h2>Recent Posts</h2>
<ul>
<?php
    $recent_posts = wp_get_recent_posts();
    foreach( $recent_posts as $recent ){
        echo '
                <li>
                    <a href="'.get_permalink($recent["ID"]).'" title="Look .esc_attr($recent["post_title"]).'">' .   
                        $recent["post_title"].'
                    </a> 
                </li> 
            ';
    }
?>
</ul>

See ref

mmcdonald 28 Posting Pro

You're such a sexy member it's unreal! You're spot on and that worked a treat. Thank you so very much

mmcdonald 28 Posting Pro

This might help me out, for anyone else who'd like to see in the future:
JS variabel in SQL Query -I'm going to try it now -.-

mmcdonald 28 Posting Pro

A few people have told me it's this:

function jstophp(){

var javavar=document.getElementById("text").value;  

document.getElementById("rslt").innerHTML="<?php 
$phpvar='"+javavar+"'; 
echo $phpvar;?>";
}

But I can't understand how I could use it as this example called on an element called rslt what wasn't a variable to begin with.

What I ultimately need to be able to do is use a javascript variable in a standard mysqli query.

mmcdonald 28 Posting Pro

Hi Jorge,

I'm very familiar with $_GET and I've used it thousands of times in my scripts. The issue is that the page doesn't actually get reloaded. I'm dealing with two PHP files that contain a lot of HTML. These files are simply shown and hidden by JavaScript in one single file.

The system is a mailbox, where all the action occurs without a page load.

$id = $_GET["id"] won't work as we're not executing a URL change.

Think of your inbox, you have a list of emails. When a user clicks one of those emails I need to collect the messages unique ID which is currently $messages['id'], store it as a client side variable, and then call on it when javascript has finished loading the next file in order to retreive sql data using that unique ID.

All of this occurs in inbox.php... but inbox.php shows and hides two files:
1) inbox_inbox.php <-- loops users messages
2) inbox_view.php <-- shows the content of one message.

the variable $message['id'] is available in inbox_inbox.php but not inbox_view.php. I need to store the variable client side for use. I just don't know how to store the variable in JS and then call it back in the next file for the SQL query.

I hope that's a little clearer. Thanks for your help!

mmcdonald 28 Posting Pro

Hi Jorge,

Thanks for your solution - it does work indeed. It also reveals that I've been approaching this the wrong way from the beggining. What I would like to do is create a variable on this file so it can be used in another. Whilst this is probably a simple task I'm foreign to JS. At the moment I have the variable available in JS and need to add it into a mysqli where clause.

How would one go about this?

I've thought along the lines of WHERE id = <script>document.write(messageId)</script> but this doesn't work - probably for obvious reasons that I'm unaware of.

I've done a few google searches and everyones doing it differently. I've tried allying their examples and had no luck.

How would you advise I proceed?

Thank you,
M.

mmcdonald 28 Posting Pro

All I'm getting at the moment is the page loading with the content as inbox_view.php?id=4. It's not opening inbox_view.php just opening inbox.php with inbox_view.php?id=4 printed on the page. Nothing else loads or displays. Any ideas?

mmcdonald 28 Posting Pro

You're a god JorgeM! thank you :D that's fixed 90% of the error :) I'll keep updating this topic

mmcdonald 28 Posting Pro

I've got this this at the moment:

I've added the unique message ID in inbox.php using:

<input class="inbox-messageId" type="hidden" value="'.$message['id'].'" />

and I'm trying to collect it in inbox.js using:

        var messageId = $('.inbox-messageId');
        var file = 'inbox_view.php?id=';
        var url = document.write(file + messageId); 

then uthe var url is called to load inbox_view.php?id=[unique message ID]

It's obviously not working. Any idead how you do this DW?

mmcdonald 28 Posting Pro

I'm having difficulty opening message content for each unique message because I'm struggling to get the PHP variable $message['id'] to a url defined in a javascript file.

My foreach loop that echos out all of the messages for the user:

foreach($mess_data as $message){

    echo'
        <tr '.(($message["read"] == '0') ? 'class="unread"' : 'class=""').'>
            <td class="inbox-small-cells">
                <input type="checkbox" class="mail-checkbox">
            </td>
            <td class="inbox-small-cells">'.(($message['read'] == '0') ? '<i class="icon-envelope"></i>' : '<i class="icon-eye-open"></i>').'</td>
            <td class="view-message  hidden-phone">'.$message['from'].'</td>
            <td class="view-message ">'.(($message['subject']) ? ''.$message['subject'].'' : 'This message has no subject.').' </td>
            <td class="view-message  inbox-small-cells"><!--<i class="icon-paper-clip"></i>-></td>
            <td class="view-message  text-right">'.$message['time'].' '.$message['date'].'</td>
        </tr>';

    }
}

including the JS files:

<script src="assets/plugins/jquery-1.10.1.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>
<script type="text/javascript" src="assets/scripts/**inbox.js**"></script>

calling on the JS function:

jQuery(document).ready(function() {       

   Inbox.init();

});

A snippet from inbox.js (the line I need to get $message['id'] into from PHP is marked out by <----)

var Inbox = function () {

var content = $('.inbox-content');
var loading = $('.inbox-loading');

var loadMessage = function (name, resetMenu) {
    var url = 'inbox_view.php?id=[I NEED TO GET UNIQUE ID HERE FROM PHP];   <---- the problem!

    loading.show();
    content.html('');

    $.post(url, {}, function (res) {
        if (resetMenu) {
            $('.inbox-nav > li.active').removeClass('active');
        }
        $('.inbox-header > h1').text('View Message');

        loading.hide();
        content.html(res);
        App.fixContentHeight();
        App.initUniform();
    });
}

};

}();
mmcdonald 28 Posting Pro

Sorry I know this topic is 2 months old but this might help someone. Always encode JS variables with JSON when creating a JS variable from a PHP variable. See below:

instead of: var meat="<?php echo $meat; ?>";

do this: var meat="<?php echo json_encode($meat); ?>";

mmcdonald 28 Posting Pro

ahaaaa don't worry peeps found a solution: JS Fiddle

mmcdonald 28 Posting Pro

Hi all,

I'm currently looking at this JSFIDDLE and it's 50% of what I need.

I have a series of Accordions on my page (a list of courses). What I would like to do is assign these accordians to categories so that when a checkbox is pressed with the id of security any accordians with the security tag will show. If someone checks security and cisco all accordions with cisco AND security will show and so forth.

If you don't wan to open the JS Fiddle... the HMTL:

<input type="checkbox" id="set_1" checked> click to show text1
<p class = "wpbook_hidden wpbook_option_set_1"> This is option one</p>
<p class = "wpbook_hidden wpbook_option_set_1"> This is another option one</p>
<input type="checkbox" id="set_2"> click to show text1
<p class = "wpbook_hidden wpbook_option_set_2"> This is option two</p>

The JS:

$('.wpbook_hidden').hide();

$(':checkbox').change(function() {
    changeCheck(this);
});

$(':checkbox:checked').each(function(){
    changeCheck(this);
});

function changeCheck(x) {
    var option = 'wpbook_option_' + $(x).attr('id');
    if ($('.' + option).is(':visible')) {
        $('.' + option).fadeOut();
    }
    else {
        $('.' + option).fadeIn();
    }
}

This would be awesome, thanks!

mmcdonald 28 Posting Pro

Welcome to DaniWeb! Your reading and searching is about to become reading, searching and asking!

mmcdonald 28 Posting Pro

Been trying to get this working for a few hours now but can't seem to get a result. Any advice would be welcomed with open arms! I'm using the JQuery Validation Plugin: http://jqueryvalidation.org/validate/. I have included the following into my file:

<script src="assets/plugins/jquery-1.10.1.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-validation/dist/jquery.validate.min.js" type="text/javascript"></script>
<script type="text/javascript" src="assets/plugins/jquery-validation/dist/additional-methods.min.js"></script>

My form:

<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" class="form-vertical" name="personalInfo" id="personalInfo">

    <label class="control-label">First Name</label>
    <input type="text" class="m-wrap span8" name="fn" id="fn" value="<?php echo $userInfo['fn'] ?>"/>

    <label class="control-label">Last Name</label>
    <input type="text" class="m-wrap span8" name="ln" id="ln" value="<?php echo $userInfo['ln'] ?>"/>

    <label class="control-label">Email Address</label>
    <input type="text" class="m-wrap span8" name="email" id="email" value="<?php echo $userInfo['authemail'] ?>"/>

    <label class="control-label">Mobile Number</label>
    <input type="text" class="m-wrap span8" name="authmob" id="authmob" value="<?php echo $userInfo['authmob'] ?>"/>

    <label class="control-label">Telephone</label>
    <input type="text" class="m-wrap span8" name="authlan" id="authlan" value="<?php echo $userInfo['authlan'] ?>"/>

    <label class="control-label">Company</label>
    <input type="text" class="m-wrap span8" name="company" id="company" value="<?php echo $userInfo['company'] ?>"/>

    <label class="control-label">Occupation</label>
    <input type="text" class="m-wrap span8" name="profession" id="profession" value="<?php echo $userInfo['profession'] ?>"/>

    <label class="control-label">Biography</label>
    <textarea class="span8 m-wrap" rows="5" name="bio" id="bio"><?php echo $userInfo['bio']; ?></textarea>

    <label class="control-label">Website Url</label>
    <input type="text" class="m-wrap span8" name="url" id="url" value="<?php echo $userInfo['url'] ?>"/>

    <label class="control-label">Facebook</label>
    <input type="text" class="m-wrap span8" name="facebook" id="facebook" value="<?php echo $userInfo['facebook'] ?>"/>

    <label class="control-label">LinkedIn</label>
    <input type="text" class="m-wrap span8" name="linkedin" id="linkedin" value="<?php echo $userInfo['linkedin'] ?>"/>

    <label class="control-label">Twitter</label>
    <input type="text" class="m-wrap span8" name="twitter" id="twitter" value="<?php echo $userInfo['twitter'] ?>"/>

    <button type="submit" name="personalInfo" id="personalInfo" class="btn green">
    <i style="margin-right: 12px;" class="icon-save"></i> Save Information 
    </button>

</form>

My JavaScript using the plugin:

   $('#personalInfo').validate({
        errorElement: 'label', //default input error message container
        errorClass: 'help-inline', // default …
mmcdonald 28 Posting Pro

Also, though off-topic, isn't it safer/more reliable to use:

if(isset($_POST['userfile'])){

in comparison to:

if ($upload == 'Upload'){

mmcdonald 28 Posting Pro

It means that the index userfile has no value.

As Unimportant states are the following snippets in the same file?:

    <?php
    $fName = $_FILES['userfile']['name'];
    $tmpName = $_FILES['userfile']['tmp_name'];
    $japSize = $_FILES['userfile']['size'];
    $uploadDir ="/srv/www/htdocs/dirupload";
    $filePath = $uploadDir . $fName;
    if ($upload == 'Upload')
    {
    if ($fName == '' )
    {
    echo "<script>alert('Please complete the information!')</script>";
    }else{
    $result = move_uploaded_file($tmpName, $filePath);
    if (!$result)
    {
    echo "<script>alert('Error Uploading File!')</script>";
    exit;
    }else{
    echo "<script>alert('Uploading of file successful')</script>";
    }
    }
    }
    ?>

and this:

    <form method="post" enctype="multipart/form-data">
    Press browse to select what file to upload:
    <input name='userfile' type='file' id='userfile' size="45">
    <input name='upload' type='submit' class='box' id='upload' value='Upload'>
    </form>
mmcdonald 28 Posting Pro

Yeah couldn't agree more bud - thanks for looking into it though!

mmcdonald 28 Posting Pro

OMG I figured it :3 My business partner opened the file whilst I was tucking into dinner and changed login.js but he left an error! He called me to tell me he'd changed a few things so I went through the script character by character and found a mising comma! What a bugger! The reason the .zip didn't work was my fault... I was working from a zip he'd taken and not the original files. he's literally ruined my night.

Talk about aone man topic!

This is me signing out :)

mmcdonald 28 Posting Pro

I've uploaded to a webserver - it didn't work.

I've tried another PC - it didnt work.

It has to be the code. It makes no sense because I haven't touched the original files (they're still zipped)... I extracted them and they didnt work either...

mmcdonald 28 Posting Pro

I'm just uploading the project to my webserver for the first time to test it. If it works I know it's something at the core (In xampp) or something blocking it on my PC. If it doesnt work I'll try another PC incase its a local browser/PC issue. If neither work then I'm stuffed.

mmcdonald 28 Posting Pro

No everything is coming locally - and I'm in the same thought process as you - things don't just stop working! I know it's not my code or something I've changed as I opened the source template that I purchased a week back and added it to a new local directory. That didn't work either. I'm going to disable a load of programs and retest.

mmcdonald 28 Posting Pro

I should say that the page loads, but when I click anything to do with JS it just doesnt respond.

mmcdonald 28 Posting Pro

Hi all,

My local development project has been working perfectly for...6 days now? I haven't even touched the login/register page for 2 days+ yet all of a sudden all JavaScript has seized up! I've been using the page to login all day and only now has it stopped working.

I'm using JQuery to manage what form is present based on button clicks and this has been working perfectly. here is one example:

jQuery('#register-btn').click(function () {
    jQuery('.login-form').hide();
    jQuery('.register-form').show();
});

The button that calls this JQuery:

<div class="create-account">
    <p>
        Don't have an account yet ?&nbsp; 
        <a href="javascript:;" id="register-btn" class="">Create an account</a>
    </p>
</div>

Now when that button is lciked nothing happens. Again, the problem is now with any of the code above as all JavaScript has stopped working. This includes the fading background:

$.backstretch([
    "assets/img/bg/1.jpg",
    "assets/img/bg/2.jpg",
    "assets/img/bg/3.jpg",
    "assets/img/bg/4.jpg"
    ], {
      fade: 2000,
      duration: 4000
  });

I'm working on Windows 8 and using XAMPP. I have tested this in all 4 of my installed browsers (Chrome, Firefox, Safari & Opera). What can cause JavaScript to just stop working? I have attempted a machine restart as well as an apache2 restart. Google searches don't seem to be getting me anywhere.

Thanks in advance for any help.

mmcdonald 28 Posting Pro

Thank you @JorgeM, I've made the change but the problem still occurs. I must say that I added that JS script by myself so it may not be required. I might be looking at this in the wrong way entirley. Does anyone know a method of hyperlinking to another tab outside of a nav class?

mmcdonald 28 Posting Pro

Hey all,

I'm trying to make a link outside of the nav-tabs class, specifically in a paragraph, that changes to another tab on the same page.

Granted that I know this requires JS and that I know nothing of JS (Another book i ordered this morning :) ) here is what I've tried (with partial success):

My link: <a class='tab-switch' href='#tab_1_3' data-toggle='tab'>biography</a>

My JS:

        $('.tab-switch a').on('click', function (e) {
            e.preventDefault();
            $(this).tab('show');
        });

    });

What currently happens:
When the link is clicked the CONTENT of the tab changes (woop!) but the tab NAV <li> doesn't change. So I'm seeing the right content but the actual tab at the top doesn't change.

Which oracle will save me this time? :)

mmcdonald 28 Posting Pro

Hi all!

I'm trying to validate this form:

<form action="<?php $_SERVER['PHP_SELF'] ?>" class="horizontal-form" name="settings" id="settings" method="post">
    <div class="row-fluid">
        <div class="span4 ">
            <div class="control-group">
                <label class="control-label" for="firstName">First Name</label>
                <div class="controls">
                    <input type="text" id="fn" class="m-wrap span12" value="<?php echo $userInfo['fn']; ?>">
                </div>
            </div>
        </div>
    </div>
</form>

I've added my validation js files.. These are the main vaildation files:

  • <script src="assets/plugins/jquery-validation/dist/jquery.validate.min.js" type="text/javascript"></script>
  • <script type="text/javascript" src="assets/plugins/jquery-validation/dist/additional-methods.min.js"></script>

This one validates this particular form:

  • <script src="assets/scripts/settings.js" type="text/javascript"></script>

In this file settings.js I have this (Just a snippet):

var validateSettings = function () {

    return {
        //main function to initiate the module
        init: function () {

            var settingsForm = $('#settings');

            settingsForm.validate({
                errorElement: 'label', //default input error message container
                errorClass: 'help-inline', // default input error message class
                focusInvalid: false, // do not focus the last invalid input
                ignore: "",
                rules: {
                    fn: {
                        required: true,
                        lettersonly: true,
                        minlength: 2
                    }

    },

            messages: {
                fn: {
                    required: "Please enter your first name.",
                    minlength: "Minimum of 2 characters."
                } 
            },

            invalidHandler: function (event, validator) {   

            },

            highlight: function (element) { // hightlight error inputs
                $(element)
                    .closest('.control-group').addClass('error'); // set error class to the control group
            },

            success: function (label) {
                label.closest('.control-group').removeClass('error');
                label.remove();
            }
        });
    }
        /*IGNORE ALL OF THESE BRACKETS, I CUT A LOT OF THE FILE OUT*/
};

}();

At the end of the page containing the form I execute the vaidation using:

    <script>
        jQuery(document).ready(function() {    
           validateSettings.init();
        });
    </script>

The form is much larger but I've seletced one field from each file …

mmcdonald 28 Posting Pro

haha shot down! Why can't admins/mods instantly delete topics like this? Makes the real threads stand out.

mmcdonald 28 Posting Pro

I'm not too sure how you're thinking of doing it but if this was me I would collect years of experience in the job they are applying to, their age (could break certain discrimination laws), their location by postcode and similar variables when they apply. I would then enter desirable figures when I'm filtering (I.E. I'm looking for a mature individual (say, 30), with 6 years experience in the industry and no more than 30 miles from my office.). I would then execute a PHP script that would find the best matching individual and list the next best belo and so forth. I couldn't see it being done any other way without some sort of NASA standard algorithm. Don't take my word for it though as I'm quite new to this too.

I built the ranking algorithm at http://vote4mc.com and it's a similar thing but for gaming servers rather than people.

mmcdonald 28 Posting Pro

Pass... blocks look fine. Did you cut out some of your error?

Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\

Error could be in an include rather than this script.

mmcdonald 28 Posting Pro

I'm not too sure here. Could this be down to deprecation causing a stray curly brace? It would be really helpful to see the code.

mmcdonald 28 Posting Pro

I believe this may be to expose the link in his sig. @Yirilryn, if you have a question feel free to come back and elaborate!

mmcdonald 28 Posting Pro

First Google search returned this. It has the source and a working example. Let me know if it doesn't suit your needs.

mmcdonald 28 Posting Pro

I support @Unimportants answer. If your form is on the same file as the processing script above you'll need: action="<?php $_SERVER['PHP_SELF']; ?>"

mmcdonald 28 Posting Pro

You're spot on! You won't learn faster anywhere else. If I've learnt one thing here it's that respect the comminity and they respect you back :) Ask the right questions and your learning curve will spike.

Welcome to DaniWeb

happygeek commented: well said! +0