-
Posts
840 -
Joined
-
Last visited
-
Days Won
1
Everything posted by gristoi
-
dependancy injection is definately the way to go. if you need to use a blank object you can instantiate an instance of stdClass()
-
sort($array, SORT_FLAG_CASE);
-
well there is your problem, look at the method mysql_select_db the clue is in the name, you are trying to set the db to use with your table name. set the correct db name. also PravinS is correct, you shouldnt be using variable strings in database connection. this leaves you wide open to sql injection and other vulnerabilities
-
i personally like to use this approach to make it stand out a little more : echo "<tr><td>$prog_name</td><td><a href={ htmlspecialchars($_SERVER["PHP_SELF"]) }?id={ $title }'>EDIT</a></td></tr>";
-
remember you have to have jquery included at the top of your site. have a google on setting up jquery
-
ok, first thing, bin off all of the XMLHttpRequest crap, is old hat. Nowadays pretty much everyone uses jquery to handle this. you want to do something like this: $(document).ready(function(){ $('#shortlist').click(function(){ var listId = $(this).attr('id'); var self = $(this); $.ajax({ url:"your url", data:{id:listId}, type:'post', success:function(result){ self.html(result); var divOnTheRight = $('#rightList'); divOnTheRight.append(result); }}); }); // you can make as many ajax requests as you want this way hope it helps
-
is your server set up to use smtp, also: <button type="submit" name="submit" class="btn btn-primary pull-right">Submit</button>
-
you have said what you are trying to do, but what is the actual issue you are having?
-
nope, not a clue.
-
you need to learn how to use forms in php. mainly with the <form> tag. if you want to sumbit via ajax then you need to look at a jquery solution
-
php code run 100% in localhost, but in cpanel no
gristoi replied to linuxfreakphp's topic in PHP Coding Help
you need to make your path seperators language agnostic. use DIRECTORY_SEPERATOR -
wow, i wish i had an extension that wrote my OOP for me, damm all those years learning to write code.
-
you're looking for a CRM not a CMS
-
get the Textbox attribute names as well as values
gristoi replied to NaniG's topic in Javascript Help
use jquery: var input = $('#someId'); var type = input.attr('type').val(); var name = input.attr('name').val(); var maxLength = input.attr('maxLength').val(); .... build json string- 2 replies
-
- textbox
- attributes
-
(and 2 more)
Tagged with:
-
change <form id="contactform"> to <form id="contactform" method = 'POST' action='contactform.php'> ( this is given that the index file and php file are in the same directory) but looking at the form it has onClick="return check_values();" this is a javascript event, so you need to make sure the form is not being submitted using AJAX
-
try: //change this <input type="button" value="Submit" onclick="submit_info()" /> // to this <a href="#" id="submitInfo">Submit</a> // then your javascript $(document).ready(function(){ $('#submitInfo').click(function(e){ e.preventDefault(); var data = $('#genit').serialize(); .............. // your ajax call here }); }); modern javascript should be event driven, s you shouldnt be polluting your html with stuff like onclick=... etc.
-
public function __clone() { throw new Exception( "you are not allowed to clone this object" ); }
-
Do I use a MVC framework for dynamic sites or apps?
gristoi replied to smudgie's topic in Frameworks
MVC is just a design pattern. If you want to use this pattern along with a single page app then you want to seperate the client from the server side completely. You want to look at using a RESTful approach to getting your data. So your server side can be any kind of framework ( or bespoke ) such as zend / symfony / laravel. The Model part of the server side will hold all of the business logic ( communicating with the db etc), the Controller will take the rest request -> speak to the model -> return the models data to the view, and in your case this would be in a JSON response. So technically no view. heres a good tutorial for doing it using laravel and backbone: http://net.tutsplus.com/tutorials/javascript-ajax/combining-laravel-4-and-backbone/ -
need help can get multiple instances to work!
gristoi replied to jac.kock's topic in Javascript Help
It is 2014 , not 2004. use Jquery to create multiple instances of ajax calls -
<? include_once('includes/config.php'); $increment = 1; //get values of each member $query="SELECT `name`, `price` FROM merchant"; $result=mysql_query($query); $num=mysql_num_rows($result); while ($row = mysql_fetch_array($result)) { $value = (float)$row['price] + (float)$increment; $query2 = "UPDATE merchant SET `price`='$value' WHERE `name`='Harvey Norman' and price ='141.00'"; $result2 = mysql_query($query2); } // close connection mysql_close(); ?>
-
CakePHP says my controller doesn't exist, but it actually does
gristoi replied to CrimpJiggler's topic in Frameworks
your opemning tag in vistors controller: <? class should be <?php class also check the filename does not have a typo -
Which frameworks would you recommend to start with
gristoi replied to CrimpJiggler's topic in Frameworks
I think your understanding of frameworks is slightly skewed. CakePHP is a framework in its own right, you dont need to add other frameworks into it. Frameworks help to make an application scalable, enforce standardisation in your code etc. There are many frameworks out there, you just need to find your best fit. You want a quick blog then use drupal or wordpress. You want to code from the ground up using proven frameworks tend / Symfony / Laravel. -
it may work, but for readability it makes no sense. If you are going to asign the value to a variable then you must want to use it further on in the code. So assign first, then echo out the var. If your not using it anywhere else then it is pointless, just echo out the string
-
Mathematical formula to calculate spikes in line graph data?
gristoi replied to D.Rattansingh's topic in PHP Coding Help
$points = array(34, 23, 96, 54, 44); $spike = max($points); -
Best way to tackle conditional methods oop?
gristoi replied to RuleBritannia's topic in PHP Coding Help
class oop { private $_status; public function __construct() { $this->_status = false; } public function main() { $this->_status = true; } public function subone() { if($this->status) { // do stuff } } public function subtwo() { if($this->status) { // do stuff } } }