Jump to content

mike12255

Members
  • Posts

    439
  • Joined

  • Last visited

  • Days Won

    1

mike12255 last won the day on December 8 2013

mike12255 had the most liked content!

Profile Information

  • Gender
    Not Telling

mike12255's Achievements

Advanced Member

Advanced Member (4/5)

1

Reputation

  1. I think I understand what your going for, just to be sure could you post your code please? also code like this: $ttl_inc_val = $_POST['ttl_inc] + $inc1 + $inc2 + $inc3; what is ttl_inc? have you already defined $inc1, $inc2, $inc3 through post variables above this code?
  2. I would also recommend moving to mysqli. Your application with become obsolete in the near future if you dont.
  3. I honestly recommend you remove the credentials and change both the username and password. Also you might want to find a new forum to ask for help. Begging for people to do your work on this forum does not get you far.
  4. So ive started taking a crack at learning javascript/ajax and am trying to make a simple chat box. I got this script *almost* working flawless. What I want to do right now is make the script run my function that loads messages every three seconds. I read online about the setinterval function however this makes my post function post the same item multiple times. Also when you first load a page it doesnt show anything in the chat box for three seconds: <script> $(document).ready(setInterval(function() { $("#messageContainer").load('chat_process.php?a=load'); $("#formsubmit").submit(function() { $.post('chat_process.php?a=post', $('#formsubmit').serialize(), function (data){ document.getElementById('Message').value ="Message"; }); return false; }); },3000)); </script> Would it be best practice to make another document.ready and place the post call in that without an interval function?
  5. Thanks for giving me a suggestion of where to look. I marked this as solved I need to get to bed. If in the morning I cannot find a solution ill post more code and unsolve it
  6. Its time for bed but I have to finish this file before I go to bed and I cant figure out the mistake with my query hoping there are some fresh eyes out there that can see it. Here is the line : $query = $qls->Security->make_safe("INSERT INTO `{$qls->config['sql_prefix']}chat` (username, message) VALUES (\"$user\", \"$message\")"); when I die the statement I get: I can take that and query that in through php my admin no problem but when i run a query through php code I get the error:
  7. The above solution will work. It is best practice to use underscores ( _ ) rather then dashes for mysqli table names
  8. Was an error with my .htaccess, had a space where I shouldnt have.
  9. So im still playing around with this MVC stuff think im starting to understand/get the hang of it! The issue im currently having is getting the CSS file to work! I have my header and footer in their own files so I call them both when I load pages. All three objects being called are supposed to be linked to: public/css/default.css. my header file looks like this: <!doctype html> <html> <head> <title><?=(isset($this->title)) ? $this->title : 'MVC'; ?></title> <link rel="stylesheet" href="<?php echo URL; ?>public/css/default.css" /> <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/themes/sunny/jquery-ui.css" /> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script> <script type="text/javascript" src="<?php echo URL; ?>public/js/custom.js"></script> <?php if (isset($this->js)) { foreach ($this->js as $js) { echo '<script type="text/javascript" src="'.URL.'views/'.$js.'"></script>'; } } ?> </head> <body> <?php Session::init(); ?> <div id="header"> <?php if (Session::get('loggedIn') == false):?> <a href="<?php echo URL; ?>index">Index</a> <a href="<?php echo URL; ?>help">Help</a> <?php endif; ?> <?php if (Session::get('loggedIn') == true):?> <a href="<?php echo URL; ?>dashboard">Dashboard</a> <a href="<?php echo URL; ?>note">Notes</a> <?php if (Session::get('role') == 'owner'):?> <a href="<?php echo URL; ?>user">Users</a> <?php endif; ?> <a href="<?php echo URL; ?>dashboard/logout">Logout</a> <?php else: ?> <a href="<?php echo URL; ?>login">Login</a> <?php endif; ?> </div> <div id="content"> When I view page source it looks like this: <!doctype html> <html> <head> <title>Login</title> <link rel="stylesheet" href="missednote.com/public/css/default.css" /> <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/themes/sunny/jquery-ui.css" /> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script> <script type="text/javascript" src="/public/js/custom.js"></script> </head> <body> <div id="header"> <a href="/index">Index</a> <a href="/help">Help</a> <a href="/login">Login</a> </div> <div id="content"> <h1>Login</h1> <form action="login/run" method="post"> <label>Login</label><input type="text" name="login" /><br /> <label>Password</label><input type="password" name="password" /><br /> <label></label><input type="submit" /> </form></div> <div id="footer"> (C) Footer </div> </body> </html> I don't understand this maybe the htaccess file wont let it access the css file directory properly, could that be it? I am not familiar with the htaccess file and found one on the internet that I thought did what I wanted. A live version of my test can be seen at: http://www.missednote.com/login/
  10. Im really not sure what your asking remember your talking to people who have no idea what your end goal is I think I did read one part correctly, you want to retrive things from the database and list them in alphabetical order? you want to use the ORDER by clause ex: "SELECT * FROM `Some_Table` ORDER BY `Name` ASEC" <-- would list entries by alphabetical order. Although if you have very limited php/mysql knowledge Im not sure you will be able to do everything you want. Also not many people like writing code for someone but rather helping them understand theories or better methodology. And in my personal opinion and I think many other would agree, when it comes to a database no matter who should be able to access it security is always essential! Also after a quick browse through the script you uploaded unless there is a lot more that you just have not shown us I dearly hope you did not pay more then $20 for that the code is not complex.
  11. Thanks a lot for the info on codeignitor, the reviews I read (from recent dates) failed to mention that.
  12. Im trying to convert myself to this MVC style coding as well as using frameworks. (Currently learning codeigniter) anyway I was wondering if there was any generally accepted rules on how to load views. should I separate my header, footer, sidebars, and mainpage all into their own templates and load them together or is it best practice to combine those all into one template and just load one thing? Appreciate the replies Thanks, Mike
  13. I have setup the connection in a seperate file (tested it is working) with the following code: function MySQLDB(){ /* Make connection to database */ $this->connection = new mysqli( DB_SERVER, DB_USER, DB_PASS, DB_NAME) or die ('Cannot open database'); //mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error()); // mysql_select_db(DB_NAME, $this->connection) or die(mysql_error()); So when I changed my code in my index file to $session->connection; $result = $connection->query($sql); While ($row = $result->fetch_array(MYSQLI_BOTH)){ echo "<li class=\"clear\">"; if ($img = $row['image'] != ""){ echo "<div class\"imgl\"><img src=\".$img.\" alt=\"\"/></div>"; } echo "<div class=\"latestnews\">". "<p><a href=\"news.php?id=".$row['id'].">".$row['title']."</a></p><p>".$row['content']."</p></div>"; } $connection->close(); Im sure my issue is when trying to use $connection as my database connector im just not sure why/what I am doing wrong?
  14. Hey there im trying to change my website from mysql statments to mysqli. I tried changing one of my simple statments to get some news from the db and im running into the following error: Here is the code I am using, does anyone know what/why the error is producing: $sql = "SELECT * FROM news ORDER by id DESC LIMIT 2,0"; $result = $mysqli->query($sql); While ($row = $result->fetch_array(MYSQLI_BOTH)){ echo "<li class=\"clear\">"; if ($img = $row['image'] != ""){ echo "<div class\"imgl\"><img src=\".$img.\" alt=\"\"/></div>"; } echo "<div class=\"latestnews\">". "<p><a href=\"news.php?id=".$row['id'].">".$row['title']."</a></p><p>".$row['content']."</p></div>"; }
×
×
  • 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.