Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. Where are the variables $page and $subpage defined? I guessing they're coming from the url? eg yoursite.com/file.php?page=home&subpage=foobar If what I'm guessing is correct then the variables $page and $subpage need to $_GET['page'] and $_GET['subpage'] instead.
  2. Post the code you're having issues with here. We'll be able to help you further.
  3. You don't use PHP to setup domains. This is handled by your HTTP Server's configuration, for example with Apache you can setup what is know as virtual hosts for hosting multiple (sub)domains.
  4. How are you setting up PHP and Apache? From your error it appears to be PHP is set up as CGI. It is much better setup PHP as an Apache Module.
  5. You should only need to call your 'connect()' function once. You dont need to keep calling that function every time you perform a query.
  6. Session_start() must be called before any output has been made. This line <?php session_start(); ?> Should be before these lines <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><!-- start: portal -->
  7. You only need to use heredoc within the while loop. function guestList() { $guessContent = <<<GUESTS <div id="left"> <h2>Guestlist created</h2> GUESTS; include 'database_conn.php'; $sql = "SELECT * FROM guestlist"; $queryresult = mysql_query($sql) or die(mysql_error()); while ($row = mysql_fetch_assoc($queryresult)) { // start while loop $guestID = $row['guestID']; $surName= $row['surName']; $firstName = $row['firstName']; $number = $row['number']; $guestContent .= <<<GUESTS guestID: $guestID<br /> surName: $surName<br /> firstName: $firstName<br /> number: $number<br /> <hr /> </div> GUESTS; } // end while loop $guestContent .= "\n"; return $guestContent; }
  8. If cifw is a folder place a .htaccess file within it with this code rewriteEngine On rewriteRule (.*) index.php/$1
  9. This line is not quite right if (!($x['image'])) { } else { $r = "../" + $x['image']; unlink($r); } You should first use mysql_num_rows to check to see if the query returned any results first, eg if(mysql_num_rows($query1) == 1) { // query return a result // proceed to delete image } You'll find it'll be alot easier if you use full paths, rather then relative paths. You should set a variable which holds the full path to your uploads/ directory first. $upload_base_dir = $_SERVER['DOCUMENT_ROOT'] . '/uploads/'; Now that you have the path to your upload directory set you can easily append the variable $x['image'] to form the full path to the image. $image_to_be_deleted = $upload_base_dir . $x['image']; To deleter the image simply pass the $image_to_be_deleted to the unlink function. if(mysql_num_rows($query1) == 1) { // query return a result // proceed to delete image $upload_base_dir = $_SERVER['DOCUMENT_ROOT'] . '/uploads/'; $image_to_be_deleted = $upload_base_dir . $x['image']; // check that file exists if(file_exists($image_to_be_deleted)) { unlink($image_to_be_deleted); // delete image reference form database $query = "DELETE FROM news WHERE image = '".$x['image'];."'"; mysql_query($query); echo 'Image deleted'; } else echo 'Cannot delete the image as it cannot be found!'; } else echo 'Query returned no results';
  10. Place both lines within your <td></td> tags. <td width="212" align="left" valign="top" bgcolor="#FFFFFF"> <?php include "phpFiles/top.php"; ?> Text for cell here <?php include "phpFiles/bottom.php"; ?> </td> Or do <tr> <td><?php include "phpFiles/top.php"; ?></td> <td width="212" align="left" valign="top" bgcolor="#FFFFFF"> Text for cell here <td><?php include "phpFiles/bottom.php"; ?></td> </td> How images/text are positioned on your web page is controlled by HTML/CSS.
  11. Post more code prior to line 25 from register_user.php. Make sure you're not using the variable $sqlcon before you have included constr.php . Remember variables/functions must be defined before you use them.
  12. What specific "patterns" are you trying to match? Does the uploaded file need to be in a certain format? You need to be more clear with your question.
  13. Place all your mysql connection info in one file, eg mysql_conn.php. Place this file in your secure location. Whenever you want to connect to mysql you'd use include. mysql_conn.php <?php $host= 'localhost'; $user = 'username'; $pass = 'password'; $database = 'database name here'; $conn = mysql_connect($host, $user, $pass); mysql_select_db($database); ?> Connect to mysql using include 'path/to/mysql_conn.php';
  14. In the code you posted you're not using any SQL queries. Is there more to this?
  15. What? You're not sending emails with the code your posted in your first post. I do not get what you're asking
  16. Its because Apache sees /logout/ and /logout as two completely different matches. To match regardless of the trailing slash use RewriteRule logout/? index.php?method=logout To use mod rewrite affectively you should read up on regular expressions.
  17. You sure you spelt your class name correctly? Post the code in function.class.php
  18. does anybody know why? please help. Where is your includes folder located to? Currently PHP is trying to include footerpages.php in /customers/squiblo.com/squiblo.com/httpd.www/footpages/includes/. Is this correct?
  19. Yes that is correct. It'll first look for the file to be included in the current (working) directory, this is what the '.' means. The colon ':' is a directory separator. include_path can contain many directories. If it cant find the file in the current directory, it'll look in home/mysite/domains/mysite.com/private_folder
  20. You cannot place PHP tags within an echo statement echo '<form method="post" enctype="multipart/form-data">; <br />; Password: <input type="text" name="password" value="<?php echo $stuff['password']; ?>" /><br /><br />; Email: <input type="email" name="email" value="<?php echo $stuff['email']; ?>" /><br /><br />; Membership Type: <select name="type"> <option value="Music Enthusiast">Music Enthusiast</option> <option value="Band Member"<?php if ($stuff['type'] == 'Band Member') { echo ' Selected="selected"'; } ?>>Band Member</option> </select><br /><br />'; The above should be coded as echo '<form method="post" enctype="multipart/form-data">; <br />; Password: <input type="text" name="password" value="' . $stuff['password'] . '" /><br /><br />; Email: <input type="email" name="email" value="' . $stuff['email'] . '" /><br /><br />; Membership Type: <select name="type"> <option value="Music Enthusiast">Music Enthusiast</option> <option value="Band Member"' . (($stuff['type'] == 'Band Member') ? ' Selected="selected"' : null) . '>Band Member</option> </select><br /><br />';
  21. Change your rewrite rule to
  22. Just go to http://www.website.com/ instead.
  23. Your function doesnt display anything as mysql_query does not return anything! However the query is running, provided you have connection to mysql first of course. Hold on I just noticed something your function should actually be <?php function test($memberID) { return mysql_query("UPDATE ibf_members SET points = points+0.25 WHERE id={$memberID} LIMIT 1"); } if(test($ibforums->member["id"])) { echo 'You won this round'; } else { echo 'Error! unable to update player points! For member id - '. $ibforums->member["id"]; } ?>
  24. Yes. Thats correct. That is exactly how you have coded your function to behave To be able to run your update query you need to use the mysql_query function, as you was using it previously.
  25. UPDATE queries do not return any results. However you can use the function called mysql_affected_rows which returns the number of rows your query affected. For a fuctuion to return any thing you need to use the return keyword. As explained in the manual.
×
×
  • 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.