premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
$data = explode("?", $_SERVER['HTTP_REFERER']); $referrer = $data[1]; echo $referrer; explode is what you want, rtrim is for trimming extra characters at the end of a string, you just wanted to remove everything after the ?. You may also want to checkout parse_url @drisate: ? should work fine as long as you want to trim it and it is the last character of the string. <?php $trim = '"test string"?'; $trim = rtrim($trim, '?'); echo $trim; die(); ?>
-
$total = (($x * $y) / 2); For number operations, I tend to always encapsulate it in parans like above to avoid weird results that may come of it.
-
You can check here http://us.php.net/manual/en/function.curl-setopt.php I believe there are ways for Curl to handle SSL.
-
file_get_contents curl If those solutions are not what you are looking for, you need to elaborate a bit more.
-
Did I once tell him to turn it on? I simply asked him to check if it is "on".
-
<?php $trim = '"test string"'; $trim = trim($trim, '"'); echo $trim; ?> That worked for me. EDIT: Thinking about it, are Magic Quotes turned on, on your server? If so then the character is actualy \" which would explain why it does not trim it. I would either turn off Magic Quotes or try doing a stripslashes on the data before trimming. This is assuming you are getting the value from a POST/GET scenario.
-
variable not being applied after post form
premiso replied to infiniphunk's topic in PHP Coding Help
Use sessions to store the variables to transfer from page to page or on the second form create them as hidden inputs. -
Your apache may not be setup to determine that "index.php" should be defaulted. Why not just add /index.php?page= to that and solve the problem easier/quicker? Or replace the index.php with the parsing page.
-
Good to know. I will have to do some tests on that now...
-
[SOLVED] Print Array Separated By Comma (Probably Easy)
premiso replied to hoopplaya4's topic in PHP Coding Help
<?php $user='username'; $hostmachine='localhost'; $password='password'; $database='dbname'; mysql_connect($hostmachine,$user,$password); mysql_select_db($database); $sql = "SELECT usrID, usrEmail, usrFirst, usrLast"; $sql .= " FROM tblUsers"; $result = mysql_query($sql) or die(mysql_error()); $emails = array(); while ($row = mysql_fetch_assoc($result)){ $emails[] = $row['usrEmail']; } $emails = implode(", ", $emails); echo '<a href="mailto: ' . $emails . '">Email Them</a>'; ?> -
Why not just use is_numeric or even is_int to check?
-
To address you main issue: header ("Location templateEdit.php?id=$id"); Is after data was outputted to the screen. Read header for more information. To fix it, you should have your output as the last item (or at least after header calls) in your script, not inter-mixed because of this very issue. Your code needs to be re-thought and corrected. The other option is ob_start which is a bandaid for the real issue.
-
[SOLVED] Execute PHP code from within an ECHO
premiso replied to karl_009's topic in PHP Coding Help
<td width="10%" valign="top" bgcolor="'.$bg_color.'"><a href="contact_edit.php?id=<?php echo $rows['id];?>">Update</a> You are using <?php tags inside of an echo. Concat it like King has done, or like you have done previously and it should work. -
PHP Graph
-
$cwd = getcwd(); $cwd = explode("/", $cwd); $pwd = $cwd[(count($cwd)-2)]; echo $pwd; Should do it for ya.
-
Expanding on what Mchl said: <?php $idfilters = array (1,3,5,7) $idfilters = implode(", ", $idfilters); $query = mysql_query("SELECT id_product FROM filters WHERE id_filter IN($idfilters)") or die ("Error in select query") ; ?> A tad bit easier and a ton less MySQL server load.
-
<?php $string = "The maximum bet is set at <b>$150,000</b>.<br> and The maximum bet is set at <b>$25,000</b>.<br>"; preg_match_all("~maximum bet is set at <b>\\$(.+?)</b>~si", $string, $matches); foreach ($matches[1] as $bets) { echo $bets . "<br />"; } die(); ?> Whether or not that is the best way to do it...it works with the example you gave us..
-
Do your own research. PHP Flash Get
-
Oh...I thought he wanted that function as an element of php via being compiled....I could be wrong, my mind is in a daze and I cannot think straight today, but yea. I would probably be in the Other Programming Languages if that was what he was after.
-
Well almost 5 hours later, hope that is urgent enough *rollseyes* CREATE TABLE friendslist (id INT AUTO_INCREMENT, requestorid INT not null,requestedid INT not null,requestedate TIMESTAMP not null, response varchar(10) null, PRIMARY KEY (`id`)) Should fix the problem. If you had this: $query=mysql_query("CREATE TABLE friendslist (id INT AUTO_INCREMENT PRIMARY KEY, requestorid INT not null,requestedid INT not null,requestedate TIMESTAMP not null, response varchar(10) null") or die(mysql_error()); You may have been able to solve it on your own. Alternatively thoroughly learning SQL Create Table would have helped you tremendously. I would suggest reading up on that or even buying a "SQL For Dummies" book to learn at least the basics of SQL.
-
You will probably need to use the google api, not sure, but that should allow you to pull different information. http://code.google.com/apis/maps/index.html
-
Next time post this in the right forum ( PHP Core Hacking ) And I would also state at the beginning what language you are using, as in this forum it is assumed PHP, where as C programming is not the same Syntax as PHP, thus your answers are going to be interpreted that you do not know PHP syntax and thus pointed in that direction.
-
The Modulus Operator ( % ) if (($i % 2) == 0) { echo 'not odd'; }else { echo 'odd'; } Replace $i with what you want to test to be "odd"
-
sitek.com does not have <span anywhere inside of it's source. Thus your preg_match code would never execute right. If sitek.com is the site you want to parse, what are you trying to get out of that site? If not please post the site you want to parse so we can further help you.
-
Umm no. A cron job is a task that runs at a certain time(s) automatically which you specify and is specific to unix. It really does not have to do with PHP other than you can setup a cron job to run a php script on your server if you have a linux server. The equivalent to this in Windows is Scheduled Tasks. Do some googling if you want to learn more on Cron jobs.