wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
Why do you want to convert it to a single echo? Wouldn't it be best to leave it as-is? You can "go in and out of PHP" as many times within a script, all output doesn't need to be in an echo.
-
As long as your are not ripping the other site then file_get_contents will do what you want. There is no point in using a http url within include/require as only the output (text/html) of the requested script (video.php) will be returned, not the PHP source code. This is why I told you to use file_get_contents.
-
The following does what you want: <?php $link[] = "features/silly/text/facts"; $link[] = "features/silly/text/facts/cats"; $link[] = "features/silly/text/facts/dogs"; $link[] = "features/silly/text/facts/_contents"; $link[] = "features/silly/text/facts/cats"; $link[] = "features/silly/text/facts/dogs"; $link[] = "features/silly/text/jokes/_contents"; $link[] = "features/silly/text/jokes/cats"; $link[] = "features/silly/text/jokes/dogs"; $assoc = array(); foreach($link as $s_link) { $keys = explode('/', $s_link); eval('$assoc[\'' . implode('\'][\'', $keys) . '\'] = "";'); } echo '<pre>' . print_r($assoc, true) . '</pre>'; ?> How is the $assoc associative array going to be used latter on?
-
Use preg_replace maybe: $i = preg_replace("/\s+/", " : ",$i);
-
From that url your provided seems you want to place a movie in your webpage. You should use file_get_contents instead. include/require should be use for including PHP source code. You should make sure allow_url_fopen is enabled.
-
If you are getting that type of error then there is a problem with your mysql query. Post the code here that the error refers to.
-
Make sure you havn't missed a step in the book (back track a page or two). The book should explain how to select or create a databases before telling you how to create a table.
-
[SOLVED] Select top 1 and top 2-6 records from MySQL
wildteen88 replied to Lyleyboy's topic in PHP Coding Help
SELECT * FROM your_table ORDER BY your_id_column DESC LIMIT 5 that will return rows 23, 20, 18, 15 and 11 -
Yes what you're doing is possible, aslong as you're entering a valid MySQL query in the textarea. To see why your query is failing chnage: $sql = mysql_query("$querybox") or die('Error, query failed'); to $sql = mysql_query($querybox) or die('Error, query failed<br ><b>Query:</b><pre>' . $querybox . '</pre><b>Error: </b>' . mysql_error());
-
Argh, its http://yoursite.com/music/ the / must be at the end of the url.
-
You have an error somewhere you should enable a setting called display_errors and make sure error_reporting is to to E_ALL within the php.ini
-
Well this bunch of code is not quote right: $r = 1; $r <= $used; $r++ ; Your set $r to 1 then you are incorrectly comparing to see if $r is then or equal to $used (which doesn't seem to exis), if it is increment $r The first line should be outside of the while loop. The next two lines should be: if($r <= $used) $r++;
-
[SOLVED] n00b PHP4 - PH5 form array compatibility problem
wildteen88 replied to bothwell's topic in PHP Coding Help
Its more to with what you're trying to do on line 77. $total_votes = array_sum($votes[$i]); Where is the $votes variable assigned? does $votes contain an array? Perhaps you mean to do: $total_votes = array_sum($votes); -
Is that all your code? If it is you cannot leave your else statement open, you'll need to use two closing braces in order for the code to function. if($forum_lock == 1){ echo 'locked'; } else { } // close if/else } // close while
-
Something like <?php if(isset($_POST['submit'])) { switch($_POST['filter']) { case 'sepia': $matrix = array( array(2, 2, -2), array(2, 1, -1), array(2, -2, -2) ); break; case 'filter2': $matrix = array( array for fiter2 ); break; case 'filter3': $matrix = array( array for fiter3 ); break; } $im = imagecreatefromjpeg('images/tree.jpg'); makeFilter($im, $matrix); } ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> Filter:<br /><input type="radio" name="filter" value="sepia"> Sepia<br /> <input type="radio" name="filter" value="filter2"> Filter2<br /> <input type="radio" name="filter" value="filter3"> Filter3<br /> <input type="submit" name="submit" value="Apply Filter"> </form>
-
Something like: Alias /music/ "/music" <Directory "/music"> AllowOverride None Options Indexes Order allow,deny Allow from all </Directory> Add the above to your httpd.conf. Restart Apache. Access http://your-site.com/music
-
kens code does exactly that. It doesn't limit any thing.
-
Doh! Just noticed whats up, it's to do with the backticks MySQL is trying to find a column called message_board.per_code not the column per_code within the message_board table. This: `message_board.per_code` should be witten as `message_board`.`per_code` Only the table/column name needs to be in backticks not the period.
-
You must of typed something incorrectly. Double check to make sure everything is spelled correctly (your query and your database). You may have made a mistake when creating the table/columns in the database, for example per_code may be typed like par_code something silly like that. Also avoid using SELECT * in your query. List your columns.
-
Yes, however it only generates an $sql variable for passing to mysql_query and nothing else. For example is ran the following query in PMA: SELECT * FROM Table It'll only generate $sql = 'SELECT `*' . ' FROM table';
-
You should have look into the concatenation operator to join strings. I'd change: echo '</center></td><td><center>'; echo '<a href="download.php?f='; echo $row[fname]; echo '">'; echo $row[fname]; echo '</a></center>'; to echo '</center></td><td><center><a href="download.php?f=' . $row['fname']} . '">' . $row['fname'] . '</a></center>';
-
Yes you have installed XAMPP fine. You place all your files in /opt/lampp/htdocs for linux installations. Read here for locating other files/directories too. XAMPP has a redirection script (I thing its called index.html) located in /opt/lampp/htdocs which will redirect you to xampp/splash.php when you access http://localhost If you want you can remove this script (clear your browsers cache afterwards though). To run your script you go to http://localhost/scriptname.php
-
Help! i can't make a *layout table* anymore
wildteen88 replied to moffo's topic in Editor Help (PhpStorm, VS Code, etc)
What do you mean? Tables should not be used for webpage layouts. You should look into creating table-less layouts. There are many tutorials out there which explain how to create such layouts. -
how to enable apache on my local machine send email?
wildteen88 replied to ivytony's topic in Apache HTTP Server
You don't need to install an SMTP mail server locally to send emails. Just configure PHP to point to an existing SMTP mail server. To do this open your php.ini and locate the following lines: [mail function] ; For Win32 only. SMTP = localhost smtp_port = 25 ; For Win32 only. ;sendmail_from = [email protected] Change localhost to your ISP's mail server address, eg smtp.your_isp.com Leave the smtp_port as-is (change it if your ISP uses a different port). Next remove the semi-colon ( ; ) from in front of the sendmail_from line and change [email protected] to the email address provided by your ISP. Save the php.ini and restart Apache. Test to see if the changes worked by running a simple mail script.