Jump to content

gristoi

Members
  • Posts

    840
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by gristoi

  1. <?php foreach ($option['option_value'] as $key => $option_value) { print ( '<pre>' ) ; print_r ($option_value[$key]['name'] .' '.$option_value[$key]['quantity']) ; print ( '</pre>' ) ; } ?>
  2. one direction you could take is something like this: have a select list of all users with the name as the select option and the value as the mobile: <select id="names"> <option value="077451452584">Bob Bob</option> <option value="077451452585">Frank Frank</option> <option value="077451452586">Bertha Bertha</option> </select> <script> $(document).ready(function(){ $('#names').on('change', function(){ var val = $('option:selected', this).val(); alert(val); }); }); </script>
  3. i think you have a bit of a misguided view of what oop is. I advise taking a step back and reading a little more into the concepts of object orientation. I dont think me re writing you attemplt at a class will really benifit you
  4. you beat me to it, the load only assigned the data to the parameters, if you wanted to test it you needed to add return true
  5. <?php /* MySQL Columns & Types Id - Primary Key (Index), Auto Increment - Int (11) Title - Varchar (20) FirstName - Varchar (60) LastName - Varchar (60) */ class client { private $_mysqli; private $_title; private $_firstName; private $_lastName; //Connect to MySQL public function __construct() { $this->_mysqli = new mysqli("localhost", "test", "test", "test"); if ($this->_mysqli->error) { throw new Exception($this->_mysqli->error); } } //These functions build the insert query so they can be called one at a time or all at once public function setTitle($title) { $this->_title = $title; } public function getTitle() { echo $this->_title; } public function setFirstName($firstname) { $this->_firstName = $firstname; } public function getFirstName($te) { echo $this->_firstName; } public function setLastName($lastname) { $this->_lastName = $lastname; } public function getLastName() { echo $this->_lastName; } public function load($client_id) { $data = array(); //the follwoing is on the principle of a single result $query = "SELECT * FROM mysql WHERE id = " . $client_id; $sql = $this->_mysqli ->query($query); if($sql->num_rows > 0) { while ($row = $sql->fetch_assoc()) { $this->_title = $row['title']; $this->_firstName = $row['firstname']; $this->_lastName = $row['lastname']; // now you have done this you will have a populated object. so the get the firstname you do $client->getFirstname() } } else { throw new Exception('client not found'); } } // you should be able to figure the rest out /*public function save() { if ($check->Rows() > 0) { //update $mysqli->query("UPDATE clients SET $cloumns"); } else { //insert $query = "INSERT INTO mysql (".$columns.")VALUES (.".$values.".)"; $mysqli->query($query); } $sql->close(); }*/ }
  6. you need to post this in the freelance section
  7. do some error checking, the error you are getting is because the query could not successfully execute, hence no resource. try this: $result = mysql_query("SELECT Cust_Num, Contact_Name, Contact_Phone from Customer order by Cust_Num") or die(mysql_error()); //that will tell you what is wrong with your query
  8. annaharris: this link is nearly a decade old. and as i stated in my previous post, is a redundant way of doing things. the post was posted APRIL 16, 2004
  9. good bit of code there . what does it do?
  10. Again, Irate, I am afraid that this is not really a popup, it is 2013, not 2003. people tend not to use secondary windows for popups nowadays. With the advancement in client side languages and the common use of ajax the need for this style of 'popup' is now defunct. you don't need to use onclick= within the elements any more, in fact the prefered method is not to have any javascipt in the html at all and bind an event listener to an element and inject what is needed into the DOM. below is a quick example of a jquery dialog ( popup ): <html> <head> <link href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" rel="stylesheet" type="text/css"></link> <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> </head> <body> <button id="myButton">Click Me To Open Dialog</button> <div id="dialog-message" title="Im the title" style="display:none"> <div style="margin-left: 20px;"> <p> Lorem Ipsum. Lorem Ipsum. Lorem Ipsum. Lorem Ipsum. Lorem Ipsum. Lorem Ipsum. Lorem Ipsum. <br /><br /> Lorem Ipsum. Lorem Ipsum. Lorem Ipsum. Lorem Ipsum. Lorem Ipsum. Lorem Ipsum. Lorem Ipsum. </p></div> </div> <script> $(document).ready(function(){ $('#myButton').on('click',function(){ $("#dialog-message").dialog({ modal: true, draggable: true, resizable: false, position: ['center', 'top'], show: 'blind', hide: 'blind', width: 400, buttons: { "Click me to close dialog": function() { $(this).dialog("close"); } } }); }); }); </script> </body> </html> Hope this helps
  11. irate: that is not a popup, that is a new window. if you want a popup you are more than likely referring to some form of modal dialog. Have a google for jquery modal dialog, or bootstrap dialog. that will give you a good starting point
  12. php comes with some helpful constants and methods that can help. the one you will be concerned with is : DIRECTORY_SEPERATOR // an example would be $fileDir = 'dir1'.DIRECTORY_SEPERATOR.'dir2'.DIRECTORY_SEPERATOR.......... and so on so the above would give you dir1/dir2/..... on a linux machine, and is clever enough to translate it to dir1\dir2 on windows
  13. have a look at using jquery datables. it comes with multi column sorting and searching, pagination etc
  14. Sorry, i left my magic insta-learn pills in my other bag
  15. $subject="Thank you for your order" // should be $subject="Thank you for your order";
  16. turn on your error handling on the php page
  17. ok, firstly, my bad. query should read: $sql = "INSERT INTO emails(`player_name`,`email`) values ('{$_POST['playername']}','{$_POST['email']}')"; pay very close attention to the tick marks surrounding player_name and email. they have to be backticks --> ` <--- not single apostrophes -->'<-- so they should be `player_name` NOT 'player_name' .a varchar and text field can both accept nubmers and characters. your sql error is telling you that you have a syntax error, which is what i have described above.
  18. do $sql = "INSERT INTO emails(`player_name`,`email`)('{$_POST[playername]}','{$_POST[email]}')"; mysql_query($sql,$con) or die(mysql_error()); that should give you some inkling as to whats wrong. Also make sure you have the primary key set to auto incriment
  19. ok firstly, jugesh is wrong, when it comes to mixing html and php on a page, if the php is not outputting ( rendering anything then it is irrelevant where it is on the page ) the reason you are getting this error is because you are manyally killing the script: $con=mysql_connect("localhost","dbs_dbs","password"); die("Can not connect: " . mysql_error()); needs to be $con=mysql_connect("localhost","dbs_dbs","password") or die("Can not connect: " . mysql_error());
  20. if your using a direct comparator against true is true then it needs to be === : if(checkEmpty===true && checkNum===true && checkStr===true)
  21. 2 things: 1: <input type="submit" name="submit" // should be <input type="submit" name="submit" /> and: die(Can not connect: " . mysql_error()); // should be die("Can not connect: " . mysql_error());
  22. $cust = $_GET["username"]; $sql = "select * from weight where `username` = '{$cust}'";
  23. And I want a big house and fast car, but i want dosent get. You want help then give more information than just i want!! What framework is the site built in? this would be a good start, or at least the section of code that deals with the routing
  24. use the blur event in jquery
  25. are you running the site from / or app_dev.php? sounds like your getting a fatal error,. have you cleared the cache and updated the schema? php app/console cache:clear --env=dev php app/console doctrine:schema:update --force also look in the app/logs/dev log to see if there is any error being thrown
×
×
  • 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.