Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. Can you post the full error message here so I can see what extension you are trying to load.
  2. Yep its parsing your variable but it cant find the file funcetion_channels.php is that file name spelt correctly? To me it looks like it is supposed to be function_channels.php
  3. have you set up extension_dir directive up within the php.ini to point to C:/php yet?
  4. I don't think its my code snippet causing that error. For me it is error free. I'm not sure. Its works fine for me with some dummy data: <?php $thisIp = '127.0.0.1'; $license = 'bla'; $currUrl = 'Unkown'; $comment = 'ohhh!'; $remFile = <<<EOF echo '<pre>' . print_r(func_get_args(), 1) . '</pre>'; EOF; $doRemLog = create_function('$thisIp, $license, $currUrl, $comment, $isAttempt', $remFile); $doRemLog($thisIp, $license, $currUrl, $comment, 1); ?> I get this result: Array ( [0] => 127.0.0.1 [1] => bla [2] => Unkown [3] => ohhh! [4] => 1 )
  5. Are you sure its the same exact error? the id variable should now be being parsed resulting in php including a file called funcetion_channels.php?channel=value_of_id_var_here eg if $id was set to the number 2 it'll be funcetion_channels.php?channel=2
  6. Is line46 this line? setcookie("cookie[$commentid]", $commentid); That should be fine To fetch the cookie you'd use this variable: $_COOKIE['cookie'][$commentid]; Not like this: $_COOKIE['cookie[$commentid]'];
  7. I guess you have used the installer. The installer doesn't come with all the files. Download the zip package on the php.net download page and then extract the zip contents into the installation folder for PHP overwriting existing files. Also remove the following lines in the httpd.conf: LoadModule php5_module "d:/Program Files/php/php5apache2_2.dll" AddType application/x-httpd-php .php PHPIniDir "D:\Program Files\php" For some reason they are in there. PHP is installed in C: not D: and the correct config lines have been added at the bottom of the httpd.conf by the installer. Now add this line: PHPIniDir "C:\\Program Files\\php" at the bottom of the httpd.conf after this line: LoadModule php5_module "C:\\Program Files\\php\\php5apache2_2.dll" Once you have done that restart Apache.
  8. What error do you get. If you dont get any errors and just a blank screen. Enable display_errors if you can in the php.ini or just add this line at the top of your script: error_reporting(E_ALL); ini_set('display_errors', 'On');
  9. Is there anything after ?> There is most probably a space or even a new line there. Remove any thing after the closing tag.
  10. Missing ending square bracket ] on line 6 It should be:
  11. Oooh more errors! You have output on line10 in db.php. What is line 10.
  12. You have an error on line 89 according to my editor, which is this line: Notice the bit highlighted in red. You'll see there is a space between - and > that space is causing the error. remove the space and your script should work. Also it is a good idea to add the following two lines of code at the beginning of your script if you get problems like this again: error_reporting(E_ALL); ini_set('display_errors', 'On'); Remove those lines when you have finished sorting out the error.
  13. mysql_fetch_array requires the result resource from mysql_query not mysql_num_rows $ac2 = mysql_query("SELECT * FROM users WHERE username LIKE '%$account%'") or die(mysql_error()); $accounts = mysql_fetch_array($ac2); $ID = $accounts['id']; header("Location: view.php?id=$ID");
  14. Variables only work if you place them inside double quotes. If you place a variable within a single quote PHP will treat it as text. In your case PHP is doing just that. It is trying to include a file called funcetion_channels.php?channel=$id within includes/ Also as a side note you can only use url parameters within an include if php has url_fopen (or url_include if your site runs on PHP5.2.x) enabled within the php.ini.
  15. This line is overriding the result resource and is causing the error: $ac2 = mysql_num_rows($ac2) or die(mysql_error()); Either remove it or change $ac2 to a different variable name.
  16. Add a semi-colon at the end of line 74: $accounts = mysql_fetch_array($ac2);
  17. You will want to place the echo statement within the second while loop, but remove the first line of html from the echo statement and echo it out outside of the secound while loop. <?php $query = "SELECT * FROM collection WHERE mcat_id='$cat_id'"; $result = mysql_query($query); while($row = mysql_fetch_array( $result )) { $c_name = $row['name']; $c_desc = $row['desc']; $c_id = $row['collection_id']; // Only want to the header to show once echo ' <div class="dhtmlgoodies_question"><strong>' . $c_name . '</strong><br /> ' . $c_desc . ' <br />'; $query_prod = "SELECT * FROM products WHERE c_id='$c_id' ORDER BY name DESC"; $result_prod = mysql_query($query_prod); while($row = mysql_fetch_array( $result_prod )) { $p_name = $row['name']; $p_desc = $row['desc']; $p_pic = $row['pic']; // show all items that belong to the header echo ' <div class="dt_button">Show Products</div> </div> <div class="dhtmlgoodies_answer"><div> Product Name: <b>'.$p_name.'</b><br> Product Desc: '.$p_desc.'<br> <br /> </div> </div>'; } } ?>
  18. What do you get when you run this: $remFile = <<<EOF echo '<pre>' . print_r(func_get_args(), 1) . '</pre>'; EOF; $doRemLog = create_function('$thisIp, $license, $currUrl, $comment, $isAttempt', $remFile); $doRemLog($thisIp, $license, $currUrl, $comment, 1); You should get an array printed out showing you what each parameter is set to. What result do you get
  19. Just posting to notify you a few things. Take caution when you are using client set variables, these are _POST, _GET, _REQUEST and _COOKIE. These variables come from the user accessing your site. Never trust any data that comes to you from the client. If you use raw data from the user then a malicious user can run SQL Injection attacks on your database. Using SQL injection they can login as an admin or any other user, or they can completely destroy your database by simply deleting it. SQL Injection is one of the many security exploits users use to attack sites. To learn more about SQL Injection have a search on google for SQL Injection. You'll find many article discussing it and how to prevent it. A good way to prevent it is to escape user data using a function called mysql_real_escape_string. mysql_real_escape_string can be used to prevent SQL Injection attacks. You should always run this function on any variables you use within your database that deals with strings. Just through I'll through that in.
  20. To pull data from a recor set you'd use mysql_fetch_assoc or mysql_fetch_array. I use assoc as I prefer to work with associative arrays ($arr['key']]) rather than indices ($arr[0]). If your query returns multiple rows then you'd use mysql_fetch_assoc within a while loop to loop through the rows that was returned. If your query only returns 1 row then you wont need to use a while loop. Here's an example: <?php // connect/select database $result = mysql_query("select * from news where news_alert = 'A' LIMIT 0, 30 ") or die(mysql_error()); // check that the query returned any results if(mysql_num_rows($result) > 0) { // loop through the results while($row = mysql_fetch_assoc($result)) { echo '<img src="images/' . $row['field_name_here'] . '" />'; } } change field_name_here with the actual field (or column) name from your table.
  21. I guess you are using nl2br when you add the data to your database. You should not use nl2br in this way. Instead you should use nl2br when you get the data out of your database. If you are using nl2br when you add the data to your database it will just keep duplicating the previously added new lines. If you use it when you get the data out of the database PHP wont duplicate the newlines.
  22. Try: <?php session_start(); // you should always check whether client defined variables (eg: _GET, _POST, _COOKIE, _SESSION, _REQUEST etc) // exists before using them if(isset($_REQUEST['id']) && !empty($_REQUEST['id'])) { $basket = $_REQUEST['id']; // check that the id has not already been added if(!isset($_SESSION['basket'][$basket])) { // not been add // we'll add the id to the basket session $_SESSION['basket'][$basket] = 1; // count how many items are in the basket session array echo count($_SESSION['basket']); } else { // id already added so we just notify the user echo $basket . ' - Already added'; } echo '<hr>'; } ?> P001 <a href="?id=P001">Add</a><br /> P002 <a href="?id=P002">Add</a><br /> P003 <a href="?id=P003">Add</a><br /> P004 <a href="?id=P004">Add</a><br /><br /> <a href="?menu=basket">show</a> <?php // again we check whether the variabe exists first before using it // and that _REQUEST['menu''] is set to basket if(isset($_REQUEST['menu']) && $_REQUEST['menu'] == 'basket') { // count how many items are in the basket session array $count = count($_SESSION['basket']); // echo out the no. of items echo '<hr><br />amount = ' . $count; // show whats in the basket session echo '<pre>' . print_r($_SESSION['basket'], true) . '</pre>'; } ?>
  23. What OS are you running? If its Windows just download the installer ((Windows ZIP/Setup.EXE (x86))) from mysql.com and run through it. Once installed you will have to configure PHP to use the mysql extension in order for you to use MySQL with PHP. PHP5 does not come with mysql support built in like PHP4. In order to enable the MySQL extension please read this FAQ If you are having any problems during the installation of mysql just post here and I'll try to solve the problem you are having.
  24. Perhaps remove the height from the table on this line: echo "<table width=\"98%\" height=\"310\" left =\"4\" border=\"0\" font face =\"arial\">\n"; That way your rows wont expand to fill in the gaps if the height of the table doesn't exceed 310pixels.
×
×
  • 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.