jcbones
Staff Alumni-
Posts
2,653 -
Joined
-
Last visited
-
Days Won
8
Everything posted by jcbones
-
Total n00b trying to build website. Plz help :(
jcbones replied to Kemmeo's topic in PHP Coding Help
Please don't use w3schools, they have a lot of outdated, and/or false information. -
Ah, you found Maq's pic!
-
There should really be a sticky about emails not sending. The number UNO (1) problem faced is that in today's interweb consortium games, most every HOST on the market REQUIRES that the FROM header on emails match an EXISTING email account hosted on the SMTP (email) server. Short form: You cannot use a submitted email to SEND the email, you must change: $headers = "From: $email\r\n"; To a valid email that exist on your server. You can still put that email in the body of the message. IE: $headers = "From: me@rustyeckford.com\r\n";
-
If you are running a *nix server, use crontabs. If you are running winDoze server, use task scheduler.
-
not even sure this is possible with a file_get_contents
jcbones replied to sandbudd's topic in PHP Coding Help
It is quite simple, the PHP script you are calling resides on a different server. When you call a file using 'file_get_contents()', and you specify the file path with 'http://', the file gets parsed by the server BEFORE delivery of the contents. He had you to place 'placeholders' in your script where you wanted the data to show. Placeholders are unique string patterns that isn't normally used in a page layout. You can make them anything you want, but they must be unique. He then had you to do a simple string_replace function to find you placeholders, and replace them with your desired variables. -
Run trim() on the data. That should get rid of the whitespace.
-
$sql = "SELECT b.tag_name FROM points_tags AS a JOIN tags AS b ON a.tag_id = b.id WHERE a.point_id = '$point_id'"; $get_point_tags = mysql_query($sql) or die($sql . ' has an error<br />' . mysql_error()); while($point_tags = mysql_fetch_assoc($get_point_tags)){ $arr[] = '<a href="../tags/name/'.stringForUrl($point_tags['tag_name']).'">'.$point_tags['tag_name'].'</a>; '; } echo implode(', ',$arr);
-
Looping an array back into a multiple select field
jcbones replied to alhen's topic in PHP Coding Help
Is the options statically coded, or are they dynamic also? My option would be to set the options in an array, then check them against the database as you build the select box. <?php $options = array('AAPM – American Academy of Pain Medicine','APS – American Pain Society','AACE – American Association of Clinical Endocrinologists','ECE – European Congress of Endocrinology', 'ENDO – The Endocrine Society','ENEA – European Neuro Endocrine Association','ESPE – European Society for Paediatric Endocrinology','LWPES – Lawson-Wilkins Pediatric Endocrine Society'); $pieces = explode("<br>", $society_inf); // society_inf is the mysql field name AND the variable name, for simplicity ?> <select name="society_inf[]" multiple="multiple" id="society_inf" tabindex="290"> <?php foreach($options as $value) { $selected = (in_array($value,$pieces)) ? 'selected="selected"' : NULL; echo '<option ' . $selected . '>' . $value . '</option>'; } ?> </select> -
Did you try to remove the double quotes: var credit = <?php $row->coff ?>; Javascript doesn't add strings the same as it adds integers.
-
Re-direction to a different page isn't going to work for you, if the $_POST or $_GET array is set, as the new page will not have access to those variables. Like requinix stated, use an include.
-
Globals is never the fix, and should be depreciated IMHO. Either build the arrays inside the function, or pass them as arguments. Setting Globals defeats the purpose of a function, as you have now tied the function to a specific instance, and can no longer use the function, if one of the globals doesn't exist in the script.
-
Does that mean you checked it? Or are just stating the obvious which is that at the risk of helping someone, there is too much for you to risk yourself? Doubtful, but possible? I was under the impression for PHP coding that it only took a few lines, to open a port and connection type to the website for it to be a concern. I considered it because I need the help, and the development forums I've used, he's active on, which tends to be a good indicator that he is genuine. But again, I don't know anything about PHP coding. So the coding does have a backdoor or exploit? And the website that used the exploit has been down for 2 years? Sorry, but its very confusing. That means my Virus software kicked it out as a 'trojan'.
-
Self explanatory, PHP cannot find the class 'WebRequest'. Either it does NOT exist, or you spelt it wrong. Perhaps you missed an include.
-
HUH??? OK, after careful consideration, I followed you. Your post needs to be clear and concise in order to help someone. Fugix is talking about here: # Make an absolute path, this improves performance by avoiding some stat calls if ( substr( $filename, 0, 1 ) != '/' && substr( $filename, 1, 1 ) != ':' ) { global $IP; $filename = "$IP/$filename"; }{ //<-missed your 'else' between the brackets. require( $filename ); return true; }
-
The Number ONE reason people doesn't like when you attach files to your post, is anything can be in that file. Yep, your file doesn't pass muster either.
-
If you set the `itemNumber` as a UNIQUE key, you could then run a 'ON DUPLICATE UPDATE' query. Which would insert a new row, unless it found a row with the itemNumber, then it would update the row. Syntax
-
It is just table aliases, so I didn't have to type the names out every time.
-
Inside the form, outside the form is not the problem. Since technically, everything in PHP is outside of the HTML scope. As it is separate from HTML, and executed before the browser even thinks of displaying the markup. However, the problem does lye in the fact that I don't see any PHP tags around that bit of code. Which means that code is passed to the browser, and never parsed by PHP.
-
Make sure your file permissions are set correctly. It should be set to 0644
-
<?php $myarray = array( 0 => array( 'year' => 2009, 'month' => "November", 'month_sales' => 524, 'year_totalsales' => 3610 ), 1 => array ( 'year' => 2009, 'month' => 'December', 'month_sales' => 521, 'year_totalsales' => 3610 ), 2 => array ( 'year' => 2010, 'month' => "January", 'month_sales' => 609, 'year_totalsales' => 3610 )); $lastyear = NULL; foreach($myarray as $row) { if ($row['year'] != $lastyear) { echo (!empty($lastyear)) ? '</table>', PHP_EOL : NULL; echo "<table><tr><th>Month</th><th>Sales</th></tr>", PHP_EOL,"<tr><th colspan=2>", $row['year'], "</th></tr>", PHP_EOL; $lastyear = $row['year']; } echo "<tr><td>", $row['month'], "</td><td>", $row['month_sales'], "</td></tr>", PHP_EOL; } echo "</table>", PHP_EOL; ?>
-
Did you try my query?
-
Nope, I suppose the audio works on hover, or when you mouseover the anchor. If so, then it will not work, as I have set it to work only when you click it. You could fix it by changing the 'onclick' to a 'onmouseover'. However, most see this the same way as inline CSS styling, which means 'It is ok to do it, but it is not considered professional'. The following note is for reference only The suggested fix is to set it through the DOM on an event listener.
-
Lets see the full script, as I am not sure if all of the PHP tags are in the correct positions. Seems this script is out-of-context.
-
Is the file saved with a .php extension?