Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. Yes. PHP can be configured to use a remote SMTP server for sending emails. You do not need to install an SMTP server locally.
  2. Not sure but that error message says to read FAQ point 2.8 from phpMyAdmins Documentation.
  3. It has been supported since SMF was first installed here. There has been a modification applied to the php tags latey, it now wraps a code box around the code. I think it was ober or Daniel0 cant remember which
  4. No. Dreamweaver does not have the functionally to run PHP code within Design View.
  5. What is $_POST['hoi'] associated to in your form? You should give your submit button a name, then reference the submit buttons name in the $_POST array instead to check to see if the form has been submitted.
  6. Every time you call mysql_fetch_assoc, it will return one row from the result set. When there is no results left it will retrun false and the loop stops. The same functionality applies to a foreach loop. You could use a while loop too, to loop through an array except the syntax will be slightly different: while($row = each($rows)) { echo $row['name'] . ' - ' $row['age'] } Now as a foreach loop foreach($rows as $k => $row) { echo $row['name'] . ' - ' . $row['age']; }
  7. Search google for SQL Injection and you'll get many articles explaining what it is and how to protect yourself. Here is a great article I used when I learnt how to protect against SQL Injection attacks.
  8. What user have you login to the MYSQL client? If its the root user then you should not get this error. The root user has no limitations. To grant all privileges for the root user run this command: GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION; Followed by FLUSH PRIVILEGES;
  9. Thread loacked. You already posted this question here.
  10. If you echo $link in login.php you should receive a message like the following if you do then PHP is connecting to MySQL. The problem is mysql_query is not using the current connection to MySQL. I would recommend you to pass the link-identifier ($link) to mysql_query instead, eg mysql_query('your query', $link); Also, as a side note I would advise you to sanities any user data ($_GET, $_POST or $_COOKIE) before using it within a mysql query. Failier to do so can allow a malicious user to run SQL Injection attacks on your database, which could result in all your data in your database to be deleted.
  11. That is the lazy way to fix your script, you may as well enable register_globals again if you're going to do that. I presume the variables $setup, $namdb, $userdb, $passdb, $nameuser, $passwrd, $aemail are coming from your form. You should use $_POST['setup'], $_POST['namedb'] etc instead Also turn display_errors on
  12. Where the variables $setup, $namdb, $userdb, $passdb, $nameuser, $passwrd, $aemail coming from? Looks like your code relies on register_globals being enabled in order for function correctly. You should take the time to update your code so it doesn't reply on this setting. It is disabled by default when PHP is installed, there are reasons for this - the main one being security.
  13. include doesn't return a value. You should use fopen/fread or file_get_contents to store the contants of a file into a variable
  14. What file do you keep your connection info in? Is it layout.php? Also when you're dealing with a persisitant connection you should pass the link identifier (in your case $link) to any of the mysql_* functions, which optionally require it, eg: mysql_select_db, mysql_query etc.
  15. When you get blank pages alwaysturn display_errors On and make sure error_reporting is set to E_ALL Anyway $row['database'] should be $row['Database']
  16. Yes. the $image variable holds the filename Note: You cannot use the $image variable outside of the loop. <?php $dir = './thumbnails/' $imgCount = 0; foreach (glob($dir . '*.jpg') as $image) { $imgCount++; echo '<b>Name</b>: ' . $image . '<br />'; echo '<b>Size</b>: ' . filesize($dir . $image) . '<hr />'; } echo 'There are ' . $imgCount . ' JPEG\'s in thumbnails/'; ?>
  17. Run the SHOW DATABASES mysql query.
  18. You only able to to do this when the form is submitted. Not whilst the user is entering the data into the field <-- that will require javascript.
  19. I presume you used the installer to install PHP on Windows before hand. You should use the zipped binaries package instead the installer comes with limited files.
  20. That is the syntax for a foreach loop. glob returns an array of files matching the pattern. Here are links to the manual on foreach and glob The . at the beginning of file paths tells PHP to go from the current working directory (where the executing script is). I always tend to add ./ to beginning of file paths, just a habit. You can remove ./ if you want to.
  21. Something like <?php $imgCount = 0; foreach (glob("./thumbnails/*.jpg") as $image) { $imgCount++; } echo 'There are ' . $imgCount . ' JPEG\'s in thumbnails/'; ?>
  22. If you have phpmyadmin available login to phpmyadmin and select your database oscommerce uses. Then select the Import tab at the top of the page and follow the instructions.
  23. msql.dll is not for mysql. You should be enabling the php_mysql.dll extension.
  24. It should work out fine, just make sure Yahoo supports mod_rewrite. Just change oldpage.php and newpage.php to whatever you want. Don't modify the /(.+) or $1 bits.
  25. You need to add LIMIT 1 to your query. Without this your query will select all records in the jokes table: $result = mysql_query("SELECT * FROM jokes ORDER BY date DESC LIMIT 1"); As your query only returns one result you do not need to use a while loop to display the query results. So you printJokes function will now be: function printjoke() { $result = mysql_query("SELECT * FROM jokes ORDER BY date DESC LIMIT 1"); $row = mysql_fetch_array($result); echo "<p class='joketitle'>". $row['date'] . "'s joke by " . $row['poster']; echo "<br /></p><p>"; echo $row['joke'] ."<br /><br /></p>"; }
×
×
  • 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.