Jump to content

gristoi

Members
  • Posts

    840
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by gristoi

  1. All I can advise is either build the forms the way I have done or comment out each of ur elements to see which is causing an issue. And I forgot that if u have your framework set to production, u can set turn startup errors and Display errors from 0 to 1 in your application.ini
  2. errr dont. If someone has filled in incorrect information put error handling in place to tell them
  3. WAMP is apache. It is a bundle of everthing you need. is stands for Windows Apache Mysql Php. But as you have said that everything is working i have had a look at the code you are using. I have corrected some mistakes for you: <?php ini_set('display_errors',1); error_reporting(E_ALL); $con = mysql_connect("localhost","root","orange"); if (!$con) { die('Could not connect: ' . mysql_error()); } echo "Connection established"; mysql_select_db("my_db", $con); $sql="INSERT INTO Persons (FirstName, LastName, Age) VALUES ('".$_POST['firstname']."',''".$_POST['lastname']."',''".$_POST['age']."')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added with name: ". $_POST[firstname].' '. $_POST[lastname]; mysql_close($con) ?> so replace yours with that. One of the problems you had was trying to use php within the sql statement. You need to make sure that the string does not escape. ie <?php $sql ="SELECT * FROM $_POST["table"]"; // will actually translate to : $sql ="SELECT * FROM $_POST[" this is because the double quotes tell the php that this is the end of the string. To get around this you use concatination by adding the '.' around your variable: <?php $sql ="SELECT * FROM ". $_POST["table"] ." "; this is by no means an indepth explination, but a quick search for string concatination in php on google should point you in the right direction
  4. http://www.google.co.uk/search?rlz=1C1CHFX_en-GBGB446GB446&aq=f&gcx=c&sourceid=chrome&ie=UTF-8&q=html+table+design look at that!!! 25,000,00 results in less than 0.25 seconds Im sure google will be your friend if you let it. try using it
  5. ok, you first need to make suret hat your server is operating correctly. what are you using for your php / apacher server. if you are using windows i would advise using WAMP or something similar. if you have only started doing this then maybe it would be a good idea not to dig yourself into a deeper hole trying to fix a server that you may or may not have corrupted without knowing about it. Installing wamp is extremely easy as most of it is done for you. then you just drop you php files into the wamp/htdocs folder.
  6. replace the init part of your form with this. I know this particular form works as i have tested it myself: <?php public function init(){ $title = $this->createElement('text', 'title'); $title->setLabel('Page Title'); $title->setRequired(true); $title->addErrorMessage('You must add a title'); $title->addValidator('stringLength', true, array(0, 250)) ->addFilter('StripTags'); $urlName = $this->createElement('text', 'url'); $urlName->setLabel('Url Safe name'); $urlName->setRequired(true); $urlName->addErrorMessage('You must add a url name'); $urlName->addValidator('stringLength', true, array(0, 250)) ->addFilter('StripTags'); $menuTitle = $this->createElement('text', 'menu_name'); $menuTitle->setLabel('Menu Name'); $menuTitle->setAllowEmpty(true); $menuTitle->addValidator('stringLength', true, array(0, 250)) ->addValidator('regex', false, array('/^[a-z_]\S/i')) ->addFilter('StripTags') ->addFilter('StringtoLower'); $body = $this->createElement('textarea', 'body'); $body->setLabel('Page Body'); $body->setRequired(true); $this->addElements(array($title,$urlName,$menuTitle,$body)); $this->addElement('submit', 'submit', array('label' => 'Submit')); $this->setMethod('POST'); } and tell me if it displays
  7. turn on your error checking and see what else you get back: put these two lines directly under the opening tag <?php ini_set('display_errors',1); error_reporting(E_ALL);
  8. Can u post your form class?
  9. $sql="SELECT CONCAT( get value from other place ) get value from other place , CONCAT(get value from other place ) get value from other place , CONCAT(t.fieldOne,"+",s.FieldTwo ) AS ' get value from other place ' FROM survey s JOIN adminTable t USING(id) WHERE get value from other place like 'get value from other place %' ORDER BY datum DESC"; hope that helps
  10. do you have the same version of php on each server.
  11. <?php if (!defined('SMF')) die('Hacking attempt...'); try: if (!defined('SMF')) { die('Hacking attempt...'); }
  12. what thehippy is trying to say is that Zend framework uses namespacing autoloading for files. so a class called MY_NEW_CONTACTS_CONTACTFORM would tell zend to look in the following folder structure: My |--NEW |--CONTACTS |--CONTACTFORM.php look at how your forms class is named. I normally add this into my bootstrap.php for most projects: <?php protected function _initAutoLoad(){ $resourceLoader = new Zend_Loader_Autoloader_Resource(array('basePath'=>APPLICATION_PATH,'namespace'=>'')); $resourceLoader->addResourceType('model', 'models/','Model_'); $resourceLoader->addResourceType('form', 'forms/','Form_'); } ?> this tells the framework where to look for specific files. So anything that begins with FORM_ will be in the APPLICATION_ROOT/forms folder. So a test form : <?php class Form_MyForm extends Zend_Form{ } means that the form is in forms APPLICATION_ROOT/MyForm.php
  13. instead of $concertNaam = mysql_result($geladenEvenement, $i, 'concertNaam'); use $concertNaam =$array['concertNaam']; and change while ($array = mysql_fetch_array($geladenEvenement)) { to while ($array = mysql_fetch_assoc($geladenEvenement)) {
  14. num rows returns the number of rows affected / retrieved from a mysql query. I dont know who or what 'he' is but it is not a fold in the code, whatever that is?
  15. where are you declaring $i? $concertNaam = mysql_result($geladenEvenement, $i, 'concertNaam');
  16. upload the file to your servers home or root directory then in phpmyadmin use the mysql console LOAD DATA LOCAL INFILE '/importfile.csv' // wherever the file is located relative on the server INTO TABLE test_table FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (field1, filed2, field3); This function was created with large files in mind. I uploaded 1.2 million rows in around 4 seconds
  17. The principle behind serialising the data is that you can unserialise it when you retrieve the data. a quick example of retrieveing the data in php and mysql is: <?php $result = mysql_query("Select ps_name,ps_member,ps_custom_fields from nexus_purchases where ps_name like 'Varified Owner'"); ..... all of the standard stuff here while($row = myql_fetch_array($result) { $ps_custom_fields_to_array = unserialize($row['ps_custom_fields']); $ps_comma_seperated_string = implode(',',$ps_custom_fields_to_array); // this will make $ps_comma_seperated_string look like X, HAE, .... }
  18. you do know that the field in question is storing a serialized array? why would you want to mess with it. Can you give a bit more information on what you are trying to achieve?
  19. leave the excel date format as it is and use the date conversion power in mysql to alter the date to a timestamp on insert: let say for example you had it showing in the excel sheet as 01/10/2011 00:01:01, then you would do this on the insert: $date = '01/10/2011 00:01:01'; INSERT INTO tbl (`datecolumn`) values (STR_TO_DATE($date,'%d/%m/%Y $h:%i:%s')) you basically use the string to date function in mysql. the left hand part of the argument is the date you are passing in and the right hand part telss it what format the date is in. Mysql will do the rest from there and convert it into a datetime / date for you
  20. not a clue. Mainly because you have posted absolutely no code.
  21. just had a quick look at the link you supplied. it is meant to post over the data. Make sure you have somethingn like firebug installed in your browser and follow the post request to make sure the variables are being passed.. also make sure the javascript is actually posting to the correct page
  22. you need to sanitise any data that you recieve from your url. a good starting point is mysql_real_escape_string
  23. are you posting the width and height of the image to that page? according to that error, your not
  24. u might want to take a look at fulltext searching. heres a decent article: http://devzone.zend.com/article/1304
  25. close, you are getting the blog entry via the url , but you are then posting the form back to itself which wipes out the id. add this into your form <input type="hidden" name ='id' value="".$_GET['id'].""/> that will in effect auto forward your get variable along with the form. then: if(isset($_POST['workoutName'])){ $id = $_POST['id']; $workoutName = $_POST['workoutName']; $workoutDescription = $_POST['workoutDescription']; $blogUpdate = mysql_query("UPDATE blog SET workoutName='$workoutName', workoutDescription='$workoutDescription' WHERE id='$id' LIMIT 1") or die (mysql_error());
×
×
  • 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.