Jump to content

halfman

Members
  • Posts

    61
  • Joined

  • Last visited

    Never

Everything posted by halfman

  1. have you run anyother website on your MAMP? MAMP runs a different scan for mysql and if the port 8888, and 8889 used by different program then you need to change the ports for you MAMP. Check your MAMP in the preferences and see what is the ports for your apache. go to MAMP website and download the user manual, you can find more info about the ports in there. Hooroo
  2. Mate just google it, or let me know what is you problem I might be able to find you exactly what you want.
  3. I agree with this suggestion, I always use session, they are more secure and easy to use.
  4. I think you need to escape it just because the JTable::store() is binding the post record to the ones in the table and if there are similar then it will update the table. so I would say in the POST you escape the POST array and then use the JTable::store().
  5. Mate I made you a short tutorial, and I have put it on this address Customise Your Template To Use In Joomla it is just a nightly written so I do apologise for any grammar mistake, I will ask my copywriter to look at it. Just let me know if you have any other probelm. Hooroo
  6. What do you exactly want to know about Joomla templates? let me know, I can give you some good tutorials and pdfs
  7. I love Chrome and I use it for browsing but I use FF for web development. Guys I think having IE6 is kind of good because of the challenges. I know by saying that I make so many enemies. I dont mind IE7 or IE8.
  8. instead of die() user trigger_error(mysql_error(), E_USER_ERROR) and see what error are you getting. it is just the first step then we can work on the rest
  9. Mate this code is wrong you wont be able to update a recored and have it as the where condition, it is not very clever of coding and I dont think it is logicly possible. "UPDATE smail SET estimatedDelivery = '".$date."' WHERE estimatedDelivery = '".$id."'"; Needs to be: "UPDATE smail SET estimatedDelivery = '".$date."' WHERE `id` = '".$id."'";
  10. I suuggest killing the script when it has only one event in and see which block of your code dump the error. That is what I will do when I get error in my joomla component, I will go to the component folder and start following the logic of the code and killing the code in each block to find out where the error is triggered, then if I cant find the solution I will try to get help, as I get help very fast because I can pin point exactly which block of code has problem.
  11. No worries mate. Any time, Let me know if you needed any more help. Cheers
  12. Have you installed your joomla directly from your server or your transfer it across and change the config? If you transfer the joomla across then I would suggest go and check the config file. Give me the your component download link, I go and see if there is any reference to the host. it could be looking for your local machine http://localhost instead of your domain name.
  13. Mate, I dont know the structure of your table so I assume that you need some kind of the WHERE condition. I thought if you pass the id from each post you know exactly each post belongs to where in your database (Instead of using a hidden file to pass the id), so the $key is the actual passed id from your FORM, you can use it to point each record properly in its place. for example: UPDATE tableName SET estimatedDelivery = '".$val."' WHERE id = '".$id."' PHP takes care of the array and the value as the array structures will get in place in the order of the submission. for example : [1] => ['10-10-09'] [id] => ['estimatedDelivery'] Have a read on the PHP Array in php.net it will help you a lot.
  14. Can you first check the DB for the similar email if it exsit just generate a report and enter the report in a text file or somewhere in databse if not insert the email.
  15. Mate have you read the code?? You need to pass the id. name='estimatedDelivery[".$id."]' Maybe your id is $row['id'] so your $id = $row['id']; <?php foreach ($_POST['estimatedDelivery'] as $key => $val) { // KEY WILL BE THE ID AND VAL IS THE VALUE OF EACH POST // your update script will be :: UPDATE tableName SET estimatedDelivery = '".$val."' WHERE id = '".$key."' } ?> <form action='process.php' method='post'> <?php while($row = mysql_fetch_array($result)) { $date2 = $row['estimatedDelivery'];; $timestamp2 = strtotime($date2); $new_date2 = date("d-m-Y",$timestamp2); echo "<td> <input type='text' name='estimatedDelivery[".$id."]' value=".$new_date2."></td>"; //use array if you want to send multiple values for one variable name then use foreach or while to extract the variable name and values } echo "<input type='submit' name='submit' value='Submit updated delivery dates'></form>"; ?>
  16. Just write SELECT sql and get the duplication. make a proper error dump.
  17. What do you mean by "multiple lines of code" ? what kind of code??
  18. What is the dataType for the estimatedDelivery field in your mysql? set it to varchar 200. also I would suggest running one of the update sql directly from your mysql and see if there is any error.
  19. No mate: To use the mysql_insert_id(); your primary key in mysql needs to be auto_increamented field. Then write the insert sql and use the $id = mysql_insert_id(); so you can get the last insert id then use it for the update. Also I would suggest reading some documents about UPDATE and INSERT, it will help to to finish this task.
  20. Try to echo this and let me know what is the result. foreach ($_POST['estimatedDelivery'] as $key => $val) { echo "UPDATE smail SET estimatedDelivery = '".$val."' WHERE id = '".$key."'"."<br>"; // mysql_query("UPDATE smail SET estimatedDelivery = '".$val."' WHERE id = '".$key."'"); } }
  21. check your query again, check if you extracted values and keys correctly, // HOW TO EXTRACT THE VALUE -- very simplified mate not a very clever approach foreach ($_POST as $key => $val) { foreach ($val as $k => $v) { echo $v; // PUT THE SQL CODE IN HERE AND $key WILL BE YOUR TRANSFFERED id // UPDATE tableName SET 'filedName' = '".$v."' WHERE id = '".$key."' } }
  22. There you go, but I have no idea how you are going to continue. Anyhow this your answer mate: <?php // I HAVE CHANGED THE INSERT.PHP TO INDEX.PHP COPY THE HEADER INTO INSERT.PHP session_start(); echo "<font color=white>Welcome, " . $_SESSION['username'] . "!<br><a href='Logout.php'>Log Out</a></font>"; // HOW TO EXTRACT THE VALUE -- PUT THIS BLOCK IN INSERT.PHP foreach ($_POST as $key => $val) { foreach ($val as $k => $v) { echo $v; // PUT THE SQL CODE IN HERE // UPDATE tableName SET 'filedName' = '".$v."' WHERE If you stock here and dont knwo what to put here then use insert then use mysql_insert_id() to update the last insert } } // IT IS BETTER TO MAKE ALL THE ACTION IN ONE PAGE THEN REDIRECT THE HEADER TO ANOTHER PAGE FOR THE RESULT. ?> <pre> <?php print_r($_POST); ?> </pre> <?php $add = $_GET['add']; if (isset($add)) { if (empty($_SESSION['username'])) { $_SESSION['username'] = ""; } } ?> <p align='right'><input type='button' name='add' value='add' onClick="parent.location=('<?php $_SERVER['PHP_SELF']; ?>?add=add')"></p> <?php if (isset($_SESSION['username'])) { if (empty($_SESSION['stack'])) { $_SESSION['stack'] = ""; } $i = 0; if (isset($add)) { $i = $_SESSION['i']; $_SESSION['stack'][$i] = " <form enctype='multipart/form-data' action='index.php' method='post' name='changer'> <p align='center'> <input name='image[$i]' value='image' type='text'> <br> <input type='text' name='hyperlink[$i]'value='hyperlink'> <br> <input type='text' name='currency[$i]' value='currency'> <br> <input type='text' name='name[$i]' value='name'> <br> <input type='text' name='info[$i]' value='info'> <br> <input type='text' name='keywords[$i]' value='keywords'> <br> <input type='text' name='type[$i]' value='type'> <br> </p>"; $_SESSION['i']+= 1; } } else { $_SESSION['stack'][$i] = "You must be logged in!"; } foreach($_SESSION['stack'] as $key => $val) { echo $_SESSION['stack'][$key]; } ?> <input type="submit" /> </form>
  23. estimatedDelivery is a reference when it is in the name = "estimatedDelivery" in your text box, when PHP collect all the vars they all will have the same name and they over right eachother, and you will get the last $_POST['estimatedDelivery'] whereas if you have got name="estimatedDelivery[$id]" then every reference has its own name and you will be end up with multiple POSTs like this $_POST[estimatedDelivery][1] = "DATE" $_POST[estimatedDelivery][2] = "DATE" $_POST[estimatedDelivery][3] = "DATE" Give a shot at this code and see what will happen <?php foreach ($_POST['estimatedDelivery'] as $key => $val) { // KEY WILL BE THE ID AND VAL IS THE VALUE OF EACH POST // your update script will be :: UPDATE tableName SET estimatedDelivery = '".$val."' WHERE id = '".$key."' } ?> <form action='process.php' method='post'> <?php while($row = mysql_fetch_array($result)) { $date2 = $row['estimatedDelivery'];; $timestamp2 = strtotime($date2); $new_date2 = date("d-m-Y",$timestamp2); echo "<td> <input type='text' name='estimatedDelivery[".$id."]' value=".$new_date2."></td>"; //use array if you want to send multiple values for one variable name then use foreach or while to extract the variable name and values } echo "<input type='submit' name='submit' value='Submit updated delivery dates'></form>"; ?>
×
×
  • 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.