Jump to content

cyberRobot

Moderators
  • Posts

    3,145
  • Joined

  • Last visited

  • Days Won

    37

Everything posted by cyberRobot

  1. Errors like "Column 'IncidentDate' in where clause is ambiguous" usually mean that the column "IncidentDate" appears in more than one table. Try changing the column names in your where clause so that they specify which table to use. For example, this: IncidentDate LIKE '%" . $likes . "%' AND Would likely be this: i.IncidentDate LIKE '%" . $likes . "%' AND
  2. Possibly...what's supposed to happen when $subcategory_id is 450, 500, etc.?
  3. Are you getting any errors? If so, what are they? Also, it's worth mentioning that errors could be hidden on your server. To enable all errors and warnings, you can add the following to the top of your script: error_reporting(E_ALL); ini_set('display_errors', 1);
  4. You're missing a semi-colon at the end of the following echo statement (above line 85): echo "</td><td>"
  5. Perhaps you already got this figured out, but mysql_fetch_assoc() returns the next row in the result set...otherwise it returns false. So basically your first query could be dropped altogether. You can do something like this instead: $result = mysql_query("SELECT pwd FROM gbook WHERE email = '$email' "); if($row = mysql_fetch_assoc($result)) { if(md5($pwd) != $row['pwd']) { //... You'll also want to check out the mysql_real_escape_string() function to help protect your database from SQL injection attacks. More information can be found here: http://php.net/manual/en/function.mysql-real-escape-string.php Side note: In case you're not aware, md5() should not be used for hashing passwords. More information can be found in the PHP manual: http://php.net/manual/en/faq.passwords.php#faq.passwords.fasthash
  6. Side note: In case you're not aware, md5() should not be used for hashing passwords. More information can be found in the PHP manual: http://php.net/manual/en/faq.passwords.php#faq.passwords.fasthash
  7. For what it's worth, you can modify how these notifications are sent. Since the email feature isn't working, I changed my settings so that the notifications appear under the Notifications icon at the top when you are logged in. To change your setting, you can Log into PHPFreaks Click your profile name at the top right Click My Settings Click Notification Options Check the box for each item that you would like to be pushed to the Notifications List
  8. MailChimp has a RSS-to-Email feature you might find useful: http://mailchimp.com/features/rss-to-email/
  9. Try changing this: $query-"SELECT * FROM MyTable WHERE ref='" . mysql_real_escape_string($get_result) . "'"; To this: $query = "SELECT * FROM MyTable WHERE ref='" . mysql_real_escape_string($get_result) . "'"; Also, I would highly recommend moving your database connection script to its own file. Then whenever a database connection is required, you just need to import the script using a require (http://php.net/manual/en/function.require.php) or a require_once statement (http://php.net/manual/en/function.require-once.php). Importing the database connection script make it so you'll only need to change the log-in credentials in one spot. Otherwise, you'll need to update every script that uses the database. And in case you're not aware, the mysql_* functions have been deprecated. At some point in the near future, you'll need to switch to PDO or MySQLi. More information can be found here: http://php.net/manual/en/mysqlinfo.api.choosing.php
  10. Are you asking how to fix the query? If so, jcbones already provided the corrected code. You just need to add the missing quote before animatio. Change this: $sql = "Select * from picture WHERE category = animatio' ORDER BY id DESC LIMIT $start, $max"; To this: $sql = "Select * from picture WHERE category = 'animatio' ORDER BY id DESC LIMIT $start, $max";
  11. Inside your while loop, you can see what $row contains by doing something like this: <?php //... while($row = mysql_fetch_array($result)) { echo '<pre>' . print_r($row, true) . '</pre>'; //... } //... ?>
  12. So where are you stuck? It looks like your next step is to make the movie titles clickable. To do that, you can surround each title with an anchor tag. The anchor tag would lead to the movie details page. For that page to know which link was clicked, you can add a GET variable containing the movie ID. For example: $movienames .= "<a href='details.php?view={$rino['nameid']}'>{$rino['name']}</a><br>"; Once the links are in place, you can retrieve the GET variable on the movie details page with: $_GET['view'] Of course you can change the variable name to whatever you want. It just needs to match the name used in the anchor tag.
  13. To incorporate a GET variable, the link can be modified as follows: <a href='/book.php?result=$result[24]'>Link</a> Then in book.php, the ID would be retrieved with $_GET['result']. More information about GET variables can be found here: http://php.net/manual/en/reserved.variables.get.php
  14. The file could be read into an array with file(): http://php.net/manual/en/function.file.php You could then use a foreach loop to process each entry. In the foreach loop, you could use your for loop to display the current entry a 1000 times.
  15. It depends on the server setup. HTML files can be set to be interpreted as PHP scripts. However, you may still have a point.
  16. Do you know if PHP is set to display all errors and warnings? Note that you can add the following to the top of your script to show them: <?php //REPORT ALL PHP ERRORS error_reporting(E_ALL); ini_set('display_errors', 1); ?> Side note: Perhaps you are already aware of this, but the mysql_* functions have been deprecated. At some point in the near future, you'll need to switch to PDO or MySQLi. More information can be found here: http://php.net/manual/en/mysqlinfo.api.choosing.php
  17. If $_GET['id'] is supposed to be a number, you can modify the query as follows: $query = "SELECT * FROM ttn01 WHERE id = {$_GET['id']}"; The curly brackets are needed when you include an array variable ($_GET['id']), which has quotes around the index, in a string. As the others have suggested, you'll also want to take the necessary precautions to protect your query from injection attacks. If you're unable to use prepared statements and $_GET['id'] is supposed to be a number, you can run the variable through ctype_digit(): http://php.net/manual/en/function.ctype-digit.php If $_GET['id'] contains anything other than a number, throw an error instead of running the query.
  18. You could look into using Ajax to connect your JavaScript chart(s) to a database. For what it's worth, I currently use a JavaScript solution called amCharts. I don't have any great reasons for using the solution other than it was simple enough to figure out and it met my needs. I haven't spent that much time looking into the solutions mentioned, but phpCharts appears to create a JavaScript chart: http://phpchart.org/examples/line-bar-pie-charts/#prettyPhoto/0/ pChart seems interesting. The examples I've seen on their website are all images which look pretty good. Do you know if that's actual output or does pChart display the chart in some other fashion such as JavaScript? If pChart only produces images, one possible downfall of the solution is that you lose the interactivity that JavaScript solutions provide.
  19. It looks like you got the issue figured out. Should the topic be marked as solved? If the script still doesn't work, the next thing I would look for is to make sure the function is called after $lastPIDreduced is defined.
  20. Instead of using the "click" variable, you could test the value of the clicked link. Perhaps the following will help: <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(e) { $('.hide-show-button').click(function() { //UPDATE LINK LABEL if($(this).html() == 'show') { $(this).html('hide'); } else { $(this).html('show'); } //RESET OTHER LINK LABELS $(this).siblings().html('show'); }); }); </script> <a href="javascript:;" class="hide-show-button">show</a> <a href="javascript:;" class="hide-show-button">show</a> <a href="javascript:;" class="hide-show-button">show</a> <a href="javascript:;" class="hide-show-button">show</a> Note that the code was simplified so that I could produce a working example.
  21. Could you post the code that you've tried? Perhaps we can help fix this issue. When posting the code, please surround it with tags. It will make your post and code easier to follow.
  22. It's difficult to tell what exactly you need to do, but you can use an image as the link. You just need to wrap the <a> tag around an <img> tag. For an example, scroll down to Example 2 here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img
  23. If you're looking to build your own functions, the PHP manual has section on that topic here: http://php.net/manual/en/language.functions.php To learn about existing PHP functions, you could search for them in the manual. http://php.net/
  24. That's good to hear! I marked the topic as Solved. If you need anything else, you can make it as unsolved or start a new thread.
  25. Hmmm...but no function either. This file import sounds promising: require_once(BASEPATH . "lib/functions.php"); What do you use to edit these files by the way? The solution probably offers a way to search for the function name within your website's folder. You may find it faster than going from file to file. You could try searching for "required(".
×
×
  • 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.