Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. I don't see any difference between the two snippets.
  2. Yes, You create the form in HTML first (google html forms). When the form is submitted to a PHP script, the data sent will be in the $_POST or $_GET superglobal (depends on your form submit method).
  3. Explain what you mean by fields. Do you mean an HTML field? Or a field in your database? If its an HTML field then all data submitted to the page from a form is handled by PHP. Form data is usually stored in the $_POST super global (depends on your forms submit method), eg $_POST['form_field_name'] To join the two variables into one you'd use concatenation, eg $full_name = $_POST['First_Name'] . ' ' . $_POST['Last_Name']
  4. The code you posted doesn't have 37 lines of code (the error is on line 37 according to your error), it has 29! Anyway, I think your problem could be related to your WAMP server not having a setting called short_open_tag enabled. short tags are disabled by default. You'll need to enable this setting in your php.ini file. After making any changes to the php.ini make sure you restart WAMP.
  5. Check your hosts file (C:\WINDOWS\system32\drivers\etc) open the hosts file into Notepad. Make sure the following line is in there 127.0.0.1 localhost Also what settings are you using when you installed Apache? For the Network and Server Name settings you should just use localhost
  6. The code your posted makes no sense, you'll need to post more code
  7. if Apache is installed on the same computer you're using then use http://localhost to connect to Apache.
  8. Unless you have re configured Apache to use a different document root, c:\inetpub\wwwroot is for IIS. With Apache you should place it in Apaches htdocs folder. This is not a PHP configuration issue.
  9. example: $str = '123456789'; $s = array(2, 4, 1, 2); $c = 0; foreach($s as $o) { echo substr($str, $c, $o) . ' '; $c += $o; }
  10. Apache will hide files that begin with .ht for security reasons.
  11. I have not used mapserver so I cant help you how to set it up. However I think you might be better of using the Google Maps API instead.
  12. The module used varies on different OS's. For example on Windows PHP5 comes with three Apache modules, these are php5apache.dll - for use with Apache 1.0.x php5apache2.dll - for use with Apache 2.0.x php5apache2_2.dll - for use with Apache 2.2.x To load a module in Apache you'll use the LoadModule directive, example LoadMode module_name "path/to/module" # Real example LoadModule php5_module "C:/php/php5apache2_2.dll"
  13. Have a read of the following article here specifically the last paragraph in the Executing Stored Procedures section.
  14. Use $result->free between each use of the stored procedure
  15. No, that is incorrect it should be if(!isset($_GET['cmd'])) { $cmd = $_GET['cmd']; With your code isset will always return true, as $cmd already exists. remember isset checks whether a variable has been created.
  16. Do not convert the spaces or newlines when the data is added to the database. Only do this when you display the data on the webpage. This is the most easiest solution for you to manage and allows your users to edit the text with out having to deal with HTML.
  17. Make sure in your php.ini you have set the extension_dir directive to point to PHP's extension folder (eg extension_dir = "C:/php/ext") and that you have removed the semi-colon ( from in front of the "extension=php_pgsql.dll" line. Save the php.ini and restart you http server (eg Apache, IIS). If its still not working make sure PHP is reading the php.ini your editing.
  18. no / to php means root of the filesystem, not your websites root directory.
  19. You'd first use mysql_query to run the query, then to retrieve the result use any of mysql_fetch_* functions (* meaning row, assoc, object etc) or mysql_result. However I fail to see the purpose of all those queries, only one is needed. The first two do the same thing. The last wont work I dont think.
  20. You most probably have an error in your query then. Change $query = "CALL count_threads()"; $result = $dbh->query($query); to $query = "CALL count_threads()"; $result = $dbh->query($query) or die($dbh->error); If you know your query is always going to return one result then don't use a loop at all. $row = $result->fetch_object(); echo $row->num_threads . "<br />";
  21. Load PHP as an Apache Module instead (remove any lines you added). Use the following lines in Apaches configuration file (httpd.conf) LoadModule php5_module "C:/server/php/php5apache2_2.dll" PHPIniDir "C:/Server/php" AddType application/x-httpd-php .php Thats it. Save the httpd.conf and restart Apache. You must go to http://localhost to run your php scripts. You cannot simply open them up in your web browser, using 'open with' or 'file open' Also never use short tags in your php scripts.
  22. In order to install mapserver your current installation of Apache and PHP will have to be uninstalled. It will fail to install over a current instance of Apache.
  23. I came up with: <?php $arr[] = array( 'article_id' => 5, 'breed_name' => 'Chimp', 'url' => 'feeding' ); $arr[] = array( 'article_id' => 6, 'breed_name' => 'Chimp', 'url' => 'play' ); $arr[] = array( 'article_id' => 7, 'breed_name' => 'Desert ', 'url' => 'feeding-2' ); $arr[] = array( 'article_id' => 8, 'breed_name' => 'Desert ', 'url' => 'feeding-io' ); $arr[] = array( 'article_id' => 7, 'breed_name' => 'Desert ', 'url' => 'feeding-9' ); $arr[] = array( 'article_id' => 7, 'breed_name' => 'Forest ', 'url' => 'feeding-6' ); echo '<pre>' . print_r($arr, true) . "</pre>\n\n"; $cat = null; $last = count($arr) - 1; $o = false; echo '<ul>'; foreach($arr as $k => $sArr) { if($cat != $sArr['breed_name']) { if($o) { echo " </ul>\n </li>\n"; $o = false; } echo "\n <li>\n " . $sArr['breed_name'] . "\n <ul>\n"; echo ' <li>' . $sArr['url'] . "</li>\n"; $cat = $sArr['breed_name']; $o = true; } else { echo ' <li>' . $sArr['url'] . "</li>\n"; } if($k == $last) echo " </ul>\n </li>\n"; } echo '</ul>'; ?>
  24. Yes, just set the path to the image for each category in your database. To display the image do something like echo '<img src="' . $row['your_img_col'] . '" />'; in your while loop.
  25. Does each row have three columns, called upX (X being a number 1 to 3) If so do $query = "SELECT * FROM $tbl_name WHERE id ='10'"; $result = mysql_query($query); while ($row = mysql_fetch_array($result)) { $i = 1; foreach($row as $item) { if(!empty($item)) { echo '<h5 class="update' . $i .'">' . $item . '</h5>'; } $i++; } } mysql_free_result($result);
×
×
  • 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.