wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
I don't see any difference between the two snippets.
-
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).
-
how to enter one row record from more than 1 input fields
wildteen88 replied to mizraabi's topic in MySQL Help
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'] -
Parse error: syntax error, unexpected '}'
wildteen88 replied to rockxl1's topic in PHP Installation and Configuration
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. -
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
-
The code your posted makes no sense, you'll need to post more code
-
if Apache is installed on the same computer you're using then use http://localhost to connect to Apache.
-
File not found (404) on php test
wildteen88 replied to ayaxian's topic in PHP Installation and Configuration
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. -
example: $str = '123456789'; $s = array(2, 4, 1, 2); $c = 0; foreach($s as $o) { echo substr($str, $c, $o) . ' '; $c += $o; }
-
Apache will hide files that begin with .ht for security reasons.
-
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"
-
[SOLVED] mysqli queries a problem and a question.
wildteen88 replied to next's topic in PHP Coding Help
Have a read of the following article here specifically the last paragraph in the Executing Stored Procedures section. -
[SOLVED] mysqli queries a problem and a question.
wildteen88 replied to next's topic in PHP Coding Help
Use $result->free between each use of the stored procedure -
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.
-
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.
-
Php Postgress installation
wildteen88 replied to kishan's topic in PHP Installation and Configuration
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. -
no / to php means root of the filesystem, not your websites root directory.
-
How to get value form mysql query and store it into php variable?
wildteen88 replied to coder9's topic in PHP Coding Help
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. -
[SOLVED] mysqli queries a problem and a question.
wildteen88 replied to next's topic in PHP Coding Help
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 />"; -
[SOLVED] Not sure PHP is working correctly
wildteen88 replied to shelzmike's topic in PHP Installation and Configuration
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. -
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>'; ?>
-
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.
-
[SOLVED] is there anything like implode, but vertically?
wildteen88 replied to jaydeesmalls's topic in PHP Coding Help
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);