Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. You define the variable $row['ProdName'] on line 103 of that script. However you call for this variable on line 76! You cannot call a variable before it has been defined! PHP doesn't back track itself. It parses each line at a time if you want to use the $row['ProdName'] variable to define the title for the page then you will want to move the SQL query that defines the $row array before line 76 instead.
  2. If you are looking for a pre-built bbcode parser then look at this code snippet If you want to have flash/music support as well you will need to add in some extra regex patterns for these.
  3. Keep note that this technique also applies to single quotes (') too if you define your string with a single quotes example: echo 'this is a \'string\'';
  4. Looking in IE those gaps are most probably caused by padding/margin issues. To prevent this sort of problem always define a padding/margin your tags. If you don't define a padding/margin in your CSS then the browser will use the default padding/margins it has pre-set. It is a good practice, IMO, to always set a default padding/margin in your CSS. Every browser has its own default values for padding/margin on X element and thus can cause this sort of behaviour you are getting.
  5. Undercloser inspection you are right your divs are closed. I didn't see them at first. However what I think the problem is that divs (or any other block level elements) is not allowed within the list tags (<li>) Remove the divs and your html will validate. What are you trying to do? a CSS based menu? Cant you apply each list tags there own unique class rather than having the same class? That will eliminate the need for the div tags. You might want to rethink how you code your CSS menu. When I get stuck with CSS menu's I always go to for help/inspiration.
  6. You have an opening div after the opening anchor tag however you don't close the div. One of XHTML requirements is that all tags have closing matching tags. With the code you supplied some of your divs do not have closing tag!.
  7. no it shouldn't have quotes around it. Just remove them. URL variables do not have quotes wrapped around them.
  8. Do not bump your thread every 2-3 hours. Please wait for at least 8-12hours before bumping your thread if there is no replies.
  9. You have got a http server set up and configured right? Install Apache http://httpd.apache.org (thats a http server) and configure Apache as follows, by adding the following to the httpd.conf: LoadModule php5_module "C:/PHP5/php5apache2_2.dll" PHPIniDir "C:/WINDOWS" AddType application/x-httpd-php .php Save the httpd.conf and restart Apache. Go to C:/Program Files/Apache Group/Apache2/htdocs (NOTE: your path may be different) and dump your PHP files in the htdocs folder. You can delete the existing files already in that folder if you wish too. Now open up your web browser and type in http://localhost/scriptname.php Your PHP script will be parsed and the output shown in the browser window You cannot run PHP without being configured with a web server. PHP is a server side language and not a client side language like HTML/CSS/JS etc. However you can run it from the Command Prompt if you wish however you wont gewt the same result. You see the generated HTMl/CSS/text your script generated.
  10. You now have an error with your javascript. Error: missing ) after argument list Source File: javascript:window.open('popup.php?filmid='A512','extrainfo','width=500,heigth=500,scrollbars=yes') Line: 1, Column: 31 Source Code: window.open('popup.php?filmid='A512','extrainfo','width=500,heigth=500,scrollbars=yes') Thats the error Firefox reports for me. Looks like you are not escaping your quotes properly. Tyr this as your echo query: echo '<tr> <td> <a href="javascript:window.open(\'popup.php?filmid='.$filmid.'\',\'extrainfo\',\'width=500,heigth=500,scrollbars=yes\')"><img height="100" width="100" src="' .$row['picture']. '" >'.$title.'</a> </td> <td>'.$price.'</td> </tr>';
  11. I'd leave the following out: if($phpver > '5.0'){ //Do nothing } If you're not going to do anything in that statement then leave it out. If you keep it in then your script will not enable output compression, which is what that code sets up. I'd change your code to this: <?php $phpver = phpversion(); if ($phpver < '4.1.0') { $_GET = $HTTP_GET_VARS; $_POST = $HTTP_POST_VARS; $_SERVER = $HTTP_SERVER_VARS; } if ($phpver >= '4.0.4pl1' && strstr($_SERVER["HTTP_USER_AGENT"], 'compatible')) { if (extension_loaded('zlib')) { ob_end_clean(); ob_start('ob_gzhandler'); } } else if ($phpver > '4.0') { if (strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) { if (extension_loaded('zlib') { $do_gzip_compress = TRUE; ob_start(array('ob_gzhandler',5)); ob_implicit_flush(0); } } } if ($phpver >= '4.1') { $PHP_SELF = $_SERVER['PHP_SELF']; } if (!ini_get("register_globals")) { import_request_variables('GPC'); } ?> Now that code will work for PHP4 and PHP5
  12. You might need to show more code of your class. Or if I'm misunderstanding you then look into the min and max functions over at php.net
  13. Most hosting companys, especially shared hosting sites, restrict access to the php.ini If you want to change a PHP setting and you don't have access to the php.ini you can either change the PHP setting by either using a .htacccess file or by using the ini_set function at the top of your script. If you are going for the .htaccess option you will need to make sure your host allows the use of .htacces files and that PHP is loaded as an Apache module and not by CGI
  14. You are using the older style superglobals. The older style superglobas was dropped with newer shorter superglobals when PHP4.2 was released. When PHP5 was release the devlopers dropped support for the older style superglobals and thus the setting regsiter_long_arrays was introduced and is disabled by default. You may enable this setting in the php.ini (if you can) or by using the ini_set function in your script. However it would be better if you updated your code to use the newer superglobals. YOu'd do this by changing $HTTP_*_VARS to $_* The * masks a word, example POST, GET, SERVER, SESSSION: $HTTP_GET_VARS should be $_GET $HTTP_POST_VARS should be $_POST $HTTP_COOKIE_VARS should be $_COOKIE $HTTP_SESSION_VARS shold be $_SESSION $HTTP_SERVER_VARS should be $_SERVER
  15. So the id corresponds to a line in the text files? correct? try this simple bit of code: <?php if(isset($_GET['id']) && is_numeric($_GET['id'])) { // this holds the line number for our image/title in the txt file $i = ($_GET['id'] - 1); // file grabs every line in a document in to an array // read more on file here: // http://www.php.net/file $path = file('paths.txt'); $title = file('titles.txt'); $html = '<b>' . $title[$i] . '</b><br /> <img src="' . $path[$i] . '" title="' . $title[$i] . '" />'; echo $html . '<hr />'; } ?> Choose an image to be displayed:<br /> <a href="?id=1">Get image #1</a> <a href="?id=2">Get image #2</a> <a href="?id=3">Get image #3</a> This code gets the paths of the images from a file call paths.txt and the titles for the image from titles.txt
  16. If you are using apache2.2.x and php5.2 then use the php5apache2_2.dll module and not php5apache2.dll So use this line for add php as an apache module: LoadModule php5_module "C:/php/php5apache2_2.dll"
  17. no problem. I will mark it as solved.
  18. Could you provide more detail. I am not quite understanding what you mean by 'and save the text at line (id) to the variable $image Where is (id)? how would (id) match a line in the external text file.
  19. I have just re-read the whole thread and I have gotten a little confused my self and I noticed I have missed out a few important bits. Have you uncommented the mysql extension line in the php.ini? Change this line: ;extension=php_mysql.dll to extension=php_mysql.dll also ensure that you have set the extension_dir directive to point to your PHP extension folder, I believe its C:\downloads\PHP\ext So make sure you set extension_dir line like this: extension_dir = "C:\downloads\PHP\ext" Save any changes you make to the php.ini and restart IIS
  20. I noticed you mentioned about short tags There is another short tag with is <?= that is short for <?php echo. Have you converted those tags too?
  21. Have you tried the two links at the top of forum: Show unread posts since last visit. and Show new replies to your posts. Show unread post since last visit lists all threads/post that you have not read since you where logged in. The other links shows all threads that you have posted in that has gotten new replies since your last post/visit to the thread. I use this link a lot, sometimes I forget which threads I have replied in. Comes in very handy
  22. XAMPP has that answer on their site, here always a good place to look first.
  23. Is the list of names stored in a table, and those list of names correspond to another table that has the content? If thats the case then just do a simple sql query then check that the sql query returns the results if it did display then. $name = isset($_GET['name']) ? mysql_real_escape_string($_GET['name']) : 'noName'; $sql = "SELECT * FROM `names.name` WHERE `content.name`= '$name'"; $result = mysql_query($sql); if(mysql_num_rows($result) == 1) { // match found! Display the content for the name } else { // No matches. Display an error here. }
  24. You should get a reply like the following: Query OK, 1 row affected when you run CREATE DATABASE aw_hsc; Also can you post a screen shot of the error you get. I think you don't have wamp started and that's why you are getting that error. To start WAMP right click the wamp taskbar icon and select Start All Services options.
  25. Add .html to the end of the following line should do it, seperated by a space: AddType application/x-httpd-php .php So the above line to this: AddType application/x-httpd-php .php .html That will now pass .php and .html files to the PHP preprocessor. Save the httpd.conf and restart Apache.
×
×
  • 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.